akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

int main() {
    long long int N;
    cin >> N;
    
    if(N>=0) {
        int dig=0;
        long long int pow=1;
        long long int sum_p=1;
        while(N>sum_p) {
            dig++;
            pow *= 4;
            sum_p += pow;
        }
        
        if(dig==0) {
            cout << N;
        } else {
            long long int s=sum_p-pow;
            long long int e=sum_p;
            long long int cur_range=pow;
            int counter=0;
            cout << 1;
            while(counter<2*dig) {
                pow /= 2;
                
                if(N<=s+pow) {
                    if(counter%2==0) {
                        cout << 1;
                    } else {
                        cout << 0;
                    }
                    e = e-pow;
                } else {
                    if(counter%2==0) {
                        cout << 0;
                    } else {
                        cout << 1;
                    }
                    s = s+pow;
                }
                
                counter++;
            }
        }
    } else {
        int dig=0;
        long long int pow=-2;
        long long int sum_p=-2;
        while(N<sum_p) {
            dig++;
            pow *= 4;
            sum_p += pow;
        }
        
        if(dig==0) {
            if(N==-1) {
                cout << 11;
            } else {
                cout << 10;
            }
        } else {
            long long int s=sum_p-pow;
            long long int e=sum_p;
            long long int cur_range=pow;
            int counter=0;
            cout << 1;
            while(counter<=2*dig) {
                pow /= 2;
                
                if(N>=e-pow) {
                    if(counter%2==0) {
                        cout << 1;
                    } else {
                        cout << 0;
                    }
                    e = e-pow;
                } else {
                    if(counter%2==0) {
                        cout << 0;
                    } else {
                        cout << 1;
                    }
                    s = s+pow;
                }
                
                counter++;
            }
        }

    }

    cout << endl;
    return 0;
    
}

Measured memory_bytes: 256
<?php
  while (true) {
    $a = trim(fgets(STDIN));
    if ($a == "0") { return; }
    $b = explode(" ", trim(fgets(STDIN)));
    $z = 0;
    foreach ($b as $val) {
      $z += pow(($val - array_sum($b) / $a), 2);
    }
    print(sqrt($z / $a) . "\n");
  }
?>

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

long long MOD = 1000000007;

int main() {
  long long n, a, b;
  long long temp_n;
  cin >> n >> a >> b;
  
  /* 2^n */
  long long res1 = 1;
  temp_n = n;
  long long N = 2;
  while(temp_n > 0) {
    if(temp_n & 1) {
      res1 = (res1 * N) % MOD;
    }
    N = (N * N) % MOD;
    temp_n >>= 1;
  }
  
  /* nCa */
  long long res2 = 1;
  
  long long A1 = 1 ;
  for(int i=1; i<=a; i++) {
    A1 = (A1 * i) % MOD;
  }
  
  temp_n = MOD-2;
  while(temp_n > 0) {
    if(temp_n & 1) {
      res2 = (res2 * A1) % MOD;
    }
    A1 = (A1 * A1) % MOD;
    temp_n >>= 1;
  }
  
  long long A2 = 1 ;
  for(int i=0; i<a; i++) {
    A2 = (A2 * (n-i)) % MOD;
  }
  
  res2 = (res2 * A2) % MOD;
  
  /* nCb */
  long long res3 = 1;

  long long B1 = 1;
  for(int i=1; i<=b; i++) {
    B1 = (B1 * i) % MOD;
  }
  
  temp_n = MOD-2;
  while(temp_n > 0) {
    if(temp_n & 1) {
      res3 = (res3 * B1) % MOD;
    }
    B1 = (B1 * B1) % MOD;
    temp_n >>= 1;
  }
  
  long long B2 = 1 ;
  for(int i=0; i<b; i++) {
    B2 = (B2 * (n-i)) % MOD;
  }
  
  res3 = (res3 * B2) % MOD;
  
  long long res4 = 1;
  
  long long res = (res1 - res2 - res3 - res4 + MOD*3) % MOD;
  cout << res << endl;
}

Measured memory_bytes: 256
L = int(input())
ans = []
for i in range(1,19):
    ans.append((i,i+1,0))
    ans.append((i,i+1,2**(i-1)))
cur = 0
flag = True
for i in range(20)[::-1]:
    if L >> i & 1:
        if flag:
            for _ in range(2):
                ans.append((i,20,cur))
                cur += 1 << (i-1)
        else:
            ans.append((i+1,20,cur))
            cur += 1 << i
    else:
        flag = False
print(20,len(ans))
for tpl in ans:
    print(*tpl)


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

namespace ConsoleApp2
{
    public class Program
    {
        static long mod = (long)Math.Pow(10, 9) + 7;

        public static void Main(string[] args)
        {
            long[] NK = Read(Console.ReadLine());
            long N = NK[0];
            long K = NK[1];
            string[] stringXs = Console.ReadLine().Split(' ');
            int[] Xs = new int[N];

            long distance = 0;
            long min = -1;

            for (int i = 0; i < N; i++)
            {
                Xs[i] = int.Parse(stringXs[i]);
                if (i < K)
                {
                    if(i!=0)distance += Xs[i]-Xs[i-1];
                }
            }

            min = distance + Math.Min(Math.Abs(Xs[0]), Math.Abs(Xs[K - 1]));

            for (int i = 1; i <= N-K; i++)
            {
                distance = distance - (Xs[i] - Xs[i - 1]) + (Xs[K + i - 1] - Xs[K + i - 2]);
                min = Math.Min(min,distance + Math.Min(Math.Abs(Xs[i]), Math.Abs(Xs[K + i - 1])));
            }


            Console.WriteLine(min);
            Console.ReadLine();
        }

        private static long[] Read(string input)
        {
            string[] strings = input.Split(' ');
            long num = strings.Length;
            long[] ints = new long[num];
            for (int i = 0; i < num; i++)
            {
                ints[i] = long.Parse(strings[i]);
            }

            
            return ints;
        }
    }
}


Measured memory_bytes: 21856
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int x, y;
  cin >> x >> y;
  int ans = 0;
  int base = 100000;
  ans += max(0, (4 - x) * base);
  ans += max(0, (4 - y) * base);
  if(x == y && x == 1) ans += 4 * base;
  cout << ans << endl; 
}


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

int main(){
  int A,B,C,X,Y; cin >> A >> B >> C >> X >> Y;
  //ABを2i枚→AをX-i枚、BをY-i枚
  int mincost=1e12;
  for(int i=0; i<=max(X,Y); i++){
    mincost=min(mincost,A*max(0,X-i)+B*max(0,Y-i)+C*2*i);
  }
  cout << mincost << endl;
}

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

int main() {
  ll a,b,c,k;
  cin >>a>>b>>c>>k;
  
  if(a>=k){
    cout <<k<<endl;
    return 0;
  }
  if(a+b>=k){
    cout <<a<<endl;
    return 0;
  }
  if(a+b<k){
    cout <<a-(k-a-b)<<endl;
    return 0;
  }
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;


int main(){
    int N;
    cin >> N;
    ll A,B;
    cin >> A >> B;
    ll X[100000];
    for(int i=0; i<N; i++){
        cin >> X[i];
    }
    
    ll ans = 0;
    for(int i=1; i<N; i++){
        if((X[i]-X[i-1])*A <= B){
            ans += (X[i]-X[i-1])*A;
        }else{
            ans+=B;
        }
    }
    cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<ll,int>;
ll n, x, d, e, f, ans;
int gcd(int a, int b){
    while(b){
        a %= b;
        swap(a,b);
    }
    return abs(a);
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> x >> d;
    if(!d) cout << (x ? n+1 : 1) << '\n';
    else if(!x) cout << n*(n-1)/2+1 << '\n';
    else{
        if(d < 0){
            d = -d;
            x = -x;
        }
        e = gcd(x,d);
        x /= e;
        d /= e;
        rep(i,d){
            ll c = 0, p2 = 0;
            vector<P> v;
            for(ll j=i; j<=n; j+=d){
                v.push_back({(2*n-1-j)*j/2+(j-i)/d*x+1,1});
                v.push_back({(j-1)*j/2+(j-i)/d*x,-1});
            }
            sort(v.begin(), v.end());
            for(P it: v){
                if(!c) p2 = it.first;
                c -= it.second;
                if(!c) ans += it.first - p2;
            }
        }
        cout << ans << '\n';
    }
}

Measured memory_bytes: 10476
/*************************************************************************
	> File Name: 1.cpp
	> Author: Knowledge_llz
	> Mail: 925538513@qq.com 
	> Blog: https://blog.csdn.net/Pig_cfbsl 
	> Created Time: 2020/5/30 20:16:42
 ************************************************************************/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define LL long long
using namespace std;
int read(){
	char x=getchar(); int u=0,fg=0;
	while(!isdigit(x)){ if(x=='-') fg=1; x=getchar(); }
	while(isdigit(x)){ u=(u<<3)+(u<<1)+(x^48); x=getchar(); }
	return fg?-u:u;
}
const int maxx=3e5+10;
LL a[maxx],node=0,sum=0,x=0;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.out", "w", stdout);
#endif
	int n=read();
	For(i,0,n){
		a[i]=read();
		x+=a[i];
	}
	if(!n){
		if(a[0]==1) cout<<1;
		else cout<<-1;
		return 0;
	}
	if(a[0]>=2){
		printf("-1");
		return 0;
	}
	else if(a[0]==1){
		sum=1;
		For(i,1,n)
			if(a[i]>0){
				sum=-1;
				break;
			}
		cout<<sum<<endl;
		return 0;
	}
	--x; node=1; sum=1;
	For(i,1,n){
		node-=a[i-1];
		if(node<=0){
			printf("-1");
			return 0;
		}
		if(x<node){
			node+=x;
			x=0;
		}
		else{
			x-=node;
			node+=node;
		}
//		cout<<node<<" "<<x<<endl;
		sum+=node;
	}
	if(node!=a[n] || x>0) cout<<-1<<endl;
	else cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 4404
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

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

  bool poor = false;

  if (a == b && a != c) {
    poor = true;
  }

  if (a == c && a != b) {
    poor = true;
  }

  if (b == c && b != a) {
    poor = true;
  }

  cout << (poor ? "Yes" : "No") << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    string s;
    cin >> s;
    int n = SZ(s);

    vector<vi> pos(26);
    REP(i, n) pos[s[i] - 'a'].pb(i);
    REP(i, 26) pos[i].pb(n);
    auto next = [&](int i, int x) {
        return *lower_bound(ALL(pos[x]), i);
    };

    vector<int> dp(n + 1);
    dp[n] = 1;
    REPR(i, n - 1) {
        int mn = INF;
        REP(j, 26) {
            int idx = next(i, j) + 1;
            if (idx > n) {
                chmin(mn, 0);
            } else {
                chmin(mn, dp[idx]);
            }
        }
        dp[i] = mn + 1;
    }
    
    string ans;
    int cur = 0;
    while (1) {
        int idx;
        int ch;
        REP(i, 26) {
            idx = next(cur, i) + 1;
            if (idx >= n || dp[cur] == dp[idx] + 1) {
                ch = i;
                break;
            }
        }
        ans += ch + 'a';
        cur = idx;
        if (cur >= n) break;
    }
    cout << ans << endl;
    return (0^_^0);
}



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

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define EACH(begin, end) for(auto itr = (begin); itr != (end); itr++)

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;



ll N = 0;
ll ret = 0;
ll first = -1, second = -2;
ll first_i = -1;

void input() {
  IN(N);
  ll tmp;
  REP(i, N) {
    IN(tmp);
    if (tmp >= first) {
      second = first;
      first = tmp;
      first_i = i;
    } else if (tmp >= second) {
      second = tmp;
    }
  }
}

void solve() {
  REP(i, N) {
    if (i == first_i) {
      PRINT(second);
    } else {
      PRINT(first);
    }
  }
}

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


Measured memory_bytes: 1664
N = int(input())
As = list(map(int, input().split()))
E = 10 ** 9 + 7

ans = 1
clr = [0, 0, 0]
for i in range(N):
    ans *= clr.count(As[i])
    ans %= E
    for c in range(3):
        if As[i] == clr[c]:
            clr[c] += 1
            break
print(ans % E)

Measured memory_bytes: 53036
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var table = new List<Tuple<int, int, int>>()
            {
                { new Tuple<int, int, int>(400, 599, 8) },
                { new Tuple<int, int, int>(600, 799, 7) },
                { new Tuple<int, int, int>(800, 999, 6) },
                { new Tuple<int, int, int>(1000, 1199, 5) },
                { new Tuple<int, int, int>(1200, 1399, 4) },
                { new Tuple<int, int, int>(1400, 1599, 3) },
                { new Tuple<int, int, int>(1600, 1799, 2) },
                { new Tuple<int, int, int>(1800, 1999, 1) },
            };

            var X = int.Parse(Console.ReadLine());
            int kyu = table.First(elem => elem.Item1 <= X && X <= elem.Item2).Item3;
            Console.WriteLine(kyu);
        }
    }
}


Measured memory_bytes: 28240
#!/usr/bin/python
B=999999937
P=1000000007

def gen_hash(s,hash):
	c=0
	for i in range(len(s)):
		c=(c*B+s[i])%P
		hash[i]=c

import sys
s=[ord(e) for e in sys.stdin.readline().strip()]
ls=len(s)
v=[0]*ls
hsh=[0]*10001
gen_hash(s,v)
q=[ord(e) for e in sys.stdin.readline().strip()]
lq=len(q)
gen_hash(q,hsh)
hash=hsh[lq-1]
Brev=pow(B,lq,P)
r=[]
for i in range(lq-1,ls):
	if v[i]==((v[i-lq] if i>=lq else 0)*Brev+hash)%P:
		r.append(i-lq+1)
for e in r:print(e)

Measured memory_bytes: 96064
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

char S[200005];

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


	fread(S, 1, 200005, stdin);
	int L = 0, R = 200005;
	while (L + 1 < R) {
		int M = (L + R) / 2;
		if (S[M] >= '0') L = M;
		else R = M;
	}

	int N = R;
	int a = 0;
	int A[2020] = {};
	A[0] = 1;

	ll kotae = 0;
	int tmp = 0;
	int are = 1;
	int shou = N / 5;
	int i = N - 1;
	int amari = N % 5;
	rep(j, shou) {
		tmp += (S[i--] - '0') * are;
		tmp %= 2019;
		kotae += A[tmp]++;
		are *= 10;

		tmp += (S[i--] - '0') * are;
		tmp %= 2019;
		kotae += A[tmp]++;
		are *= 10;

		tmp += (S[i--] - '0') * are;
		tmp %= 2019;
		kotae += A[tmp]++;
		are *= 10;

		tmp += (S[i--] - '0') * are;
		tmp %= 2019;
		kotae += A[tmp]++;
		are *= 10;

		tmp += (S[i--] - '0') * are;
		tmp %= 2019;
		kotae += A[tmp]++;
		are *= 10;
		are %= 2019;
	}
	rep(j, amari) {
		tmp += (S[i--] - '0') * are;
		tmp %= 2019;
		kotae += A[tmp]++;
		are *= 10;
	}

	printf("%lld\n", kotae);


	Would you please return 0;
}

Measured memory_bytes: 1752
from operator import itemgetter
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = [None, 2, 5, 5, 4, 5, 6, 3, 7, 6]
D = []
set_D = set()
A.sort(reverse=True)
for a in A:
    if B[a] in set_D:
        continue
    else:
        set_D.add(B[a])
        D.append([a, B[a]])

D.sort(key=itemgetter(0), reverse=True)
dp = [-10**10]*(N+1)
dp[0] = 0
for i in range(1, N+1):
    for elem in set_D:
        if i < elem or dp[i-elem] is None:
            continue
        dp[i] = max(dp[i], dp[i-elem]+1)
ans = ''
while N > 0:
    for i in range(len(D)):
        if N-D[i][1] < 0:
            continue
        if dp[N-D[i][1]] == dp[N]-1:
            ans += str(D[i][0])
            N -= D[i][1]
            break
print(ans)


Measured memory_bytes: 3420
import Control.Applicative
import Control.Monad
import Data.List
import qualified Data.Map as M
import qualified Data.Set as S
import Text.Printf

readInts :: IO [Int]
readInts = map read . words <$> getLine

data Card = S Int | H Int | C Int | D Int deriving (Read, Show, Eq, Ord)

main :: IO ()
main = do
  n <- readLn
  cs <- replicateM n readLn
  forM_ (solve cs) $ \c -> do
    print c

solve :: [Card] -> [Card]
solve = S.toList . (s S.\\) . S.fromList
 where
  s = S.fromList $ ($) <$> [S, H, C, D] <*> [1..13]



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

int main(void)
{
	int a, b, c; cin >> a >> b >> c;
	int K; cin >> K;
	int m = max(max(a, b), c);
	int ans = a + b + c + m * pow(2, K) - m;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 384
import java.io.*;
import java.util.*;
import java.math.*;

public class Main implements Runnable {
	private static BufferedReader in;
	private static PrintWriter out;
	private static StringTokenizer st;
	private static Random rnd;

	private void solve() throws IOException {
		String initialString = nextToken();
		char[] letters = initialString.toCharArray();
		long result = 1;
		int length = letters.length;
//		Set<String> different = new TreeSet<>();
//		List<String> simple = new ArrayList<>();
//		different.add(initialString);
//		simple.add(initialString);
		long[] count = new long[26];
		for (int i = 0; i < length; i++) {
//			for (int j = i; j < length; j++) {
//				char[] copy = letters.clone();
//				boolean ok = copy[i] != copy[j];
//				reverse(copy, i, j);
//				String newString = new String(copy);
//				if (!newString.equals(initialString)) {
//					out.println(i + " " + j + " " + newString + " " + different.contains(newString));
//					different.add(newString);
//					if (ok)
//						simple.add(newString);
//				}
//			}
			int k = letters[i] - 'a';
			for (int j = 0; j < count.length; j++) {
				if (j != k) {
					result += count[j];
				}
			}
			count[k] += 1;
		}
//		out.println(different.size());
//		out.println(simple.size());
		out.println(result);
	}

	private void reverse(char[] copy, int i, int j) {
		while (i < j) {
			char t = copy[i];
			copy[i] = copy[j];
			copy[j] = t;
			++i;
			--j;
		}
	}

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

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);

			rnd = new Random();

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	private String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String line = in.readLine();

			if (line == null)
				return null;

			st = new StringTokenizer(line);
		}

		return st.nextToken();
	}

	private int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	private long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	private double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 27732
#include <bits/stdc++.h>
using namespace std;
int num[1000005];
int main(){
	int d, n;
	scanf("%d%d", &d, &n);
	int k = 1;
	for(int i=1;i<=100000000;i++){
		int x = i;
		int cnt = 0;
		while(x){
			if(x%100 == 0){
				cnt++;
				x/=100;
			}
			else break;
		}
		if(cnt == d) num[k++] = i;
		if(k > 100) break;
	}
	printf("%d\n", num[n]);
}

Measured memory_bytes: 256
n=int(input())
S=[[s for s in input().split()] for i in range(n)]
X=[float(s[0]) for s in S]
count =0
for i in range(n):
    if S[i][1]=="JPY":
        count+=float(S[i][0])
    else:
        count+=float(S[i][0])*380000.0
print(count)


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

template <class Abel>
class UnionFind{
    vector<int> par_, weight_;
public:
    UnionFind(size_t n){
        par_.assign(n, -1);
        weight_.assign(n, 0);
    }

    int root(int x){
        if (par_[x] < 0) {
            return x;
        }else{
            int res = root(par_[x]);
            weight_[x] += weight_[par_[x]];
            return par_[x] = res;
        }
    }

    int weight(int x){
        root(x);
        return weight_[x];
    }

    int weight(int x, int y){
        return weight(y) - weight(x);
    }

    int size(int x){
        return -par_[root(x)];
    }

    bool IsSame(int x, int y){
        return root(x) == root(y);
    }

    void Merge(int x, int y, Abel w){
        w += weight(x);
        w -= weight(y);
        x = root(x);
        y = root(y);
        if (IsSame(x, y))
            return;
        if (size(x) < size(y)) {
            w = -w;
            swap(x, y);
        }
        par_[x] += par_[y];
        par_[y] = x;
        weight_[y] = w;
    }
};

int main(){
    int n, m;
    cin >> n >> m;
    UnionFind<int> uf(n);
    for (int i = 0; i < m; i++) {
        int l, r, d;
        cin >> l >> r >> d;
        l--;
        r--;
        if (uf.IsSame(l, r) && uf.weight(l, r) != d){
            cout << "No" << endl;
            return 0;
        }
        uf.Merge(l, r, d);
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(),i,j,tmp,m,min=0,max=0,keta=1;
		int a[]=new int[8]; 
		String str;
		char ch[]=new char[8];
		while(n--!=0){
			max=0;min=0;
			str=sc.next();
			ch=str.toCharArray();
			for(i=0;i<8;i++){
				a[i]=ch[i]-'0';
			}
			for(i=0;i<8;i++){
				m=i;
				for(j=i;j<8;j++){
					if(a[j]<a[m]) m=j;
				}
				tmp=a[m];
				a[m]=a[i];
				a[i]=tmp;
			}//
			keta=1;
			for(i=0;i<8;i++){
				max+=a[i]*keta;
				keta*=10;
			}
			keta=1;
			for(i=7;i>=0;i--){
				min+=a[i]*keta;
				keta*=10;
			}
			System.out.println(max-min);
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
using namespace std;

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

int main() {
  int n;
  cin >> n;
  double a[1000];
  rep(i, 0, n) cin >> a[i];
  sort(a, a + n);
  double s1 = (a[n - 3] + a[n - 4]) / (a[n - 1] - a[n - 2]);
  double s2 = (a[n - 1] + a[n - 4]) / (a[n - 2] - a[n - 3]);
  double m = 1145141919;
  rep(i, 0, n - 2) m = min(m, a[i + 1] - a[i]);
  cout << fixed << max((a[n - 1] + a[n - 2]) / m, max(s1, s2)) << endl;
}

Measured memory_bytes: 3296
a1, a2, a3 = map(int, input().split())
c1 = abs(a1 - a2) + abs(a2 - a3)
c2 = abs(a1 - a3) + abs(a3 - a2)
c3 = abs(a2 - a1) + abs(a1 - a3)
c4 = abs(a2 - a3) + abs(a3 - a1)
c5 = abs(a3 - a1) + abs(a1 - a2)
c6 = abs(a3 - a2) + abs(a2 - a1)
print(min([c1, c2, c3, c4, c5, c6]))

Measured memory_bytes: 3064
a, b, c, d = list(map(int, input().split()))

tak_hp = a
aok_hp = c

while tak_hp > 0 and aok_hp > 0:
    aok_hp = aok_hp - b
    if not aok_hp > 0:
        print('Yes')
    else:
        tak_hp = tak_hp - d
        if not tak_hp > 0:
            print('No')


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

int main() {
	int n, W;
	cin>>n>>W;
	long long int w[n], v[n];
	for(int i = 0; i < n; i++){
		cin>>w[i]>>v[i];
	}
	long long int dp[n+1][W+1];
	for(int i = 0; i <= n ; i++){
		dp[i][0] = 0;
	}
	for(int i = 0; i <= W ; i++){
		dp[0][i] = 0;
	}
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= W; j++){
			if(w[i-1] > j){
				dp[i][j] = dp[i-1][j];
			}
			else{
				dp[i][j] = max(dp[i-1][j], v[i-1] + dp[i-1][j-w[i-1]]);
			}
		}
	}
	cout<<dp[n][W]<<endl;
}

Measured memory_bytes: 79104
def ACBC_089_C():
    _num = int(input())
    _namelist = []
    _countM = 0
    _countA = 0
    _countR = 0
    _countC = 0
    _countH = 0

    for i in range(0, _num):
        _name = str(input())
        _namelist.append(_name)
        if _name[0] == "M":
            _countM += 1
        elif _name[0] == "A":
            _countA += 1
        elif _name[0] == "R":
            _countR += 1
        elif _name[0] == "C":
            _countC += 1
        elif _name[0] == "H":
            _countH += 1
    print(_countM * _countA * _countR + \
          _countM * _countA * _countC + \
          _countM * _countA * _countH + \
          _countM * _countR * _countC + \
          _countM * _countR * _countH + \
          _countM * _countC * _countH + \
          _countA * _countR * _countC + \
          _countA * _countR * _countH + \
          _countA * _countC * _countH + \
          _countR * _countC * _countH)


ACBC_089_C()


Measured memory_bytes: 10028
package main

import (
	"bufio"
	"fmt"
	"golang.org/x/tools/container/intsets"
	"math"
	"os"
	"reflect"
	"sort"
	"strconv"
)

const (
	maxBufSize = 1024 * 1024
)

type point struct {
	idx int
	x int64
	y int64
}

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, 1)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	out = bufio.NewWriter(os.Stdout)
)

func solve(n int64, m int64, as []point, cs []point) []int {
	sort.Slice(cs, func(i int, j int) bool {
		return cs[i].x < cs[j].x
	})

	ret := make([]int, n)
	for i, a := range(as) {
		l := int64(math.MaxInt64)
		idx := intsets.MaxInt
		for _, c := range(cs) {
			lx := c.x - a.x
			if lx > l {
				break
			}
			if lx < 0 {
				lx = -lx
			}
			ly := a.y - c.y
			if ly < 0 {
				ly = -ly
			}
			ll := lx + ly
			if ll > l {
				continue
			}
			if ll == l && idx < c.idx {
				continue
			}
			idx = c.idx
			l = ll
		}
		ret[i] = idx
	}
	return ret
}

func main() {
	defer out.Flush()

	n := nextInt()
	m := nextInt()
	as := make([]point, n)
	for i, _ := range(as) {
		as[i].x = nextInt()
		as[i].y = nextInt()
	}
	cs := make([]point, m)
	for i, _ := range(cs) {
		cs[i].idx = i + 1
		cs[i].x = nextInt()
		cs[i].y = nextInt()
	}
	res := solve(n, m, as, cs)
	for _, r := range(res) {
		fmt.Fprintln(out, r)
	}
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextStringAsBytes() []byte {
	sc.Scan()
	return []byte(sc.Text())
}

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int64) []int64 {
	ret := make([]int64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


Measured memory_bytes: 1748
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<random>
#include<map>
#include<queue>
using namespace std;


int main(){

  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++) cin >> a[i];
  int cnt = 0;
  for(int i=0; i<n; i++){
    if( a[i] % 2 == 1 ) cnt++;
  }
  cout << (cnt % 2 == 0 ? "YES" : "NO" ) << endl;

  return 0;
}








// EOF


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n,m,ed;
vector<int> v[60];
PII con[30];
ll num[30];
map<PII, int> mp;
int lca[60][30],dep[60];
ll res;
void dfs(int x,int par)
{
	lca[x][0]=par;
	dep[x]=(par==-1 ? 0 : dep[par]+1);
	for (int i=0;i<v[x].size();i++)
	{
		int xi=v[x][i];
		if (xi!=par) dfs(xi,x);
	}
}
int pari(int x,int y)
{
	for (int i=0;i<=20;i++) if (y & (1<<i)) x=lca[x][i];
	return x;
}
int lcai(int x,int y)
{
	if (dep[x]<dep[y]) swap(x,y);
	x=pari(x,dep[x]-dep[y]);
	int l=0,r=n,mid;
	while (l<r)
	{
		mid=(l+r)>>1;
		if (pari(x,mid)==pari(y,mid)) r=mid;
		else l=mid+1;
	}
	return pari(x,l);
}
int main()
{
	cin >>n,ed=n-1;
	for (int i=0;i<ed;i++)
	{
		int x,y;
		cin >>x>>y;
		x--,y--;
		v[x].push_back(y);
		v[y].push_back(x);
		mp[MP(x,y)]=mp[MP(y,x)]=i;
	}
	cin >>m;
	for (int i=0;i<m;i++)
	{
		cin >>con[i].Fst>>con[i].Snd;
		con[i].Fst--,con[i].Snd--;
	}
	dfs(0,-1);
	for (int i=1;i<=20;i++)
		for (int j=0;j<n;j++)
			lca[j][i]=(lca[j][i-1]==-1 ? -1 : lca[lca[j][i-1]][i-1]);
	for (int i=0;i<m;i++)
	{
		int x=con[i].Fst,y=con[i].Snd,z=lcai(x,y);
		while (x!=z)
		{
			num[i]|=(1ll<<mp[MP(x,lca[x][0])]);
			x=lca[x][0];
		}
		while (y!=z)
		{
			num[i]|=(1ll<<mp[MP(y,lca[y][0])]);
			y=lca[y][0];
		}
		//cout <<i<<" "<<num[i]<<" ##\n";
	}
	for (int i=1;i<(1<<m);i++)
	{
		ll t=0;
		for (int j=0;j<m;j++) if (i & (1<<j)) t|=num[j];
		int ti=__builtin_popcountll(t),it=__builtin_popcount(i);
		if (it%2) res+=(1ll<<(ed-ti));
		else res-=(1ll<<(ed-ti));
		//cout <<i<<" "<<ti<<" "<<res<<" ##\n"; 
	}
	res=(1ll<<ed)-res;
	cout <<res;
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scanf("%s", s)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(s) printf("%s\n", s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<char> vc;
typedef vector<vc> vcc;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim)
{
    uniform_int_distribution<int> uid(0, lim - 1);
    return uid(rang);
}

int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

void solve()
{
    ll i, j, n, m;
    string s = "";
    string ans = "";
    cin >> s;
    fo(i, s.size())
    {
        if (s[i] == '0')
        {
            ans.push_back('0');
        }
        else if (s[i] == '1')
        {
            ans.push_back('1');
        }
        else if (s[i] == 'B')
        {
            if (ans.size() != 0)
            {
                ans.pop_back();
            }
        }
    }
    cout << ans << endl;
}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }

    return 0;
}

int mpow(int base, int exp)
{
    base %= mod;
    int result = 1;
    while (exp > 0)
    {
        if (exp & 1)
            result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

void ipgraph(int n, int m)
{
    int i, u, v;
    while (m--)
    {
        cin >> u >> v;
        u--, v--;
        g[u].pb(v);
        g[v].pb(u);
    }
}

void dfs(int u, int par)
{
    for (int v : g[u])
    {
        if (v == par)
            continue;
        dfs(v, u);
    }
}


Measured memory_bytes: 10644
package main

import "fmt"

func main() {
	var a, v, b, w, t int
	fmt.Scanf("%d", &a)
	fmt.Scanf("%d", &v)
	fmt.Scanf("%d", &b)
	fmt.Scanf("%d", &w)
	fmt.Scanf("%d", &t)

	if v < w {
		fmt.Println("NO")
	} else {
		if a < b {
			oni := a + (v * t)
			escape := b + (w * t)

			if oni >= escape {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		} else {
			oni := a - (v * t)
			escape := b - (w * t)

			if oni <= escape {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
	}
}


Measured memory_bytes: 1816
#include <cstdio>
#include <cmath>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(val) cout << "!!!" << #val << ": " << val << endl
#define mod 1000000007
using namespace std;
typedef long long int LL;
typedef unsigned long long int ULL;

int main() {
    int D;
    LL G;
    cin >> D >> G;

    vector<LL> p(D), c(D);

    rep(i, D) {
        cin >> p[i] >> c[i];
    }

    LL res = 1 << 29;
    rep(bit, 1<<D) {
        LL sum = 0;
        LL num = 0;
        // 全完する問題の得点を合計
        rep(i, D) {
            if (bit & (1 << i)) {
                sum += c[i] + p[i] * 100 * (i + 1);
                num += p[i];
            }
        }
        if (sum >= G) {
            res = min(res, num);
        } else {
            for (int i = D - 1; i >= 0; i--) {
                if (bit & (1 << i)) continue;

                rep(j, p[i]) {
                    if (sum >= G) break;
                    sum += 100 * (i + 1);
                    num++;
                }
            }
            res = min(res, num);
        }
    }

    cout << res << endl;
    return 0;

}


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

#define cin(x) cin >> x;
#define cout(x) cout << x << endl;

using namespace std;

int main(int argc, char const *argv[])
{
    int a, b;
    cin(a); cin(b);
    
    if ((a*b) % 2 == 0) {
        cout("Even");
    } 
    else
    {
        cout("Odd");
    }
    return 0;
}


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

int s[100005];


int main(){
	int n,m,tmp;
	long long f[100006];
	cin>>n>>m;
	for(int i=1;i<=m;++i){
		cin>>tmp;
		s[tmp]=1;
	}
	f[1]=1;f[0]=1;
	if(s[1]==1)	f[1]=0;
	for(int i=2;i<=n;++i){
		if(s[i]==1)	f[i]=0;
		else		f[i]=(f[i-1]+f[i-2])%1000000007;
	}
	cout<<f[n];
}

Measured memory_bytes: 1408
#include<stdio.h>
#define NIL -1
int parent[100001],left[100001],right[100001];
int depth(int);
void printchildren(int);
int main(){
    int i,j;
    scanf("%d",&j);
    for(i=0;i<=j-1;i++)
    parent[i]=left[i]=right[i]=NIL;
    for(i=0;i<=j-1;i++){
        int a,b;
        scanf("%d %d",&a,&b);
        int c[b+1],j;
        for(j=1;j<=b;j++)scanf("%d",&c[j]);
        if(b>=1){
            parent[c[1]]=a;
            left[a]=c[1];
        }
        for(j=2;j<=b;j++){
            parent[c[j]]=a;
            right[c[j-1]]=c[j];
        }
    }
    
    
    for(i=0;i<=j-1;i++){
        printf("node %d: parent = %d, depth = %d, ",i,parent[i],depth(i));
        if(parent[i]==NIL) 
        printf("root, [");
        else if(left[i]==NIL)
         printf("leaf, [");
        else
         printf("internal node, [");
        printchildren(i);
        printf("]\n");
        
    }
    
    return 0;
}
int depth(int A){
    int B=0;
    while(parent[A]!=NIL){
        B++;
        A=parent[A];
    }
    return B;
}
void printchildren(int A){
    int c=left[A];
    while(c!=NIL && right[c]!=NIL){
        printf("%d, ",c);
        c=right[c];
    }
    if(left[A]!=NIL)printf("%d",c);
}



Measured memory_bytes: 3296
using System;
using System.IO;
using System.Linq;

namespace AizuOnline
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var x = int.Parse(Console.ReadLine());
            var buildingNo = new int[x];
            var floorNo = new int[x];
            var roomNo = new int[x];
            var roomID = new int[x];

            for (int i = 0; i < x; i++)
            {
                var a = Console.ReadLine().Split(' ');
                buildingNo[i] = int.Parse(a[0]);
                floorNo[i] = int.Parse(a[1]);
                roomNo[i] = int.Parse(a[2]);
                roomID[i] = int.Parse(a[3]);
            }

            for (int j = 0; j < 4; j++)
            {
                for (int m = 0; m < 3; m++)
                {
                    for (int k = 0; k < 10; k++)
                    {
                        var v = 0;
                        for (int p = 0; p < x; p++)
                        {
                            if (buildingNo[p] == j + 1 && floorNo[p] == m + 1 && roomNo[p] == k + 1)
                            {
                                v += roomID[p];
                            }
                        }
                        Console.Write(" " + v);
                    }
                    Console.WriteLine();
                }
                if (j != 3)
                {
                    Console.WriteLine("####################");
                }
            }
            Console.ReadLine();
        }
    }
}

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

using namespace std;

/*
 * 2 ** 39 < 10 ** 12 < 2 ** 40
 */

long long rec(long long n)
{
  if (n == 1) return 1;

  return rec(n / 2) * 2 + 1;
}

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

  /*
  int k_min = 0;
  for (int k = 0; k < 41; k++)
  {
    if (pow(2, k) > h)
    {
      k_min = k;
      break;
    }
  }

  vector<long long> s(k_min + 1, 1);
  for (int k = 0; k < k_min; k++)
  {
    s[k + 1] = 2 * s[k] + 1;
  }

  cout << s[k_min - 1] << endl;
  */

  cout << rec(h) << endl;

}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var scanner *bufio.Scanner

func printIt() {
	sentence := readAllString()
	ans := make([]int, 26)
	for _, ch := range []byte(sentence) {
		if ch >= 'a' && ch <= 'z' {
			ans[int(ch-'a')]++
		} else if ch >= 'A' && ch <= 'Z' {
			ans[int(ch-'A')]++
		}
	}
	for i := 0; i < 26; i++ {
		fmt.Printf("%c : %d\n", 'a'+byte(i), ans[i])
	}
}

func readAllString() string {
	var ans string
	for scanner.Scan() {
		ans += scanner.Text()
	}
	return ans
}

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanLines)
	printIt()
}



Measured memory_bytes: 1104
#!/usr/bin/ruby
#encoding: utf-8

#input
n = gets.to_i
p = gets.split.map(&:to_i)
ans = 0

(0..n-3).each do |i|
  if ((p[i] < p[i+1]) and (p[i+1] < p[i+2])) or ((p[i] > p[i+1]) and (p[i+1] > p[i+2]))
    ans += 1
  end
end

puts ans

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


int N, M, K;
vector<vector<int>> like;
vector<int> C, D;
vector<int> visit;
vector<set<int>> tree;


void input() {
    cin >> N >> M >> K;
    like = vector<vector<int>>(N);
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        like[a].push_back(b);
        like[b].push_back(a);
    }
    C = D = vector<int>(K);
    rep(i, K) {
        cin >> C[i] >> D[i];
        C[i]--;
        D[i]--;
    }
}


void make_graph(int num, set<int> &s, int x) {
    visit[x] = num;
    s.insert(x);
    for (int y : like[x]) {
        if (visit[y] != -1) continue;
        make_graph(num, s, y);
    }
}


int main() {
    input();
    visit = vector<int>(N, -1);
    vector<int> ans(N, 0);
    rep(i, N) {
        if (visit[i] != -1) continue;
        set<int> s;
        make_graph(tree.size(), s, i);
        tree.push_back(s);
        for (int x : s) {
            ans[x] = s.size() - like[x].size() - 1;
        }
    }
    rep(i, K) {
        if (tree[visit[C[i]]].count(D[i])) {
            ans[C[i]]--;
            ans[D[i]]--;
        }
    }
    rep(i, N) cout << ans[i] << " ";
    cout << endl;
}


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

typedef long long ll;

int main(){
  ll n;
  cin >> n;
  ll a[n];
  for(int i=0;i<n;i++) cin >> a[i];
  ll sum[n];
  sum[0]=a[0];
  for(int i=1;i<n;i++){
    sum[i]=sum[i-1]+a[i];
  }
  ll ans=0;
  ll count=0;
  ll now=sum[0];
  sort(sum,sum+n);
  for(int i=0;i<n;i++){
    if(now==sum[i]){
      count++;
    }
    else{
      if(now==0){
        ans+=(count*count+count)/2;
      }
      else{
        ans+=(count*count-count)/2;
      }
      now=sum[i];
      count=1;
    }
  }  
  if(now==0){
    ans+=(count*count+count)/2;
  }
  else{
    ans+=(count*count-count)/2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int n, k;
    cin >> n >> k;
    int mi = INF;
    for (int i = 0; i <= n; i++) {
        int tmp = 1;
        for (int j = 0; j < i; j++) tmp *= 2;
        for (int j = 0; j < n - i; j++) tmp += k;
        mi = min(mi, tmp);
    }
    cout << mi << '\n';
}


Measured memory_bytes: 3628
/*input
8 6
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int main()
{
	IOS;
	int a,b;
	cin>>a>>b;
	if(a+b==15) cout<<'+';
	else if(a*b==15) cout<<'*';
	else cout<<'x';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<Edge>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,w,h) rep(j,h)rep(i,w)
#define rrep(i,m, n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> a(n);rep(i,n)std::cin >> a[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<int>(n,a)));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
typedef unsigned int uint;
int main(){
  int n;
  std::cin >> n;
  std::vector<string> s(n);
  rep(i,n)std::cin >> s[i];
  bool han=1;
  rep(i,n-1){
    if(s[i][s[i].size()-1]!=s[i+1][0])han=0;
  }
  sort(all(s));
  rep(i,n-1)if(s[i]==s[i+1])han=0;
  if(han)std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;
  
}


Measured memory_bytes: 256