akhauriyash/Code-Regression huggingface dataset:
//I am so vegetable
#include <bits/stdc++.h>
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _defor(i,a,b) for((i) = (a);(i)<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto p:st)
//#define _LOCAL_
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll maxn = 1e2 + 5;
const int MOD = 1e9 + 7;
const double exps = 1e-6;
#ifdef _LOCAL_
void deprint() {
	ofstream cout("E:\\acm dream\\debug.txt");
	return;
}
#endif
int main() {
#ifdef _LOCAL_
	ifstream cin("E:\\acm dream\\in.txt");
	ofstream cout("E:\\acm dream\\out.txt");
#endif
	//srand((unsigned)time(nullptr));
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	int a[3][3];
	int n;
	_for(i, 0, 3)
		_for(j, 0, 3)cin >> a[i][j];
	cin >> n;
	set<int>b;
	int x;
	bool flag = false;
	_for(i, 0, n) { cin >> x; b.insert(x); }
	_for(i, 0, 3)
		if (b.count(a[i][0]) && b.count(a[i][1]) && b.count(a[i][2]))flag = true;
		else if (b.count(a[0][i]) && b.count(a[1][i]) && b.count(a[2][i]))flag = true;
	if (b.count(a[0][0]) && b.count(a[1][1]) && b.count(a[2][2]))flag = true;
	if (b.count(a[0][2]) && b.count(a[1][1]) && b.count(a[2][0]))flag = true;
	if (flag)cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#include <cstdlib>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define MOD 1000000007
#define INF 1000000007
#define PI 3.14159265358979323846
using namespace std;
//
int main(){
  int H,W,N;
  PA A[10001];
  cin>>H>>W>>N;
  FOR(i,1,N+1){
    int a;
    cin>>a;
    A[i].first=a;
    A[i].second=i;
  }
  sort(A+1,A+N+1);
  int MAP[101][101];
  int nx=1,ny=1;
  bool update=true;
  FOR(i,1,N+1){
    int num=A[i].first;
    int col=A[i].second;
    FOR(j,0,num){
      if(update){
        MAP[nx][ny]=col;
        if(ny+1<=W){
          ny++;
        }else{
          nx++;
          update=false;
        }
      }else{
        MAP[nx][ny]=col;
        if(ny-1>=1){
          ny--;
        }else{
          nx++;
          update=true;
        }
      }
    }
  }
  FOR(i,1,H+1){
    FOR(j,1,W+1){
      if(j!=1){
        cout<<" ";
      }
      cout<<MAP[i][j];
      if(j==W){
        cout<<endl;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 384
package main

import "fmt"

func main() {
	var N int
	var ac, wa, tle, re int

	fmt.Scan(&N)

	S := make([]string, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&S[i])
		switch S[i] {
		case "AC":
			ac++
		case "WA":
			wa++
		case "TLE":
			tle++
		case "RE":
			re++
		}
	}
	fmt.Println("AC x", ac)
	fmt.Println("WA x", wa)
	fmt.Println("TLE x", tle)
	fmt.Println("RE x", re)

}


Measured memory_bytes: 6852
//https://atcoder.jp/contests/agc026/tasks/agc026_b
#include<iostream>
#include<vector>
#include<algorithm>

int main(){
	std::ios::sync_with_stdio(0);std::cin.tie(0);
	int ntest;std::cin>>ntest;
	while(ntest--){
		int64_t a,b,c,d;std::cin>>a>>b>>c>>d;

		// after each day, the num of cans:
		// * if > c+b:   -= b (still > c),
		// * else (but still >= b): += d-b. (after that it's >= d)
		if(a>c+b)
			a=(a-c-1)%b+c+1;

		if(d>c+b)
			// after each +d-b, the next day it's always -b
			// while(d>c+b) d-=b;
			d=(d-c-1)%b +c+1;

		if(d<b||a<b){
NO:
			std::cout<<"No\n";
			continue;
		}

		if(c+1>=b){
YES:
			std::cout<<"Yes\n";
			continue;
		}

		// now c+1<b<=d, b<=a, a<=c+b, d<=c+b.
		// after the first jump d will be added
		if(b==d)goto YES;

		// before each +d-b op, the num of fruit is in ] c .. b+c ] (#=b)
		auto min_a=(a-c-1)%std::__gcd(b,d) +c+1;
		if(min_a<b)goto NO;else goto YES;
	}
}

Measured memory_bytes: 256
import sys

def solve():
    input = sys.stdin.readline
    X = int(input())
    if 0 < X % 11 <= 6: print(((X - 1) // 11 + 1) * 2 - 1)
    else: print(((X - 1) // 11 + 1) * 2)

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 2940
import heapq
N, M = map(int,input().split())
al = list(map(int,input().split()))
al = list(map(lambda x: x*(-1), al))
heapq.heapify(al)

for _ in range(M):
    tmp_min = heapq.heappop(al)
    heapq.heappush(al, -1*(-tmp_min//2))
print(-sum(al))

Measured memory_bytes: 73196
import java.util.Scanner;

public class Main{
	public static int[] prime(int x){
		int[] temp = new int[x];
		temp[0] = 2;
		temp[1] = 3;
		int index = 2;
		for(int i = 5; i < x; i += 2){
			int j = 1;
			double lim = Math.sqrt(i);
			for(; temp[j] <= lim; j++){
				if( i%temp[j] == 0 ){
					break;
				}
			}
			if( temp[j] > lim ){
				temp[index] = i;
				index++;
			}
		}
		int[] p = new int[index];
		System.arraycopy(temp, 0, p, 0, index);
		return p;
	}
				
	public static long calculate(int x, int a){
		long ans = x;
		while( a > 0 ){
			ans *= x;
			a--;
		}
		long result = (ans-1)/(x-1);
		return result;
	}
	
	public static String solve(int n, int[] p){
		String result = new String();
		int[][] divisor = new int[p.length][2];
		int index = 0;
		int temp = n;
		int count = 0;
	
		for(int i = 0; i < p.length && p[i] <= temp; i++){
			count = 0;
			while( temp%p[i] == 0 ){
				temp /= p[i];
				count++;
			}
			if( count > 0 ){
				divisor[index][0] = p[i];
				divisor[index][1] = count;
				index++;
			}
		}
		if( temp > 1 ){
			divisor[index][0] = temp;
			divisor[index][1] = 1;
			index++;
		}
		long ans = 1;
		for(int i = 0; i < index; i++){
			ans *= calculate(divisor[i][0], divisor[i][1]);
		}
		if( ans-n == n ){
			result = "perfect number";
		} else if( ans-n < n ){
			result = "deficient number";
		} else {
			result = "abundant number";
		}
		return result;
	}
			
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int[] data = new int[101];
		int index = 0;
		int max = 0;
		
		while( (data[index] = stdIn.nextInt()) != 0 ){
			if( data[index] > max ){
				max = data[index];
			}
			index++;			
		}
		int a = (int)Math.sqrt(max);
		int[] p = prime(a);
		
		for(int i = 0; i < index; i++){
			System.out.println(solve(data[i], p));
		}
	}
}

Measured memory_bytes: 12000
import sys
sys.setrecursionlimit(500000)

N = int(input())

#道を双方向に記録する。
g = [[] for _ in range(N)]

for i in range(N-1): #木の辺の数はN-1
  #iが辺のID
  a,b = map(int,input().split())
  a -= 1; b -= 1 #ここで引いて頂点を0スタートにしないとオーバーフロー
  g[a].append((b,i))
  g[b].append((a,i))

#これが答え。
ans = [-1 for _ in range(N-1)]

#vという頂点からpという親にcolorという色で繋がっている。
def dfs(v, color, p):
  k = 1 #色の初期値
  for i in range(len(g[v])): #vから繋がっている頂点をtoとして探す
    TO = g[v][i][0]
    ID = g[v][i][1]
    if TO == p: #親は一つでそれ以外は子。親の時だけ無視すればよい。
      continue
    if k == color: #親から繋がっている色と被ったらダメ。
      k += 1
    ans[ID] = k
    k += 1 #ここで足す1をしないとこのfor loopの中の辺で色が被る。
    dfs(TO,ans[ID],v)

dfs(0,0,-1) #根を0として、仮想親の-1から仮想色0で繋がっている。
print(max(ans))
for i in ans:
  print(i)

Measured memory_bytes: 74404
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

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

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

macro_rules! chmax {
    ($x:expr, $e:expr) => {
        if $x < $e {
            $x = $e;
        }
    };
}
macro_rules! chmin {
    ($x:expr, $e:expr) => {
        if $x > $e {
            $x = $e;
        }
    };
}

const INF: i64 = 1 << 60;

fn main() {
    input!{
        S: chars,
    }
    let N = S.len();
    let mut cnt = 0;
    let mut ans = vec![0; N];
    for i in 0..N {
        if S[i] == 'R' {
            cnt += 1;
        } else {
            ans[i] += cnt/2;
            ans[i-1] += (cnt+1)/2;
            cnt = 0;
        }
    }
    for i in (0..N).rev() {
        if S[i] == 'L' {
            cnt += 1;
        } else {
            ans[i] += cnt/2;
            ans[i+1] += (cnt+1)/2;
            cnt = 0;
        }
    }
    let s = ans
        .iter()
        .map(|i| i.to_string())
        .collect::<Vec<String>>()
        .join(" ");
    println!("{}", s);
}


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

string S, T;
int q;

template <typename T>
class BIT
{
    vector<T> val;
public:
    BIT(int N) : val(vector<T>(N+1, (T)0)) {}
    void add(int pos, T addv)
    {
        if (pos >= (int)val.size()) return;
        val[pos] += addv;
        add(pos + (pos & -pos), addv);
    }
    T sum(int pos)
    {
        if (!pos) return (T)0;
        return val[pos] + sum(pos - (pos & -pos));
    }
};

int main()
{
    cin >> S >> T >> q;
    BIT<int> s(S.size()), t(T.size());

    for (unsigned i = 0; i < S.size(); i++) s.add(i+1, (int)S[i]-'A'+1);
    for (unsigned i = 0; i < T.size(); i++) t.add(i+1, (int)T[i]-'A'+1);

    for (int i = 0; i < q; i++)
    {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        if ((s.sum(b) - s.sum(a-1)) % 3 == (t.sum(d) - t.sum(c-1)) % 3) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
const long long m = 1e9+7;
const long long maxn = 2e6+1;
long long fact[maxn];
int k, n;
string s;

int bigmod(int a, int b) 
{
    if(b == 0) return 1 % m;
    int x = bigmod(a, b/2);
    x = (long long) x * x % m;
    if(b&1) x = (long long) x * a % m;
    return x;
}


int comb(int n, int r) {
    if(n < 0 || r < 0) return 0;
    if(n < r) return 0;
    int ans = (long long) ((long long) fact[n] * bigmod(fact[r], m-2) % m) * bigmod(fact[n-r], m-2) % m;
    return ans;
}

int main()
{
    fact[0] = fact[1] = 1;
    for(int i = 2; i <= maxn-1; i++) fact[i] = (long long) fact[i-1] * i % m;
    
    cin >> k >> s;
    n = (int)s.size()-1;
    int ans = 0;
    for(int i = n; i <= n+k; i++) {
        ans = (ans + (long long) ((long long) comb(i,n) * (bigmod(26, (n+k)-i)) % m) * bigmod(25, (i-n)) % m) % m;
    }

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 20844
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,m=map(int,input().split())
    E=[[] for _ in range(n)]
    for _ in range(m):
        a,b=map(lambda x:int(x)-1,input().split())
        E[a].append(b)
    # bfs
    def bfs(sv):
        prev=[-1]*n
        flag=False
        from collections import deque
        Q=deque([sv])
        while(Q):
            v=Q.popleft()
            for nv in E[v]:
                if(nv==sv):
                    break # for loop
                elif(prev[nv]==-1):
                    prev[nv]=v
                    Q.append(nv)
            else:
                continue
            break # while loop
        else:
            return [0]*(n+1)
        loop=[]
        while(v!=-1):
            loop.append(v)
            v=prev[v]
        loop.reverse()
        return loop
    # calculate
    ans=[0]*(n+1)
    for i in range(n):
        loop=bfs(i)
        if(len(loop)<len(ans)):
            ans=loop
    if(len(ans)==n+1):
        print(-1)
    else:
        print(len(ans))
        for v in ans: print(v+1)
resolve()

Measured memory_bytes: 43500
// Problem : D. Let's Play the Words?
// Contest : Codeforces Round #606 (Div. 2, based on Technocup 2020 Elimination Round 4)
// URL : https://codeforces.com/contest/1277/problem/D
// Memory Limit : 256.000000MB 
// Time Limit : 3000.000000milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor2)
 
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <utility>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <cassert>
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
 
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
 
#define forn(i,a,b) for (int i = (a); i < (b); ++i)
#define fo(i,a) forn(i,0,a)
#define rforn(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define ro(i,a) rforn(i,0,a)
#define trav(a,x) for (auto& a: x)
 
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define rsz resize
#define ins insert
 
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define f first
#define s second
 
int main() {
 
	fast_cin();

	ll a, b, c;
	cin >> a >> b >> c;
	ll s= a+ b +c;
	
	if (s >= 22) {
		cout << "bust" << endl;
	}else {
		cout <<  "win" << endl;
	}
 
 
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 111
int main(void){
	int i, j;
	int mode;
	int counter;
	char str[MAX];
	while(1){
		mode = 0;
		counter = 0;
		if(scanf("%s",str) == EOF){break;}
		for(i = 0; str[i] != 0; i++){
			if(str[i] == '@'){
				mode = 1;
			}else if(mode == 0){
				putchar(str[i]);
			}else if(mode == 1){
				counter = str[i] - '0';
				for(j = counter; j > 0; j--){
					putchar(str[i+1]);
				}
				mode = 2;
			}else if(mode ==2){
				mode = 0;
			} 
		}
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>

int main() {
  int X, A, B;
  std::cin >> X >> A >> B;

  int safety = X + A;
  if ( safety >= B ) {
    if ( X < B ) {
      std::cout << "safe" << std::endl;
    } else {
      std::cout << "delicious" << std::endl;
    }
  } else {
    std::cout << "dangerous" << std::endl;
  }

  return 0;
}


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

struct SegmentTree {
private:
    int n;
    vector<int> node;
public:
    SegmentTree(vector<int> v) {
        int sz = (int)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, 0);

        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = node[i*2+1] + node[i*2+2];
    }

    void add(int k, int val) {
        k += (n - 1);
        node[k] += val;

        while(k > 0) {
            k = (k - 1) / 2;
            node[k] = node[2*k+1] + node[2*k+2];
        }
    }

    int getsum(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        if(b <= l || r <= a) return 0;
        if(a <= l && r <= b) return node[k];

        int vl = getsum(a, b, 2*k+1, l, (l+r)/2);
        int vr = getsum(a, b, 2*k+2, (l+r)/2, r);
        return vl + vr;
    }
};

int main() {
    int n, q; cin >> n >> q;
    SegmentTree seg( vector<int>(n, 0) );
    for(int i=0; i<q; i++) {
        int c, x, y; cin >> c >> x >> y;
        if(c == 0) seg.add(x-1, y);
        else cout << seg.getsum(x-1, y) << endl;
    }
    return 0;    
}

Measured memory_bytes: 4072
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from itertools import chain
from functools import reduce
from collections import OrderedDict, Counter, deque
import operator

IS = lambda: int(input())
IA = lambda: [int(x) for x in input().split()]

_ = IS()
H = IA()

ans = 0
cur = -1
for h in H:
    if cur <= h:
        cur = h
        ans += 1
print(ans)

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


int main(void)
{
  while(1)
  {
    string data;
    cin >> data;
    if(data == "-")
    {
      break;
    }
    int cnt;
    int sum = 0;
    cin >> cnt;
    for(int i = 0; i < cnt; i++)
    {
      int num;
      cin >> num;
      sum += num;
    }
    sum %= data.size();
    cout << data.substr(sum, data.size() - sum);
    cout << data.substr(0, sum);
    cout << endl;
  }
}


Measured memory_bytes: 3168
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
        int dis = sc.nextInt();
        if(n >= 10){
        	System.out.println(dis);
        }else{
        	System.out.println(dis + (100 * (10 - n)));
        }
    }
}

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

ll solve() {
    string S, T, U;
    ll A, B;
    cin >> S >> T >> A >> B >> U;
    if ( S == U ) {
        cout << A-1 << " " << B << "\n";
    } else {
        cout << A << " " << B-1 << "\n";
    }
    return 0;
}

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

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long long ll;
const int IINF = INT_MAX;
const ll INF = 1LL << 30;
const ll MOD = 1e9 + 7;


int main() {
    string s; cin >> s;
    cout << s.substr(0, 3) << endl;

    return 0;
}


Measured memory_bytes: 3580
n,d = map(int,input().split())

coord = []
for i in range(n):
    x,y = map(int,input().split())
    coord.append([x,y])

count = 0
for i in range(n):
    dist = coord[i][0]*coord[i][0] + coord[i][1]*coord[i][1]
    d_sq = d*d

    if d_sq >= dist:
        count+=1

print(count)

Measured memory_bytes: 39036
import std.stdio;
import std.conv;
import std.array;
import std.algorithm;

void main()
{
    int n = readln.split[0].to!int;
    int[] v = readln.split.to!(int[]);

    int[][] counter = new int[][](2, 100000);

    foreach (i; 0..n) counter[i % 2][v[i] - 1]++;

    ulong[][] max_i = new ulong[][](2, 2);
    foreach (i; 0..counter.length){
        if (counter[i][0] > counter[i][1]){
            max_i[i][1] = 1;
        } else {
            max_i[i][0] = 1;
        }
        foreach (j; 2..counter[i].length){
            if (counter[i][j] > counter[i][max_i[i][1]]){
                max_i[i][1] = j;

                if (counter[i][j] > counter[i][max_i[i][0]]){
                    max_i[i][1] = max_i[i][0];
                    max_i[i][0] = j;
                }
            }
        }
    }

    int ans;
    if (max_i[0][0] != max_i[1][0]){
        ans = n - counter[0][max_i[0][0]] - counter[1][max_i[1][0]];
    } else {
        ans = n - max(counter[0][max_i[0][0]] + counter[1][max_i[1][1]], counter[0][max_i[0][1]] + counter[1][max_i[1][0]]);
    }

    writeln(ans);
}



Measured memory_bytes: 4292
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		
		int ans = 0;
		for (int i = a; i < b + 1; i++) 
			if (c % i == 0)
				ans++;
		
		System.out.println(ans);
	}
}



Measured memory_bytes: 26352
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

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

    // Rust version 1.15.1, which is used by AtCoder,
    // does not support std::str::FromStr for char
    ($iter:expr, char) => {
        $iter.next().unwrap().chars().next().expect("Parse error")
    };

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

#[allow(unused_imports)]
fn main() {
    use std::cmp::max;
    use std::cmp::min;
    use std::collections::HashMap;

    input!{
        x: i32,
        t: i32,
    }
    let ans = if x - t < 0 {
        0
    } else {
        x - t
    };
    println!("{}", ans);
}


Measured memory_bytes: 4352
// Problem : A - Payment
// Contest : AtCoder - AtCoder Beginner Contest 173
// URL : https://atcoder.jp/contests/abc173/tasks/abc173_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// Delete the dynamically allocated memory

#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define pb              push_back
#define pr              pair<long long,long long>
#define mp(a,b)         make_pair(a,b)
#define vr              vector<long long>
#define mod1            1000000007
#define mod2            998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define fill(a,b)       memset(a, b, sizeof(a))
#define mk(arr,n,type)  type *arr=new type[n];
#define ll              long long
#define ld	            long double
#define w(x)            int x; cin>>x; while(x--)
ll power(ll base, ll exp) {
    ll res=1;
    while(exp>0) {
       if(exp%2==1) res=(res*base);
       base=(base*base);
       exp/=2;
    }
    return res;
}
int main()
{
	ll n;
	cin>>n;
	if(n%1000!=0){
		cout<<1000-(n%1000)<<"\n";
	}else{
		cout<<0<<"\n";
	}
	return 0;
	}

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

using namespace std;

int main(void) {
    int n, a, dp[110][110] = {};
    cin >> n;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++) {
            cin >> a;
            dp[i][j] = a + dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
        }
    
    int ans = -1e9;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            for (int k = i + 1; k <= n; k++)
                for (int l = j + 1; l <= n; l++)
                    ans = max(ans, dp[k][l] - dp[k][j] - dp[i][l] + dp[i][j]);
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3148
import sys
# import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

# mod p
class Combination():
    def __init__(self, n, p):
        self.n = n
        self.p = p
        self.note = [1, 1]
        self.noteinv = [1, 1]
        self.inv = [0, 1]
        self.calc()

    def calc(self):
        for i in range(2, self.n + 1):
            self.note.append((self.note[-1] * i) % self.p)
            self.inv.append((-self.inv[self.p % i] * (self.p // i)) % self.p)
            self.noteinv.append((self.noteinv[-1] * self.inv[-1]) % self.p)
    
    def nCr(self, n, r):
        n = self.n
        if r < 0 or n < r:
            return 0
        r = min(r, n - r)
        return (self.note[n] * self.noteinv[r] * self.noteinv[n - r]) % self.p

def Main():
    x, y = read_ints()
    if (x + y) % 3 != 0:
        print(0)
        exit()
    # n + 2m = X, 2n + m = Y => 3m = 2X - Y, 3n = 2Y - X
    n = (2 * x - y) // 3
    m = (2 * y - x) // 3
    cmb = Combination(n + m, MOD)
    print(cmb.nCr(n + m, min(n, m)))

if __name__ == '__main__':
    Main()

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

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

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

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

const double PI=acos(-1);
const ll INF = 1LL<<62;
const ll MINF = -(1LL<<62);

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

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

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

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


int main() {
	IO;
	int n;
	cin>>n;
	vector<int> a(n+1);
	map<int,int> van;
	for(int i=1;i<=n;++i) {
		cin>>a[i];
		van[i-a[i]]++;
	}
	
	ll ans=0;
	for(int i=1;i<=n;++i) {
		van[i-a[i]]--;
		ans+=van[i+a[i]];
	}
	
	cout<<ans<<"\n";

	return 0;
}


Measured memory_bytes: 21132
#include<stdio.h>
int main()
{
	int A,B,C,X,answ=0,subans[500];
	int i,j,k,l;
	
	
	
	
	////////// Scan
	scanf("%d %d %d %d",&A,&B,&C,&X);
	
	
	
	for (i=0;i<=X/500 && i<=A;i++){
		for (j=0;j<=X-500*i && j<=B;j++){
			for (k=0;k<= X-500*i-100*j && k<=C;k++){
				if (X==500*i+100*j+50*k) answ += 1;
				else ;
	}}}
	
	
			printf("%d",answ);
	
	return 0;
}



Measured memory_bytes: 128
import java.util.*;

public class Main {

	public static void main(String[] args) {

		// 入力
		Scanner sc = new Scanner(System.in);
		Integer target = new Integer(Integer.parseInt(sc.next()));
		int n = Integer.parseInt(sc.next()); // 禁止リストの長さ

		// 禁止リストがない場合は目標がそのまま答え
		if (n == 0) {
			System.out.println(target);
			return;
		}

		// 入力（続き）
		Integer x[] = new Integer[n];
		for (int i = 0; i < n; i++) {
			x[i] = new Integer(Integer.parseInt(sc.next()));
		}

		// 目標が禁止されていない場合は目標がそのまま答え
		if (!Arrays.asList(x).contains(target)) {
			System.out.println(target);
			return;
		}

		// ソート
		Arrays.sort(x);
		// System.out.println(Arrays.toString(x));

		// 目標は禁止リストの何番目？
		int index = Arrays.asList(x).indexOf(target);

		// 左方向に答えを探していく
		int now = target.intValue();
		int minus = 0;
		while (now <= x[x.length - 1].intValue()) {

			// １歩く
			minus++;

			// そこは？
			now = target.intValue() - minus;
			// System.out.println("ここは" + now);

			// 禁止リストにない数に到達したらwhileループを抜ける
			if (!Arrays.asList(x).contains(new Integer(now))) {
				break;
			}
		}

		// 右方向に答えを探していく
		now = target.intValue();
		int plus = 0;
		while (x[0].intValue() <= now) {

			// １歩く
			plus++;

			// そこは？
			now = target.intValue() + plus;
			// System.out.println("ここは" + now);

			// 禁止リストにない数に到達したらwhileループを抜ける
			if (!Arrays.asList(x).contains(new Integer(now))) {
				break;
			}
		}

		// System.out.println(minus + " " + target + " " + plus);

		// 最も近いほうを出力
		if (minus <= plus) {
			System.out.println(target.intValue() - minus);
		} else {
			System.out.println(target.intValue() + plus);
		}

	}
}

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

int main(){
    int N, X;
    int m[1010];
    cin >> N >> X;
    for (int i=0; i < N; i++){
        cin >> m[i];
    }
    for (int i=0; i < N; i++){
        X -= m[i];
    }
    int min = *min_element(begin(m), m+N);
    int ans = X / min + N;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>

using namespace std;
int main()
{
    int n;
    bool FLG;
    
    while(1){
        cin >> n;
        if(n==0){
            break;
        }
        int a[201],b[201];
        int tcnt=n;
        int hcnt=n;
        for(int i=0;i<201;i++){
            a[i]=0;
            b[i]=1;
        }
        int x;
        for(int i=0;i<n;i++){
            cin >> x;
            a[x]=1;
            b[x]=0;
        }
        
        int max=0;
        int limit=2*n;
        while(tcnt>0&&hcnt>0){
            if(max==0){
                FLG=true;
                for(int j=1;j<=limit;j++){
                    if(a[j]==1){
                        a[j]=0;
                        max=j;
                        tcnt--;
                        break;
                    }
                }
                if(tcnt==0) break;
                for(int i= 1;i<=limit;i++){
                    if(max<i&&b[i]==1){
                        max=i;
                        b[i]=0;
                        hcnt--;
                        FLG=false;
                        break;
                    }
                }
                if(hcnt==0) break;
                if(FLG) max=0;
            }else{
                FLG=true;
                for(int i= 1; i<=limit;i++){
                        if(max < i && a[i] == 1){
                            a[i] = 0;
                            max = i;
                            FLG = false;
                            tcnt--;
                            break;
                        }
                    }

                    if(tcnt == 0)break;

                    if(FLG)max = 0;

                    FLG = true;
                    for(int i=1; i<=limit; i++){
                        if(max < i && b[i] == 1){
                            max = i;
                            b[i] = 0;
                            hcnt--;
                            FLG = false;
                            break;
                        }
                    }

                    if(hcnt == 0)break;

                    if(FLG)max = 0;

                }
            }
           
            
        if(tcnt == 0){
            cout << hcnt << endl;
            cout << "0" << endl;
        }else{
            cout << "0" << endl;
            cout << tcnt << endl;
        }

    }
    return 0;
}



Measured memory_bytes: 2992
#include <iostream>

using namespace std;

int main(void)
{
	int n, k, ans;

	cin >> n >> k;

	ans = 1;

	for (int i = 0; i < n; i++){
		if (ans < k) ans *= 2;
		else ans += k;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace contest_Csharp
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> xyz = Console.ReadLine().Split(' ').ToList().Select(x => int.Parse(x)).ToList();
            Console.WriteLine(xyz[2] + " " + xyz[0] + " " + xyz[1]);
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
//const int MAX=;

int N;
vector<double> v;

void input(){
	cin>>N;
	rep(i,N){
		double a;
		cin>>a;
		v.pb(a);
	}
	sort(all(v));
}

double ans;
void solve(){
	ans=v[0];
	rep1(i,N-1){
		ans=(ans+v[i])/2;
	}
  	cout<<fixed;
	cout<<setprecision(12)<<ans;
	
}

void output(){
  
}

int main(){
  input();
  solve();
  output();
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <ctype.h>
#include <stdlib.h>
#include <vector>
#include <math.h>
using namespace std;
int main()
{
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  long long n;
  cin>>n;
  int sum=(n*(n+1))/2;
  cout<<sum;

}




Measured memory_bytes: 256
import queue
N,M=map(int,input().split())
ans=[0] * N
q=queue.Queue()
q.put(1)

import sys
s = sys.stdin.readlines()
G=[[] for _ in range(N)]

for e in s:
  a, b = map(int, e.split())
  G[a-1].append(b)
  G[b-1].append(a)
  
c=0

while c!=N-1:
  r=q.get()
  for i in G[r-1]:
    if ans[i-1]==0 and i!=1:
      ans[i-1]=r
      q.put(i)
      c+=1

print("Yes")
for i in range(N-1):
  print(ans[i+1])

Measured memory_bytes: 48360
#include <stdio.h>
#include <math.h>
int main(){
	int N,A=-1,F,T=-1,X,Y;
	int D[2]={-1,-1},S[2];
	for(scanf("%d",&N);N--;){
		int f,a,t,x,y;
		scanf("%d%d%d%d%d",&f,&a,&t,&x,&y);
		if(t==T&&A!=a){
			int z=(X-x)*(X-x)+(Y-y)*(Y-y);
			if(D[t]<z)D[t]=z,S[t]=f-F;
			if(D[t]==z&&S[t]>f-F)S[t]=f-F;
		}
		/*if(t!=T||A!=a)*/F=f,A=a,T=t,X=x,Y=y;
	}
	for(N=0;N<2;N++){
		if(D[N]==-1)puts("-1 -1");
		else printf("%f %f\n",sqrt(D[N]),S[N]/60.0);
	}
	return 0;
}

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

int main() {
  int K, A, B;
  cin >> K >> A >> B;



  for (int i=A; i<=B; i++){
    if(i % K ==0){
      cout << "OK" << endl;
      break;
    }
    if(i==B){
      cout << "NG" <<endl;
    }
  }

}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define met(s) memset(s, 0, sizeof(s))
const int MOD = 100000007;
const int MAXN = 1000000;
const int inf = 0x3f3f3f3f;
int main()
{
	//freopen("data.txt","r",stdin);
	int n, a[100], b[100];
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	for (int i = 0; i < n; i++) scanf("%d", &b[i]);
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		if (a[i] > b[i]) ans += a[i] - b[i];
	}
	printf("%d\n", ans );
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<iomanip>
#include<map>
#include<cstring>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const ll LLINF = 1LL<<60;
/* -- template -- */

int main(){
    int N, K; cin >> N >> K;
    int A[N];rep(i, N)cin >> A[i];
    cout << (((N - 1) % (K - 1) == 0) ? (N - 1) / (K - 1) : 1 + (N - 1) / (K - 1)) << endl;
}


Measured memory_bytes: 640
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        StringBuilder debug = new StringBuilder();
        Scanner sc = new Scanner(System.in);
        int period = sc.nextInt();//D
        debug.append(period+"\n");

        int[] cost = new int[26];//c
        for (int i = 0;i<cost.length;++i)
        {
            cost[i] = sc.nextInt();
            debug.append(cost[i]+" ");
        }
        debug.append("\n");

        int[][] score = new int[period][26];//s
        for (int i = 0;i<score.length;++i)
        {
            for (int j = 0;j<score[i].length;++j)
            {
                score[i][j] = sc.nextInt();
                debug.append(score[i][j]+" ");
            }
            debug.append("\n");
        }

        //System.err.println(debug.toString());

        Map<Integer,Integer> lastDay = new HashMap<>();//contestType,lastDay
        for (int type = 0;type < 26;++type) lastDay.put(type,0);

        long satisfaction = 0L;
        for (int date = 0;date < period;++date)
        {
            //select
            long maxSatisfaction = Long.MIN_VALUE;
            int bestContestType = -1;
            long minus = 0L;
            for (int type = 0;type < 26;++type)
            {
                long tmp = satisfaction + score[date][type];
                long tmp2 = 0L;
                for (int type2 = 0;type2 < 26;++type2)
                {
                    tmp2 += cost[type2] * ((date+1) - lastDay.get(type2));
                }
                tmp -= tmp2;

                if (maxSatisfaction < tmp)
                {
                    maxSatisfaction = tmp;
                    bestContestType = type;
                    minus = tmp2;
                }
            }

            //calc
            satisfaction = maxSatisfaction;
            lastDay.put(bestContestType,(date+1));

            //output
            System.out.println(bestContestType+1);
        }
        System.err.println(satisfaction);
        sc.close();
    }
}

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

struct UF{
  vector<int> par, si;
  UF(int n){
    rep(i, n){
      par.push_back(i);
      si.push_back(1);
    }
  }
  int root(int x){
    if(par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  void unite(int x, int y){
    if(root(x) == root(y)) return;
    else if(root(x) > root(y)){
      si[root(y)] += si[root(x)];
      par[root(x)] = root(y);
      return;
    }
    else{
      si[root(x)] += si[root(y)];      
      par[root(y)] = root(x);
      return;
    }
  }
  bool same(int x, int y){
    return root(x) == root(y);
  }
  int size(int x){
    return si[root(x)];
  }
};

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  UF f(n);
  vector<vector<int>> b(n), g(n);
  rep(i, m){
    int a, c;
    cin >> a >> c;
    f.unite(a-1, c-1);
    g[a-1].push_back(c-1);
    g[c-1].push_back(a-1);
  }
  rep(i, k){
    int a, c;
    cin >> a >> c;
    b[a-1].push_back(c-1);
    b[c-1].push_back(a-1);
  }
  rep(i, n){
    int d = 0;
    rep(j, b[i].size()){
      if(f.same(b[i][j], i)) ++d;
    }
    cout << f.size(i) - g[i].size() - d - 1;
    if(i == n-1) cout << endl;
    else cout << " ";
  }
  return 0;
}

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

int main(){
  char s[3];

  cin >> s;

  for (int i = 0; i < 3; i++){
    if (s[i] == '7'){
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;

  return 0;
}


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

int main(){
int W,H, x,y,r;
cin>>W>>H>>x>>y>>r;
if(x-r>=0 && y-r>=0 && x+r<=W && y+r<=H){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
return 0;
}


Measured memory_bytes: 3120
fn solve(n: i32, m: i32) -> bool {
    n == m
}

fn main() {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    let mut iter = line.split_whitespace().map(|s| s.parse().unwrap());
    let n = iter.next().unwrap();
    let m = iter.next().unwrap();
    let res = solve(n, m);
    println!("{}", if res { "Yes" } else { "No"});
}


Measured memory_bytes: 4352
using System;
class p
{
  static void Main()
  {
    string[] input = Console.ReadLine().Split(' ');
    int a = int.Parse(input[0]);
    int b = int.Parse(input[1]);
    int c = int.Parse(input[2]);
    int d = int.Parse(input[3]);
    Console.WriteLine(((Math.Abs(a-b) <= d) && (Math.Abs(b-c) <= d)) || (Math.Abs(a-c) <= d) ? "Yes" : "No");
  }
}


Measured memory_bytes: 13140
#include<iostream>
#include<string>
using namespace std;
int main()
{
    long long i,j,total=0;
    string s;
    cin>>s;
    i=0;
    j=s.size()-1;
    while(i<j)
    {
        if(s[i]!=s[j])
        {
            total++;
        }
        i++;
        j--;
    }
    cout<<total<<endl;
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const vi d8x = {1, 0, -1, 0, 1, -1, -1, 1};
const vi d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vi d4x = {1, 0, -1, 0};
const vi d4y = {0, 1, 0, -1};

//----------------ここからだよ-------------------

int main(){
    char C; cin>>C;
    int div=(int)'B'-(int)'A';
    char ans=(char)((int)C+div);
    cout<<ans<<endl;
}

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

string getst(int num, char way) {
	string st = {
		'k'
		,'s'
		,'t'
		,'n'
		,'h'
		,'m'
		,'y'
		,'r'
		,'w'
	};
	string wayst="TLURD";
	string to="aiueo";
	int shi=to[wayst.find(way)];
	if (num == 1) {
		return string(1,shi);
	}
	else if (num == 0) {
		if (shi == 'u') {
			return "nn";
		}
		else {
			return st[8]+string(1,shi);
		}
	}
	else{
		
		return st[num-2]+string(1,shi);
	}
}

int main() {
	string st;cin>>st;
	for (int i = 0; i < st.size() / 2; ++i) {
		cout << getst(st[2*i]-'0',st[2*i+1]);
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 3204
#include<bits/stdc++.h>
     
    using namespace std;
    mt19937_64 rng(58);
     
    string to_string(string s) { return '"' + s + '"'; }
    string to_string(const char* s) { return to_string((string) s); }
    string to_string(bool b) { return (b ? "true" : "false"); }
    template <typename A, typename B>
    string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
    template <typename A>
    string to_string(A v) { bool first = true; string res = ""; for (const auto &x : v) { if (!first) res += ", "; first = false; res += to_string(x); } return "{" + res + "}"; }
    void debug_out() { cerr << endl; }
    template <typename Head, typename... Tail>
    void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); }
    #ifdef LOCAL
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
    #else
    #define debug(...) 42
    #endif
     
    int area(vector<vector<int>> &c, int h1, int w1, int h2, int w2) {
        h2--;
        w2--;
        return c[h1 + 1][w1 + 1] - c[h1 + 1][w2 + 1] - c[h2 + 1][w1 + 1] + c[h2 + 1][w2 + 1];
    };
     
     
    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL); cout.tie(NULL);
        int h, w, k;
        cin >> h >> w >> k;
        vector<string> s(h);
        for (int i = 0; i < h; i++) cin >> s[i];
     
        vector<vector<int>> c(h + 1, vector<int>(w + 1));
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                c[i + 1][j + 1] = (s[i][j] == '1') + c[i][j + 1] + c[i + 1][j] - c[i][j];
            }
        }
     
        long long ans = h + w + 1;
     
        for (int i = 0; i < (1 << (h - 1)); i++) {
            vector<int> rows;
            rows.push_back(0);
            for (int j = 0; j < h - 1; j++) if ((i >> j) & 1) rows.push_back(j+1);
            rows.push_back(h);
            long long cut = rows.size() - 2;
            debug(rows);
            int last = -1;
            // greedy
            bool possible = true;
            for (int x = 0; x < w; x++) {
                bool can = true;
                for (int j = 0; j < rows.size() - 1; j++) {
                    int a = area(c, rows[j + 1] - 1, x, rows[j], last + 1);
                    debug(rows[j + 1] - 1, x, rows[j], last + 1, a);
                    if (a > k) {
                        can = false;
                        break;
                    }
                }
                if (!can) {
                    if (x > last + 1) {
                        last = x - 1;
                        cut++;
                        debug(x, cut);
                    } else {
                        possible = false;
                        break;
                    }
                }
            }
            debug(possible, cut);
            if (possible)
                ans = min(cut, ans);
        }
        cout << ans << "\n";
    }

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

const double PI = 3.14159265358979323846;
//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<int, int> P;
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
const ll INF = 1e15;
//const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;
#define ret() return 0;

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;


int main() {
    ll n;
    cin >> n;
    vector<ll> numbers(n, 0);
    rep(i, n) cin >> numbers[i];

    ll ans = 0;
    for (ll i = 0; i < n; i++) {

        ll now = numbers[i] / 2;
        ans += now;


        if (i < n - 1) {
            ll f = min(numbers[i] % 2, numbers[i + 1]);

            ans += f;
            numbers[i + 1] -= f;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1152
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_11_C
#include <iostream>
#include <cstdio>
#include <queue> // 入れた順番に出していく玉突き構造。
using namespace std;

int G[110][110];
int n;
int u, k, v;

/* void print_matrix(int N) {
  for(int i=0; i<N; i++) {
    for(int j=0; j<N; j++) {
      printf("%d", G[i][j]);
      if (j < N-1) {
	printf(" ");
      }
    }
      printf("\n");
  }
} */

void make_matrix() {
  fill(&G[0][0], &G[0][0]+110*110, 0);
  scanf("%d", &n);
  for (int i=0; i<n; i++) {
    scanf("%d%d", &u, &k);
    u--;
    for (int j=0; j<k; j++) {
      scanf("%d", &v);
      v--;
      G[u][v] = 1;
    }
  }
}

int timer = 1; // timeだとエラーが出たので。
int d[110]; // 訪問時刻。ナマの数字を入れる。
int f[110]; // 終了時刻。ナマの数字を入れる。

void init() {
  fill(d, d+110, -1);
  fill(f, f+110, -1);
}

void dfs(int cur) { // curを訪問。
  d[cur] = timer;
  timer++;
  // cerr << "visiting " << cur << " at the time " << timer << endl;
  for (int i=1; i<=n; i++) { // 節点i
    if (G[cur-1][i-1] == 1 && d[i] == -1) {
      dfs(i);
    }
  }
  f[cur] = timer;
  timer++;
}

int main() {
  make_matrix();
  init();
  for (int i=1; i<=n; i++) {
    if (d[i] == -1) {
      dfs(i);
    }
  }
  for (int i=1; i<=n; i++) {
    printf("%d %d %d\n", i, d[i], f[i]);
  }
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>


int main(){
  ll W, H, x, y; cin >> W >> H >> x >> y;
  double area = 0.5*H*W;
  int ex;
  if (H%2==0 && W%2==0 && 2*x==W && 2*y==H) ex = 1;
  else ex = 0;

  cout << fixed << setprecision(10);
  cout << area << " " << ex << endl;



  // cout << fixed << setprecision(10);
  
  return 0;
}



Measured memory_bytes: 256