akhauriyash/Code-Regression huggingface dataset:
// stdin
macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

// input
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut 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
    };

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

// Test
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

#[allow(dead_code)]
fn gcd(x: i64, y: i64) -> i64 {
    if y == 0 {
        return x;
    }
    gcd(y, x % y)
}

#[test]
fn test_primes() {
    assert_eq!(primes(1), vec![1]);
    assert_eq!(primes(140), vec![1, 2, 2, 5, 7])
}

#[allow(dead_code)]
fn primes(num: i64) -> Vec<i64> {
    let mut ans = vec![1];
    let mut cur = num;
    for i in 2.. {
        if i * i > num { break; }
        if cur % i == 0 {
            while cur % i == 0 {
                ans.push(i);
                cur /= i;
            }
        }
    }
    if cur > 1 {
        ans.push(cur);
    }
    return ans;
}


test! {
r"1 1
" => r"1000000",

r"3 101
" => r"100000",

r"4 4
" => r"0"
}

fn solve(src: &str) -> String {
    input! {
        source=src,
        x:i32,
        y:i32,
//        a:[i32;n],
    }
    fn calc(num: i32) -> i32 {
        let ret = if num == 1 { 300000 } else if num == 2 { 200000 } else if num == 3 { 100000 } else { 0 };
        ret
    }

    let mut ans = calc(x) + calc(y);
    if x == 1 && y == 1 {
        ans += 400000;
    }
    format!("{}", ans)
}


fn main() {
    println!("{}", solve(&stdin!()));
}



Measured memory_bytes: 4476
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

int main()
{
    int L;
    cin >> L;
    double p = (1.0 * L) / 3.0;
    //double q = L % 3;
    double v = static_cast<double>(p* p * p);
    printf("%.9lf\n", v);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define per(i, n, s) for (int i = (n-1); i >= (int)(s); i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll LINF = LLONG_MAX;
const int INF = INT_MAX;
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; }

int main(){
    ll d,g; cin>>d>>g;
    g/=100;
    vector<ll> p(d);
    vector<ll> c(d);
    rep(i,0,d){
        ll x,y; cin>>x>>y;
        y/=100;
        p[i]=x; c[i]=y;
    }
    vector<vector<ll>> dp(d+1,vector<ll> (430000,INF));
    dp[0][0]=0;
    rep(i,0,d){
        rep(pnt,0,210000){
            rep(k,0,p[i]){
                chmin(dp[i+1][pnt+(i+1)*k],dp[i][pnt]+k);
            }
            chmin(dp[i+1][pnt+(i+1)*p[i]+c[i]],dp[i][pnt]+p[i]);
        }
    }
    ll ans=INF;
    rep(i,g,430000){
        chmin(ans,dp[d][i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 40576
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        Integer[] a = new Integer[n];
        Integer[] b = new Integer[n];
        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(sc.next());
            b[i] = Integer.parseInt(sc.next());
        }
        Integer[] c = new Integer[m];
        Integer[] d = new Integer[m];
        for (int i = 0; i < m; i++) {
            c[i] = Integer.parseInt(sc.next());
            d[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        // 主処理
        String[] index = new String[n];
        for (int i = 0; i < n; i++) {
            List<Integer> list = new ArrayList<>();
            for (int j = 0; j < m; j++) {
                int dist = Math.abs(a[i] - c[j]) + Math.abs(b[i] - d[j]);
                list.add(dist);
            }
            int min = list.stream().mapToInt(k -> k).min().getAsInt();
            index[i] = Integer.toString(list.indexOf(min) + 1);
        }

        String result = String.join("\n", index);

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 26964
# -- coding: utf-8 --

# "Hello World!" display

for num in 1..3 do
	b = gets
	a = b.split()
	time = (a[3].to_i - a[0].to_i) * 3600
	time += (a[4].to_i - a[1].to_i) * 60
	time += (a[5].to_i - a[2].to_i)
	h_per = time/3600
	time -= h_per*3600
	m_per = time/60
	time -= m_per*60
	print(h_per.to_s + ' ' + m_per.to_s + ' ' + time.to_s + "\n")
end

Measured memory_bytes: 6108
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int n;
    cin>>n;
    int sum = 0;
    forn(i,n){
        int x;
        cin>>x;
        sum += x;
    }
    cout<<sum-n<<endl;
    return 0;
}



Measured memory_bytes: 3592
"""
F
"""
K,Q=map(int,input().split())

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

que=[list(map(int,input().split())) for i in range(Q)]

for n,x,mod in que:
    
    x%=mod
    d=[]
    if D[0]%mod==0:
        d.append(mod)
    else:
        d.append(D[0]%mod)
        
    for i in range(1,K):
        if D[i]%mod==0:
            d.append(d[-1]+mod)
        else:
            d.append(d[-1]+D[i]%mod)

    s=d[-1]
    num=x+s*((n-2)//K)+d[(n-2)%K]
    print(n-1-num//mod)

Measured memory_bytes: 57944
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
 
#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
using namespace std;
using ll=long long;
constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main() {
  int N;
  cin >> N;
  int ans=0;
  
  for(int i=0;i<=25;i++){
    for(int j=0;j<=i;j++){
      if(N==j*4+(i-j)*7){
        ans=1;
      }
    }

  }
if(ans==0){
  cout << "No" << endl;
}else{
  cout << "Yes" << endl;
}

  return 0;
}

Measured memory_bytes: 256
a, b, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = min(A)+min(B)
for i in range(m):
  x, y, c = map(int, input().split())
  ans = min(ans, A[x-1]+B[y-1]-c)
print(ans)

Measured memory_bytes: 18740
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> a;
    for(int i=0; i<N; i++)
    { 
       int b;
       cin >> b;
       a.push_back(b);
    }
    int m = *min_element(a.begin(),a.end());
    int M = *max_element(a.begin(),a.end());
    cout << M-m << endl;
	return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N,A;
    cin >> N >> A;
    ll ans=N;
    ll eat=0,now=1;
    while(now<N){
        now*=2;
        eat++;
    }
    FOR(i,1,eat+1){
        ll now=i*A;
        ll ng=1,ok=1000001;
        while(abs(ok-ng)>1){
            ll mid=(ok+ng)/2;
            if((ld)(i+1)*log10(mid)<17){
                if((ll)pow(mid,i+1)<N){
                    ng=mid;
                }
                else{
                    ok=mid;
                }
            }
            else{
                ok=mid;
            }
        }
        ll MX=ok;
        ok=0,ng=i+1;
        while(abs(ok-ng)>1){
            ll mid=(ok+ng)/2;
            if(pow(MX,i+1-mid)*pow(MX-1,mid)>=N){
                ok=mid;
            }
            else{
                ng=mid;
            }
        }
        now-=ok;
        now+=(i+1)*MX;
        chmin(ans,now);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4196
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
	int n = Integer.parseInt(sc.next());
    int k = Integer.parseInt(sc.next());
    int q = Integer.parseInt(sc.next());
    int p[] = new int[n];
    int qi = 0;
    
    for (int i=0; i<n; i++) {
      p[i] = k-q;
    }
    
    for (int i=0; i<q; i++) {
      qi = Integer.parseInt(sc.next());
      p[qi-1]++;
    }

    for (int i=0; i<n; i++) {
      if (p[i]>0) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
    
  }
}


Measured memory_bytes: 65420
using System;
using System.Linq;

public class Program
{
    static void Main()
    {
        string[] input = Console.ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int m = int.Parse(input[1]);
        int c = int.Parse(input[2]);
        int[] b = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        int ans = 0;
        int[] a;
        for(int i = 0;i<n;i++)
        {
            int sum = 0;
            a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            for(int j = 0;j<m;j++)
            {
                sum += b[j] * a[j];
            }
            if (sum + c > 0)
                ans++;
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13140
#include"iostream"
#include"cmath"
#include"vector"
#include"algorithm"
#include"list"
#include"set"
#include"unordered_set"
#include"map"
#include"unordered_map"
#include"string"
#include"cstring"
#include"iomanip"
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin>>n;
    int c1=0,c2=0;
    set<int>my;
    while(n--)
    {
        int x;cin>>x;
        my.insert(x/400);
        if(x>=3200)
            ++c2;
    }
    for(int i=0;i<=7;++i)
    {
        if(my.find(i)!=my.end())
            c1++;
    }
    if(c1==0)
    {
            cout<<1<<' '<<c2<<'\n';
    }
    else cout<<c1<<' '<<c1+c2<<'\n';

}







Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	double T, X;
	cin >> T >> X;

	cout.precision(10);
	cout << T / X << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int N;
    cin>>N;
    int answer=0;
    for(int i=1;i<N+1;i++){
        if(i%2==0)continue;
        int sum=0;
           for(int j=1;j<i+1;j++){
                   if(i%j==0)sum++;
                       if(sum==8)answer++;
                       
           }
    }
    cout<<answer<<endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
x = [0] * n
x[0] = sum(a) - 2 * sum(a[1::2])

for i in range(1, n):
    x[i] = 2 * a[i-1] - x[i-1]

for a in x:
    print(a, end=' ')


Measured memory_bytes: 14028
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

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

int dp[500000][55];
int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);

    int N;
    cin >> N;
    vector<int> A(N), B(N);
    REP(i, N) { cin >> A.at(i); }
    REP(i, N) { cin >> B.at(i); }

    // 初期化
    REP(bit, 1 << N) {
        REP(i, 55) { dp[bit][i] = INF; }
    }
    dp[0][0] = 0;

    REP(bit, 1 << N) {
        int S_size = 0;
        REP(i, N) {
            int mask = 1 << i;
            if (bit & mask) {
                S_size++;
            }
        }

        vector<pair<int, int>> invS; // first:もともと何番目か、second:カードの現在地
        int now = S_size;
        REP(i, N) {
            int mask = 1 << i;
            if ((bit & mask) == 0) {
                invS.emplace_back(i, now);
                now++;
            }
        }
        // cout << "bit:" << bit << endl;
        REP(last, 51) {
            for (auto v : invS) {
                int i = v.first;
                int now = v.second;
                int i_val;
                if (abs(i - S_size) % 2 == 0) {
                    i_val = A[i];
                } else {
                    i_val = B[i];
                }
                if (i_val >= last) {
                    chmin(dp[bit | (1 << i)][i_val], dp[bit][last] + abs(now - S_size));
                }
            }
        }
    }

    int ans = INF;
    REP(i, 55) { chmin(ans, dp[(1 << N) - 1][i]); }

    if (ans == INF) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 57728
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;
 
signed main()
{
    tezz
    
    int n, x, t;
    cin>>n>>x>>t;
 
    cout<<(int)ceil((double)n/x) * t;
} 

Measured memory_bytes: 3608
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, a, n) for (int i = (a); i < (int)(n); i++)
#define repc(i, a, n) for (int i = (a); i <= (int)(n); i++)
#define all(t) t.begin(), t.end()
#define rall(t) t.rbegin(), t.rend()
#define mat(type, row, col, init)                                              \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
#define DBG(str) cerr << (str) << endl;
int ketawa(int n) {
  int cnt = 0;
  while (n > 0) {
    cnt += n % 10;
    n /= 10;
  }
  return cnt;
}
int main() {
  int n;
  cin >> n;
  cout << (n % 10 == 0 ? 10 : ketawa(n));
  return 0;
}


Measured memory_bytes: 256
N = int(input())
C = [0]
S = [0]
F = [0]
for i in range(N - 1):
    c, s, f = map(int, input().split())
    C.append(c)
    S.append(s)
    F.append(f)

for i in range(1, N):
    t = 0
    for j in range(i, N):
        if j == i:
            t += S[j]
        if t >= S[j]:
            if t % F[j] != 0:
                t += F[j] - (t % F[j])
            t += C[j]
        else:
            t = S[j] + C[j]
    print(t)
print(0)


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main()
{
	int count;
	cin >> count;

	rep(i, count)
	{
		cout << "ACL";
	}
}

Measured memory_bytes: 3576
N = int(input())
S = list(input())

def output(lst):
    map_lst = map(str, lst[:-1])
    s = ''.join(map_lst)
    print (s.replace('0', 'S').replace('1', 'W'))
    return

# 0: 羊、1: 狼
for a in range(2):
    for b in range(2):
        lst = [-1] * (N + 1)
        lst[0] = a
        lst[1] = b
        for i in range(1, N):
            if S[i] == 'o':
                flag = True
            else:
                flag = False

            if flag == (lst[i] == 0):
                lst[i + 1] = lst[i - 1]
            else:
                lst[i + 1] = 1 - lst[i - 1]
        if lst[0] == lst[-1]: #最初の仮定が成り立っているかどうか
            if (S[0] == 'o') == (lst[0] == 0):
                if lst[1] == lst[N - 1]:
                    output(lst)
                    exit()
            else:
                if lst[1] != lst[N - 1]:
                    output(lst)
                    exit()

        # print (lst)

print (-1)

Measured memory_bytes: 12036
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define MODANOTHER 998244353
#define PI acos(-1)

using namespace std;

int main(void)
{
	//変数の宣言
	int a,b,c;

	//よく使う変数
	int i,j,k,l;
	int flag=0;
	ll int ans=0;
	int count=0;
	int temp=0;
	int temp1=0;
	int temp2=0;
	int max=0;
	int min=INFINT;
	int len=0;
	int sum=0;
	int ok=0;
	int ng=0;



	//データの読み込み


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

/*	for(i=0;i<n;i++){
		scanf("%d",&b[i]);
//		scanf_s("%d",&b[i]);
	}*/

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理


	//	printf("計算部分終了\n");

	//出力
	if(a==b&&b==c){
		printf("Yes");
	}else{
		printf("No");
	}


	//	printf("結果の出力終了\n");

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
#define REP(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for(ll (i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); (i)++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define _GLIBCXX_DEBUG

template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<1000000007>;

const double PI = 3.14159265358979323846;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

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

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

int main()
{	
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    REP(i, n) cin >> v[i];
    sort(ALL(v));
    int ans = 0;
    REP(i, k) ans += v[i];
    cout << ans << endl;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int H,W,X; cin>>H>>W>>X;
  vii dp(H+1,vi(W));
  dp[0][0]++;
  REP(i,1,H){
    rep(j,0,(1ll<<W-1)){
      bitset<8> B(j);
      vi A(W);
      rep(k,0,W) A[k]=k;
      rep(k,0,W-1){
        if(B.test(k))
          swap(A[k],A[k+1]);
      }
      bool flag=1;
      rep(k,1,W-1){
        if(B.test(k)&&B.test(k-1)){
          flag=0;
          break;
        }
      }
      if(flag){
        rep(k,0,W){
          dp[i][A[k]]+=dp[i-1][k];
          dp[i][A[k]]%=MOD;
        }
      }
    }
  }
  cout<<dp[H][X-1]<<endl;
  }


Measured memory_bytes: 256
// بسم الله الرحمان الرحیم //
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int N = 2e5 + 100;
#define pb push_back;
#define faster ios::sync_with_stdio(false), cin.tie(0);

int main()
{
    faster
    int n; cin >> n;
    string s;
    int cntac = 0 , cntwa = 0 , cntre = 0 , cnttl = 0;
    for (int i = 0; i < n; i ++)
    {
        cin >> s;
        if (s == "AC")
            cntac ++;
        if (s == "WA")
            cntwa ++;
        if (s == "TLE")
            cnttl ++;
        if (s == "RE")
            cntre ++;
    }
    cout << "AC x " << cntac << endl;
    cout << "WA x " << cntwa << endl;
    cout << "TLE x " << cnttl << endl;
    cout << "RE x " << cntre;
}





Measured memory_bytes: 3608
#!/usr/bin/env python3
#!/usr/bin/env pypy3

from math import *

def main():
    import sys
    sys.dont_write_bytecode = True
    sys.setrecursionlimit(10000000)

    input = sys.stdin.readline

    #import numpy as np
    #import scipy as sp

    # Python 3 modules: https://docs.python.org/3/library/

    import os
    import math, itertools, operator
    from math import factorial as fact
    from operator import itemgetter, attrgetter
    from itertools import permutations, combinations
    from functools import reduce, lru_cache
    # Use scipy for stats: https://docs.scipy.org/doc/scipy/reference/stats.html
    # Before Python 3.5.  Import from math after it.
    from fractions import gcd
    from fractions import Fraction as Frac

    inf = float('inf')
    pow = __builtins__.pow

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

    def perm(a, b):
        import scipy.special
        return scipy.special.perm(a, b, exact = True)

    def comb(a, b):
        import scipy.special
        return scipy.special.comb(a, b, exact = True)

    def dfact(n):
        import scipy.special
        return scipy.special.factorial2(n, exact = True)

    def prod(l):
        return reduce(operator.mul, l)

    def input_ints(func = input, sep = None, conv = int):
        return list(map(conv, func().split(sep = sep)))

    if os.environ.get('GOROOT') is None:
        def dprint(*args, **kwargs):
            kwargs['file'] = sys.stderr
            import inspect
            frame = inspect.currentframe().f_back
            print('[' + os.path.basename(frame.f_code.co_filename)
                    + ':' + str(frame.f_lineno) + ']', *args, **kwargs)
    else:
        def dprint(*args, **kwargs):
            pass


    ############################################################################


    N, = list(map(int, input().split()))
    c = 0
    if N > 9:
        c += 9 - 1 + 1
        if N > 999:
            c += 999 - 100 + 1
            if N > 99999:
                c += 99999 - 10000 + 1
            else:
                if N < 10000:
                    pass
                else:
                    c += N - 10000 + 1
        else:
            if N < 100:
                pass
            else:
                c += N - 100 + 1
    else:
        c += N
    print(c)


if __name__ == '__main__':
    main()


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

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

Measured memory_bytes: 1160
import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class Main {


	
	public static void main(String[] args)throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		
		StringTokenizer st1 = new StringTokenizer(br.readLine());
		
		int a = Integer.parseInt(st1.nextToken());
		int b = Integer.parseInt(st1.nextToken());
		
		
		out.println((int)Math.ceil((1.0*(b-1))/(a-1)));
		
		
		out.flush();
		out.close();
	}
	
	
	


}


Measured memory_bytes: 21204
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

o = s()
e = s()

ans = ""
for i in range( len(o)+len(e) ):
	if i%2 == 0:
		ans += o[i//2]
	else:
		ans += e[i//2]
print(ans)

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

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t = 1;
    while(t--){
        ll x,y;
        cin>>x>>y; char c; cin>>c; int d; cin>>d;
        y*=100; y+=d;
        cout<< x * y / 100 ;
    }
    return 0;
}


Measured memory_bytes: 3652
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;

#define NUM 1005

int N;
int H,W;
int table[NUM][NUM];

int main(void){
	
	H=NUM-1;
	W=NUM-1;
	
	for(int row=0;row<=H;row++){
		for(int col=0;col<=W;col++){
			table[row][col]=0;
		}
	}
	
	cin>>N;
	
	int x1,y1,x2,y2;
	
	for(int loop=0;loop<N;loop++){
		cin>>x1>>y1>>x2>>y2;
		table[y1][x1]++;
		table[y1][x2]--;
		table[y2][x1]--;
		table[y2][x2]++;
	}
	
	int ans=0;
	
	//左→右に足す
	for(int row=0;row<H;row++){
		for(int col=1;col<W;col++){
			table[row][col]+=table[row][col-1];
		}
	}
	
	//上→下に足す
	for(int col=0;col<W;col++){
		for(int row=1;row<H;row++){
			table[row][col]+=table[row-1][col];
		}
	}
	
	for(int row=0;row<H;row++){
		for(int col=0;col<W;col++){
			ans=max(ans,table[row][col]);
		}
	}
	
	cout<<ans<<endl;
	
	return 0;
}


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

using namespace std;

#define F first
#define S second
#define modulo ll (1e9 + 7)

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

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 50, M = 500, OO = 0x3f3f3f3f;
const ll llOO = 0x3f3f3f3f3f3f3f3f;


int main(){
    init();

    ll n, m;    cin >> n >> m;

    ll ans = min(n, m / 2);

    m -= 2 * ans;

    ans += m / 4;

    cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s,t;
  cin>>s>>t;
  bool ok = true;
  for(int i=0;ok && i<(int)s.size();i++)
  {
    if(s[i] != t[i])
      ok = false;
  }
  cout<<(ok?"Yes":"No");
  return 0;
}

Measured memory_bytes: 3532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll n;
  scanf("%lld", &n);
  vector<ll> l(n);
  REP(i, n) { scanf("%lld", &l[i]); }
  ll ans = 0;
  sort(ALL(l));
  REP(i, n - 2) FOR(j, i + 1, n - 1) FOR(k, j + 1, n) {
    if (l[i] + l[j] > l[k]) ans++;
  }
  printf("%lld\n", ans);
}

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod (ll)(1e9 +7);

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef string ss;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}

ll digsum(ll n){
    ll sum = 0;
    while(n > 0){
        sum += n % 10;
        n /= 10;
    }

    return sum;
}

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

    double ans = 0;
    rep(i,n)ans += 1 / a[i];
    ans = 1 / ans; 

    printf("%.10f\n",ans);
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int A[1];
int size=1;
int m=2;
#define N 101
#define mod 1000000007
#define f(i,n) for(int i=0;i<n;i++)


int main()
{
    fast;

    char c;
    cin>>c;
    int a=(int)c;
    a++;
    cout<<(char)a;



}

Measured memory_bytes: 3616
def main():
    n = int(input())
    ranges = []
    ans = 0
    for i in range(n):
        l, r = map(int, input().split())
        ranges.append((l, r))
        ans = max(ans, r - l + 1)
    min_ri = (10 ** 9 + 1, -1)
    max_li = (-1, -1)
    for i, (l, r) in enumerate(ranges):
        min_ri = min(min_ri, (r, i))
        max_li = max(max_li, (l, i))
    ri = min_ri[1]
    li = max_li[1]
    subranges = [ranges[i] for i in range(n) if i != ri and i != li]
    for r in subranges:
        ans = max(ans, min_ri[0] - max_li[0] + r[1] - r[0] + 2)
    if ri != li:
        lens = []
        for l, r in subranges:
            lens.append((max(0, r - max_li[0] + 1), max(0, min_ri[0] - l + 1)))
        lens.sort(key=lambda t: (t[0], -t[1]))
        m = len(subranges)
        fs = [ranges[li][1] - ranges[li][0] + 1] * (m + 1)
        ss = [ranges[ri][1] - ranges[ri][0] + 1] * (m + 1)
        for i in range(m):
            ss[i + 1] = min(ss[i], lens[i][1])
        for i in range(m, 0, -1):
            fs[i - 1] = min(fs[i], lens[i - 1][0])
        for i in range(m + 1):
            ans = max(ans, fs[i] + ss[i])
    print(ans)


if __name__ == '__main__':
    main()

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

vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vector<string> maze;
int h, w;

int solve(int sx, int sy) {
  if (maze[sx][sy] == '#') return -1;
  vector<vector<int>> d(h, vector<int>(w, -INF));
  queue<pair<int, int>> que;
  que.push(make_pair(sx, sy));
  d[sx][sy] = 0;
  while (que.size()) {
    auto p = que.front();
    que.pop();
    for (int i = 0; i < 4; i++) {
      int nx = p.first + dx[i];
      int ny = p.second + dy[i];
      if (0 <= nx && nx < h && 0 <= ny && ny < w && maze[nx][ny] != '#' &&
          d[nx][ny] == -INF) {
        que.push(make_pair(nx, ny));
        d[nx][ny] = d[p.first][p.second] + 1;
      }
    }
  }
  int maxi = -INF;
  for (int i = 0; i < h; i++) {
    maxi = max(maxi, *max_element(all(d[i])));
  }
  return maxi;
}

int main() {
  cin >> h >> w;
  maze.resize(h);
  for (int i = 0; i < h; i++) {
    cin >> maze[i];
  }
  int ans = -INF;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      ans = max(ans, solve(i, j));
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin>>N;
    string S; cin >> S;
    stack<char> st;
    st.push('x');
    REP(i,N)
    {
        if(S[i] == '(')
        {
            st.push('(');
        }
        else
        {
            if(st.top() == '(') st.pop();
            else st.push(')');
        }
    }
    int topcnt = 0;
    int tailcnt = 0;
    while(st.top() != 'x')
    {
        if(st.top() == ')')
        {
            st.pop();
            topcnt++;
        }
        else
        {
            st.pop();
            tailcnt++;
        }

    }
    string topstr(topcnt,'(');
    string tailstr(tailcnt,')');
    cout << topstr<<S<<tailstr<<endl;


}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int N;
	while(scanf("%d",&N)==1 && N>0) {
		int hatonosu=0;
		int can=0;
		int i;
		for(i=0;i<N;i++) {
			int k;
			scanf("%d",&k);
			if(k>=1)hatonosu++;
			if(k>=2)can=1;
		}
		if(can)printf("%d\n",hatonosu+1); else puts("NA");
	}
	return 0;
}

Measured memory_bytes: 612
# Aizu Problem 0025: Hit and Blow
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def hit_and_blow(A, B):
    hit, blow = 0, 0
    for k in range(4):
        if A[k] == B[k]:
            hit += 1
        elif A[k] in B:
            blow += 1
    return hit, blow


while True:
    try:
        A = [int(_) for _ in input().split()]
    except EOFError:
        break
    B = [int(_) for _ in input().split()]
    hit, blow = hit_and_blow(A, B)
    print(hit, blow)

Measured memory_bytes: 7672
using System;
using System.Linq;
using System.Text;

class Program
{
    static void Main()
    {
        StringBuilder ans = new StringBuilder();
        byte[] l = Console.ReadLine().Split(' ').Select(byte.Parse).ToArray();
        int c = l[1];
        int[] cans = new int[c + 1];
        
        for (byte i = 0; i < l[0]; i++)
        {
            byte[] o = Console.ReadLine().Split(' ').Select(byte.Parse).ToArray();
            int a = 0;

            for (byte j = 0; j < c; j++)
            {
                cans[j] += o[j];
                a +=  o[j];
                ans.Append(o[j] + " ");
            }

            cans[c] += a;
            ans.Append(a + "\r\n");
        }
        for (byte i = 0; i < c; i++)
        {
            ans.Append(cans[i] + " ");
        }
        ans.Append(cans[c] + "\r\n");

        Console.Write(ans);
    }
}

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

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

  vector<long long> A(N);
  long long even4 = 0;
  long long even2 = 0;
  long long odd = 0;
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
    if(A.at(i) % 4 == 0) even4++;
    else if (A.at(i) % 2 == 0) even2++;
    else odd++;
  }

  if (even4 + 1 >= odd && even2 == 0)
    cout << "Yes" << endl;
  else if (even4 >= odd && even2 >= 1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 1024
void main() {
    int n = readln.chomp.to!int;
    string s = readln.chomp;
    auto g = s.group.array;
    string bra, ket;
    foreach (i; 0 .. n) {
        bra ~= '(';
        ket ~= ')';
    }
    int l, r;
    foreach (x; g) {
        if (x[0] == '(') {
            r += x[1].to!int;
        } else {
            int tmp = x[1].to!int;
            if (r - tmp >= 0) {
                r -= tmp;
            } else {
                l += tmp - r;
                r = 0;
            }
        }
    }
    writeln(bra[0..l], s, ket[0..r]);
}


import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
int a[1000000];

int main()
{
	scanf("%d" , &n);
	for(int i = 0; i < 2 * n; i++)
		scanf("%d" , &a[i]);
	sort(a , a + 2 * n);
	int ans = 0;
	for(int i = 0; i < 2 * n; i += 2)
		ans += a[i];
	cout << ans;
}



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

    class Program
    {
        static void Main(string[] args)
        {
            var A = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
            Array.Sort(A);
            Console.WriteLine(A[0]*A[1]*(A[2]-A[2]/2)-(A[0] * A[1] * (A[2] / 2)));

        }
    }

Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define fail return (cout << -1 << endl), 0
#define ll long long

using namespace std;

int n;
map<ll, int> f;
ll dis[100010], rdis[100010];
int sz[100010];

struct Edge {
	int to, next;
}es[200010];
int first[100010], te = 0;

void addE(int a, int b)
{
	te++;
	es[te].to = b;
	es[te].next = first[a];
	first[a] = te; 
}

void dfs(int p, int fa)
{
	if (p != 1) rdis[p] = rdis[fa] + 1;
	for (int e = first[p]; e; e = es[e].next)
	{
		int to = es[e].to;
		if (to == fa) continue;
		dfs(to, p); 
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> dis[i];
		f[dis[i]] = i;
		sz[i] = 1;
	}
	int cnt = 0;
	for (map<ll, int>::reverse_iterator it = f.rbegin(); it != f.rend(); it++)
	{
		int v = it->second, u = f[it->first + 2 * sz[v] - n];
		if (!u || u == v) fail;
		addE(u, v); addE(v, u);
		sz[u] += sz[v];
		if (++cnt == n - 1) break;
	}
	dfs(1, 0);
	ll sum = 0;
	for (int i = 1; i <= n; i++)
		sum += rdis[i];
	if (sum != dis[1]) fail;
	for (int i = 1; i <= n; i++)
		for (int e = first[i]; e; e = es[e].next)
		{
			if (e & 1) continue;
			cout << i << ' ' << es[e].to << endl;
		}
	return 0;
}


Measured memory_bytes: 14592
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
    };

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

fn main() {
    input! { n:usize, x:[usize;n], m:usize, a:[usize;m] }
    let mut x = x;
    for i in 0..m {
        let j = a[i] - 1;
        if x[j] != 2019 && !x.contains(&(x[j] + 1)) {
            x[j] += 1;
        }
    }
    for i in 0..n {
        println!("{}", x[i]);
    }
}



Measured memory_bytes: 5032
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main()
{
  int n, k;
  cin >> n >> k;

  double res = 0;
  if (n >= k) {
	res += ((double)(n - k + 1)) / n;
  }

  for (int i = 1; i <= n; i++) {
	if (i >= k) {
	  break;
	}
	double tmp = 1.0 / n;
	/* brute force */
	int j = i;
	int aaa = 0;
	while (j < k) {
	   j = j << 1;
	   aaa++;
	}
	tmp *= pow(0.5, aaa);
	res += tmp;
  }

  cout << fixed << setprecision(10) << res << endl;
  return 0;
}


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

using namespace std;

using ll = long long;

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

    string s;
    cin >> s;
    if (s.size() == 3) reverse(s.begin(), s.end());
    cout << s << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

unsigned euclidean_gcd(unsigned a, unsigned b) {
	if (a < b) euclidean_gcd(b, a);
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}

signed main() {
	int n, x;
	cin >> n >> x;
	vector<int> X(n);
	for (int i = 0; i < n; i++) {
		cin >> X[i];
	}
	if (n == 1) {
		cout << max(x, X[0]) - min(x, X[0]) << endl;
		return 0;
	}
	X.push_back(x);
	sort(X.begin(), X.end(), greater<int>());
	vector<int> dat;
	for (int i = 0; i < X.size() - 1; i++) {
		int cmp = X[i] - X[i + 1];
		dat.push_back(cmp);
	}
	int ans = euclidean_gcd(dat[0], dat[1]);
	for (int i = 2; i < dat.size(); i++) {
		ans = euclidean_gcd(ans, dat[i]);
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 2800
n=int(input())
v=list(map(int,input().split()))
zero=dict()
one=dict()
for i in range(0,n,2):
    try:
        zero[v[i]]+=1
    except:
        zero[v[i]]=1
for i in range(1,n,2):
    try:
        one[v[i]]+=1
    except:
        one[v[i]]=1
x=list(zero.items())
y=list(one.items())
x.sort(reverse=True,key=lambda x:x[1])
y.sort(reverse=True,key=lambda x:x[1])
x+=[[10**6,0]]
y+=[[10**6,0]]
px=0
py=0
if x[0][0]!=y[0][0]:
    pass
elif x[1][1]+y[0][1]>x[0][1]+y[1][1]:
    px=1
else:
    py=1
print(n-x[px][1]-y[py][1])

Measured memory_bytes: 26652
#include<stdio.h>

int main()
{
  char nums[4];
  scanf("%s", nums);
  
  char firstPlace;
  int i = 0;
  while(nums[i] != '\0') {
    firstPlace = nums[i];
    i++;
  }
  
  switch (firstPlace) {
    case '0':
    case '1':
    case '6':
    case '8':
      puts("pon\n");
      break;
    case '2':
    case '4':
    case '5':
    case '7':
    case '9':
      puts("hon\n");
      break;
    case '3':
      puts("bon\n");
      break;
  }
  
  return 0;
}

Measured memory_bytes: 1620
N = int(input())

data = []
for i in range(N):
  S, P = input().split()
  P = int(P)
  data.append((i+1, S, P))
  
data_sorted = sorted(data, key=lambda x: (x[1], -x[2]))

for d in data_sorted:
  print(d[0])

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
string s[10000];
signed main(){
	int n,a=0,b=0,c=0;
	cin>>n;
	bool bo=true;
	f(i,n){
		cin>>s[i];
		f(j,s[i].size()){
			if(j==0&&s[i][j]=='B')b++;
			if(j==s[i].size()-1&&s[i][j]=='A')a++;
			if(j&&s[i][j]=='B'&&s[i][j-1]=='A')c++;
		}
		if((s[i][0]=='B')!=(s[i][s[i].size()-1]=='A')){
			bo=false;
		}
	}
	if(bo){
		a=max((int)(0),a-1),b=max((int)(0),b);
	}
	cout<<max((int)(0),min(a,b)+c)<<endl;
	return 0;
}


Measured memory_bytes: 768