akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;


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

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();

        int a = scanner.nextInt();
        HashSet<Integer> hs = new HashSet<Integer>();
        hs.add(a);

        int tmp=a;
        int size=hs.size();

        for(int i=0;true;i++) {
        	if(tmp%2==0) {
        		tmp/=2;
        	}else {
        		tmp=tmp*3+1;
        	}
        	hs.add(tmp);

        	if(size==hs.size()) {
        		System.out.println(i+2);
        		break;
        	}else {
        		size=hs.size();
        	}
        }

    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
#define rep(k,i,n) for(long long i=k;i<n;++i)
using namespace std;
typedef long long ll;
int main(void){
    int N,c;
    cin>>N;
    string line="ABCDEFGHIJKLMNOPQRSTUVWXYZ",S;
    cin>>S;
    rep(0,i,S.length()){
        c=line.find(S.substr(i,1))+N;
        if(25<c)c-=26;
        cout<<line.substr(c,1);
    }
    cout<<endl;
}


Measured memory_bytes: 256
import Data.List

solve :: Int -> Int -> [Int] -> Int
solve a b c
 | notElem (b - a) c = b - a
 | notElem (b + a) c = b + a
 | otherwise = solve (a + 1) b c

main = do
 [x,n] <- map read . words <$> getLine :: IO [Int]
 print =<< if (n/=0) then (solve 0 x) . map read . words <$> getLine else return x

Measured memory_bytes: 4164
# -*- coding: utf-8 -*-

##
## A - Frog1
## https://atcoder.jp/contests/dp/tasks/dp_a
##

import sys

def solve(N, nums):
    assert N > 0
    if N == 1:
        return 0
    cost_2 = 0
    cost_1 = abs(nums[1] - nums[0])
    for i in range(2, N):
        c1 = cost_1 + abs(nums[i] - nums[i-1])
        c2 = cost_2 + abs(nums[i] - nums[i-2])
        cost_i = min(c1, c2)
        cost_2 = cost_1
        cost_1 = cost_i
    return cost_1

def load(input):
    line = input.readline()
    N = int(line.strip())
    buf = []; add = buf.append
    size = 2**16
    s = input.read(size)
    while s:
        add(s)
        s = input.read(size)
    return N, "".join(buf)

def main():
    N, string = load(sys.stdin)
    nums = [ int(x) for x in string.split() ]
    result = solve(N, nums)
    print(result)

main()


Measured memory_bytes: 14196
#define ALGORITHM   0
#define CLIMITS     0
#define CMATH       0
#define DEQUE       0
#define LIST        0
#define MAP         0
#define QUEUE       1
#define SET         0

#define DP          0
#define DIRECTIONS  0

#define _GLIBCXX_DEBUG
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#if ALGORITHM
#include <algorithm>
#endif
#if CLIMITS
#include <climits>
#endif
#if CMATH
#include <cmath>
#endif
#if DEQUE
#include <deque>
#endif
#if LIST
#include <list>
#endif
#if MAP
#include <map>
#endif
#if QUEUE
#include <queue>
#endif
#if SET
#include <set>
#endif

#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;

#define endl '\n'
#define pb push_back
#define pf push_front
#define mp make_pair

const long double PI = 3.1415926535897932384626433832795028841971L;
const long long INF9 = 1000000001;
const long long INF18 = (long long)1e18 + 1;
const long long MOD = 1000000007;

#if DP
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 (a>b) { a = b; return 1; } return 0; }
#endif

#if DIRECTIONS
vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#endif
//
//
//
//
//
//
//
//
//

vector<int> to[100005];

/*メイン関数*/

int main() {
FASTIO;
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        a--, b--;

        to[a].pb(b);
        to[b].pb(a);
    }

    queue<int> q;
    vector<int> dist(n, INF9);
    vector<int> pre(n, -1);

    dist[0] = 0;
    q.push(0);

    while(!q.empty()){
        int v = q.front();
        q.pop();

        for(int u : to[v]){
            if(dist[u] != INF9) continue;
            dist[u] = dist[v] + 1;
            pre[u] = v;
            q.push(u);
        }
    }

    cout << "Yes" << endl;
    for(int i = 0; i < n; i++){
        if(i == 0) continue;
        int ans = pre[i];
        ans++;
        cout << ans << endl;
    }

return 0;
}

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

const int mod=1e9+7;
const int maxn=1e5+10;

int dp[maxn][13];

int main()
{
    string s;
    cin>>s;
    dp[0][0]=1;
    for(int i=0;i<s.size();i++)
    {
        for(int j=0;j<13;j++)
        {
            if(s[i]=='?')
                for(int k=0;k<10;k++)
                  (dp[i+1][((j*10)+k)%13]+=dp[i][j])%=mod;
            else
                (dp[i+1][(j*10+s[i]-'0')%13]+=dp[i][j])%=mod;
        }
    }
    cout<<dp[s.size()][5]<<endl;
    return 0;
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
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; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    int N, K;
    cin >> N >> K;
    vector<LL> v(N);
    rep(i, N) cin >> v[i];
    vector<LL> w = v;
    reverse(all(w));

    LL ans = 0;
    rep(k, min(K, N)+1){
        rep(a, k+1){
            int b = k-a;
            LL tmp = 0;
            vector<LL> minus;
            rep(i, a){
                tmp += v[i];
                if(v[i] < 0) minus.push_back(v[i]);
            }
            rep(i, b){
                tmp += w[i];
                if(w[i] < 0) minus.push_back(w[i]);
            }
            sort(all(minus));
            tmp -= accumulate(minus.begin(), minus.begin()+min((int)minus.size(), K-k), 0LL);
            // cout << a << " " << b << " " << tmp << endl;
            chmax(ans, tmp);
        }
    }
    cout << ans << endl;

}

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

typedef pair<int, int> P;
typedef vector< pair<int, int> >::iterator I;

int n, m;

int main(){
    while( cin >> n, n ){
        int i,j;
        vector< P > c(n);
        for(i=0;i<n;i++){
            cin >> c[i].first >> c[i].second;
        }
        sort(c.begin(), c.end());
        for(i=1;i<n;i++){
            c[i].first -= c[0].first;
            c[i].second -= c[0].second;
        }
        P origin = c[0];
        c[0] = P(0,0);
        cin >> m;
        vector< P > s(m);
        for(i=0;i<m;i++){
            cin >> s[i].first >> s[i].second;
        }
        sort(s.begin(), s.end());
        for(i=0;i<m;i++){
            P root = s[i];
            for(j=1;j<n;j++){
                P trg = P(s[i].first+c[j].first, s[i].second+c[j].second);
                I it = lower_bound(s.begin(), s.end(), trg);
                if( it != s.end() && *it != trg ) break;
            }
            if(j==n){
                cout << s[i].first - origin.first << ' '
                     << s[i].second - origin.second << endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1208
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()

if N % 2 == 0:
    c = N // 2
    S = -2 * sum(A[:c]) + 2 * sum(A[c:]) + A[c-1] - A[c]
else:
    c = (N-1) // 2
    tmp1 = -2 * sum(A[:c]) + 2 * sum(A[c+2:]) + A[c] + A[c+1]
    tmp2 = -2 * sum(A[:c-1]) + 2 * sum(A[c+1:]) - A[c-1] - A[c]
    S = max(tmp1, tmp2)

print(S)

Measured memory_bytes: 7504
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		List<Integer> list_suji=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		String s = sc.next();
		List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		for(int i=0;list.size()-2>i;i++) {
			int a = Integer.parseInt(list.get(i)+list.get(i+1)+list.get(i+2));
			list_suji.add(a);
		}
		//System.out.println(list_suji);
		int answer=1000;
		for(int i=0;list_suji.size()>i;i++) {
			int a = Math.abs(list_suji.get(i)-753);
			if(a<answer)
				answer=a;
		}
		System.out.println(answer);
	}
}

Measured memory_bytes: 21972
N = int(input())
H = list(map(int, input().split()))
tmp_counter = 0
counter = 0

for i in range(N-1):
    if H[i] >= H[i+1]:
        tmp_counter += 1
    
    else:
        tmp_counter = 0
    
    if counter < tmp_counter:
        counter = tmp_counter

print(counter)

Measured memory_bytes: 14252
#include <iostream>
#include <set>
#include <queue>
#include <limits>
#include <string.h>
#include <algorithm>
#define INF 0x3f3f3f3f
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int n;
int dot;
int a,now,fa;
int ans;
int fat[200010];
int col[200010][2];
struct Node{int id;};
bool operator<(const Node&x,const Node&y){
	int x0=col[x.id][0],x1=col[x.id][1],y0=col[y.id][0],y1=col[y.id][1];
	return 1ll*x0*y1>1ll*x1*y0||(1ll*x0*y1==1ll*x1*y0&&x.id>y.id);
}
struct DSU{
	int fa[200010];
	void init(int n){
		for(int i=1;i<=n;i++)fa[i]=i;
	}
	int find(int x){
		return fa[x]==x?x:fa[x]=find(fa[x]);
	}
	void unite(int x,int y){
		fa[x]=find(y);
		col[y][0]+=col[x][0];
		col[y][1]+=col[x][1];
	}
}dsu;
set<Node>st;
signed main(){
	cin>>dot;
	for(int i=2;i<=dot;i++)cin>>fat[i];
	for(int i=1;i<=dot;i++){
		cin>>a;
		col[i][a]++;
	}
	dsu.init(dot);
	for(int i=2;i<=dot;i++)st.insert({i});
	while(!st.empty()){
		now=dsu.find(st.begin()->id);
		st.erase(st.begin());
		fa=dsu.find(fat[now]);
		st.erase({fa});
		ans+=1ll*col[fa][1]*col[now][0];
		dsu.unite(now,fa);
		if(fa!=1)st.insert({fa});
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 19172
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

int main() {
    long x[100];
    long y[100];
    int n;
    cin >>n;

    for (int i = 0; i < n ; ++i) {
        cin >> x[i];
    }
    for (int i = 0; i <n ; ++i) {
        cin >> y[i];
    }

    //???????????????????????¢
    double d1 = 0;
    for (int i = 0; i < n ; ++i) {
        d1 += fabs (x[i] - y[i]);
    }

    //???????????????????????¢
    double d2 = 0;
    for (int i = 0; i < n ; ++i) {
        d2 += pow(x[i] - y[i],2.0);
    }
        d2 = sqrt (d2);

    //p=3
    double d3 = 0;
    for (int m = 0; m < n ; ++m) {
        d3 += pow(fabs(x[m]-y[m]),3.0);
    }
        d3 = cbrt(d3);

    //max
    double d4 = 0;
    for (int i1 = 0; i1 < n ; ++i1) {
        if (d4 <= fabs (x[i1] - y[i1])){
            d4 =  fabs (x[i1] - y[i1]);
        }
    }

    cout << fixed << setprecision(9) << d1 << endl;
    cout << fixed << setprecision(9) << d2 << endl;
    cout << fixed << setprecision(9) << d3 << endl;
    cout << fixed << setprecision(9) << d4 << endl;
    return 0;

}

Measured memory_bytes: 1312
/*
Problem :
Algorithm :
Status :
*/
#include <bits/stdc++.h>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;

const int INF = 0x3f3f3f3f;
const int MAXN = 1e5 + 5;

int n,len;
int head[MAXN],dep[MAXN];

struct Edge{
	int to,next,w;
} e[MAXN * 2];

void add(int u,int v,int w){
	e[++len].to = v;
	e[len].w = w;
	e[len].next = head[u];
	head[u] = len;
}

void dfs(int u,int fa){
	for(int i = head[u];i != -1;i = e[i].next){
		int v = e[i].to;
		if(v == fa)
		    continue;
		dep[v] = dep[u] + e[i].w;
		dfs(v,u);
	}
}

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	memset(head,-1,sizeof(head));
	scanf("%d",&n);
	for(int i = 1;i < n;i++){
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		add(u,v,w);
		add(v,u,w);
	}
	dfs(1,0);
	for(int i = 1;i <= n;i++){
		if(dep[i] & 1)
		    printf("0\n");
		else
		    printf("1\n");
	}
	return 0;
}


Measured memory_bytes: 5632
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define pb push_back
#define mp make_pair
typedef pair<int, int> pii;
typedef long long ll;
const int MOD = 1000000007;
const int BASE = 27;
const int oo = 1e9;
const double EPS = 1e-9;
const int MX = 1e6 + 1;

string s;
int dp[MX];

int main() {
  cin >> s;
  ll ans = 0;
  for(int i = s.size()-1;i>=0;--i){
    if(s[i]=='A'){
      dp[i] = dp[i+1];
      ans += dp[i];
    }
    if(s[i]=='B' && i+1 < s.size() && s[i+1]=='C'){
      dp[i]= 1 + dp[i+2];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1412
#include <iostream>
#include <vector>

using namespace std;

void WriteArray(const vector<int>& nums) {
    for (auto iterator = nums.begin(); iterator != nums.end(); ++iterator) {
        cout << *iterator << (iterator + 1 != nums.end() ? " " : "");
    }
    cout << endl;
}

int main() {
    int len;
    cin >> len;
    vector<int> nums(len);

    for (int i = 0; i < len; i++) cin >> nums[i];

    int swapCount = 0;

    for (int i = 0; i < nums.size(); ++i) {
        int minj = i;
        for (int j = i; j < nums.size(); ++j) {
            if (nums[j] < nums[minj]) minj = j;
        }
        if (i != minj) {
            swap(nums[i], nums[minj]);
            swapCount++;
        }
    }

    WriteArray(nums);
    cout << swapCount << endl;

    return 0;
}

Measured memory_bytes: 3120
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4") 
#include <bits/stdc++.h> 
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define PI 3.1415926535897932384626 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd; 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
 
#define Rep(i, a, b) for (int i=a; i<(b); i++)
#define rep(i, a) for (int i=0; i<(a); i++)
#define Dep(i,a,b) for (int i = (b)-1; i >= a; i--)
#define dep(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for(auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); // Random No.
 
const int MOD = 1000000007;
const char nl = '\n';

void sol() {

    int n , k ;
    cin >> n >> k;
    int arr[n+1];
    Rep(i, 1, n+1){
        cin >> arr[i];
    }

    Rep(i, k+1, n+1){
        if(arr[i]>arr[i-k]){
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
        
    }
    
    
}               

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

    #ifndef ONLINE_JUDGE
    	freopen("inputA.txt", "r", stdin);
	  #endif    
	
    int T=1;
    while(T--) {            
        sol();                
    }
	
	return 0;
}

Measured memory_bytes: 4392
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<queue>
#include<vector>
#include<algorithm>
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
const int maxn = 1e5+5;

int main(){
	string s; cin >> s;
	if(s == "Sunny") cout << "Cloudy" << endl;
	else if(s == "Cloudy") cout << "Rainy" << endl;
	else cout << "Sunny" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

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

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  ll a, b;
  cin >> a >> b;

  cout << prime_factorize(gcd(a, b)).size() + 1 << endl;
  return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s,x;
  cin>>s>>x;
 int n=s.length();
  int m=x.length();
  int dp[n+1][m+1];
  for(int i=0;i<=n;i++)
  {
    dp[i][0]=0;
  }
  for(int i=0;i<=m;i++)
  {
    dp[0][i]=0;
  }
   
   for(int i=1;i<=n;i++)
  {
    for(int j=1;j<=m;j++)
    {
      if(s[i-1]==x[j-1])
      {
        dp[i][j]=1+dp[i-1][j-1];
      }
      else
      {
        dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
      }
    }
  }
  int i=n;
  int j=m;
  string a="";
while(i!=0 && j!=0)
{
  if(s[i-1]==x[j-1])
  {
    a+=s[i-1];
    i--;
    j--;
  }
  else if(dp[i-1][j]>dp[i][j-1])
       i--;
       else
       j--;
       
  }
  
   reverse(a.begin(),a.end());
   cout<<a;
}
 

Measured memory_bytes: 35456
#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 = "";
    cin >> s;
    unordered_map<char, int> p;
    for (auto x : s)
    {
        p[x]++;
    }
    bool k = true;
    for (auto x : p)
    {
        if (x.second % 2 == 0)
        {
            continue;
        }
        else
        {
            k = false;
            break;
        }
    }
    if (k)
    {
        cout << "Yes" << endl;
        return;
    }
    else
    {
        cout << "No";
        return;
    }
}

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: 10624
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> P(N), Q(N);
    rep(i, 0, N) cin >> P[i];
    rep(i, 0, N) cin >> Q[i];
    vector<int> origin(N);
    rep(i, 0, N) {
        origin[i] = i + 1;
    }
    vector<vector<int>> v;
    do {
        v.push_back(origin);
    } while (next_permutation(all(origin)));
    sort(all(origin));
    int a, b;
    rep(i, 0, v.size()) {
        if (v[i] == P) {
            a = i;
        }
        if (v[i] == Q) {
            b = i;
        }
    }
    cout << abs(a - b) << endl;
    return 0;
}

Measured memory_bytes: 3384
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long a=sc.nextLong();
		long b=sc.nextLong();
		if(a*b<=0) {
			System.out.println("Zero");
		}
		else if(a>0 && b>0) {
			System.out.println("Positive");
		}
		else if(a<0 && b<0) {
			long kazu=b-a+1;
			if(kazu%2==1) {
				System.out.println("Negative");
			}
			else {
				System.out.println("Positive");
			}
		}
	}
}


Measured memory_bytes: 21844
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

inline void solve() {
	ll n, k;
	cin >> n >> k;
	vector<int> p(n);
	for (int i = 0; i < n; i++) {
		cin >> p[i];
		p[i]--;
	}

	int t = 2;
	vector<int> tin(n, 0);
	tin[0] = 1;
	int cur = p[0];
	while (tin[cur] == 0) {
		tin[cur] = t++;
		cur = p[cur];
	}

	int cy = t - tin[cur];
	int beg = p[cur];
	cur = 0;
	while (cur != beg) {
		cur = p[cur];
		k--;
		if (k == 0) {
			cout << cur + 1;
			return;
		}
	}

	k %= cy;

	while (k != 0) {
		cur = p[cur];
		k--;
	}

	cout << cur + 1;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	for (; q > 0; q--) {
		solve();
		cout << '\n';
	}
}

Measured memory_bytes: 4784
import sys

N, M = map(int, sys.stdin.readline().rstrip().split())

opes = []
for _ in range(M):
    x, y = map(int, sys.stdin.readline().rstrip().split())
    opes.append((x-1, y-1))

transported = set()
transported.add(0)
boxes = [1 for _ in range(N)]

for (x, y) in opes:
    boxes[x] -= 1
    boxes[y] += 1
    if x in transported:
        transported.add(y)
    if boxes[x] == 0 and x in transported:
        transported.remove(x)

print(len(transported))

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

#define ll long long
#define ld long double
#define db double
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(v) for(int i=0;i<_sz(v);i++)
#define rep1(i,b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)
#define tc int tt=1;cin>>tt;rep(tcs,1,tt+1)

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr<<name<<" : "<<arg1<<nl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const ld pi=2*acos(0.0);

int main(){
    nimble
    int n;
    cin>>n;
    string s;
    string s1;
    cin>>s;
    s1=s;
    reverse(all(s1));
    int cntr[_sz(s)+1]={0};
    int cntw[_sz(s)+1]={0};
    for(int i=_sz(s)-1;i>=0;i--){
        if(s[i]=='R')
            cntr[i]=cntr[i+1]+1;
        else cntr[i]=cntr[i+1];
    }
    for(int i=_sz(s1)-1;i>=0;i--){
        if(s1[i]=='W')
            cntw[i]=cntw[i+1]+1;
        else cntw[i]=cntw[i+1];
    }
    int ans1=0;
    for(int i=0;i<_sz(s);i++){
        if(s[i]=='W'){
            if(cntr[i])
                ans1++;
            else break;
        }
    }
    int ans2=0;
    for(int i=0;i<_sz(s);i++){
        if(s1[i]=='R'){
            if(cntw[i])
                ans2++;
            else break;
        }
    }
    int as=0;
    int i=0,j=_sz(s)-1;
    while(i<j){
        if(s[i]=='R'){
            i++;
            continue;
        }
        if(s[j]=='W'){
            j--;
            continue;
        }
        as++;
        i++;
        j--;
    }
    cout<<as<<nl;
    return 0;
}


Measured memory_bytes: 5336
#include <stdio.h>

int main()
{
	int P, Q, R;
	scanf("%d %d %d", &P, &Q, &R);
	
	if(P==Q&&P==R&&Q==R)
{
	printf("No");
}
	else if(P==Q||P==R||Q==R)
{
	printf("Yes");
}
	else if(P!=Q&&P!=R&&Q!=R)
{
	printf("No");
}
	return 0;
}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

/*
テストケース全てに目を通す
テストケースが2個以下だったらなんかある
N最小のコーナーケースがないか調べる
制約をしっかりと確認する（1からNまでの順列、全て異なる値などの制約も含め）
制約のn*mとn,mを読み違えない
操作の逆順を考える
オーバーフローしないか確かめる
Codeforcesではscanfを使う
modの引き算には+modをする
エラー出力は消す
エラー出力を消せ！！！！！
数値の区切り位置を誤読しない
cout << fixed;
cout << setprecision(n) << ans;
 */

int main() {
    string s;
    cin >> s;
    int n=s.length();
    ll sum=0;
    rep(i,bit(n-1)){
        vector<int> pos;
        rep(j,n-1)if(i&bit(j))pos.pb(j);
        pos.pb(n-1);
        rep(p,n){
            rep(t,sz(pos)){
                if(p<=pos[t]){
                    sum+=(s[p]-'0')*pow(10,pos[t]-p);
                    break;
                }
            }
        }
    } 
    cout << sum;


    
}

/*
*/



Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;


int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

	int find(int x)
	{
		if (par[x] == x)return x;
		else return find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};



int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<vector<int>> c(3, vector<int>(3));
	vector<int> a(3);
	vector<int> b(3);

	rep(i, 0, 3) {
		rep(j, 0, 3) {
			cin >> c[i][j];
		}
	}

	bool ans = true;
	a[0] = 0;
	b[0] = c[0][0] - a[0];
	b[1] = c[0][1] - a[0];
	b[2] = c[0][2] - a[0];

	a[1] = c[1][0] - b[0];
	a[2] = c[2][0] - b[0];

	rep(i, 0, 3) {
		rep(j, 0, 3) {
			if (a[i] + b[j] != c[i][j]) {
				ans = false;
			}
		}
	}
	if (ans)cout << "Yes" << endl;
	else cout << "No" << endl;

 
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <iostream> // cin, cout, string
#include <algorithm> // sort, min, max
#include <vector>
#include <utility> // pair, swap
#include <functional>
#include <iomanip> // setprecision
#include <map>
#include <set> // multiset
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <stack>
#include <queue> // priority_queue
#include <deque>
#include <bitset>
#include <complex>

using namespace std;

// #define int long long

using ll = long long;
using ld = long double;

// template<class T1, class T2> using P = pair<T1, T2>;
template<class T> using vec = vector<T>;
template<typename T> using func = function<T>;

using pii = pair<int, int>;
using ppi = pair<pii, int>;
using pip = pair<int, pii>;
using ppp = pair<pii, pii>;

using vi = vec<int>;
using vvi = vec<vi>; // Graph
using vp = vec<pii>;

constexpr int IINF =  0x3f3f3f3f;
constexpr ll LINF = 0x3f3f3f3f3f3f3f3fLL;
// constexpr int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
constexpr ll MOD = 1e9+7;

#define for_(i, a, b) for(int i = (a);i < (b);++i)
#define rfor_(i, a, b) for(int i = (b)-1;i >= (a);--i)

#define rep(i, n) for_(i, 0, n)
#define rrep(i, n) rfor_(i, 0, n)

#define pb push_back
#define mp make_pair
#define mt make_tuple
// eb(*,*) = pb(mp(*,*))
#define eb emplace_back
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))
// #define sum(...) accumulate(range(__VA_ARGS__), 0LL)

#define endl '\n'
#define dec(n) fixed << setprecision(n)
#define zfl(n)  setfill(‘0’) << setw(n)
#define debug(x) cerr << #x << ": " << (x) << endl

template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

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

template<typename T> istream &operator>>(istream &is, vector<T> &v) { for(auto&& x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for(int i=0; i<(int)v.size(); ++i) cout << v[i] << ( i+1 != (int)v.size() ? " " : "" ); return os; }

template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { os << p.first << " " << p.second; return os; }

const int limit = 100007;

int A, B;

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

  cin >> A >> B;

  if(A >= 13) cout << B;
  else if(A >= 6) cout << B/2;
  else cout << 0;
  cout << endl;

  return 0;
}


Measured memory_bytes: 888
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;
import std.range;

void main(){
	auto Z=readln.split.to!(int[]),a=Z[0],b=Z[1];
	if((a*b)%2==0)writeln("Even");
	else writeln("Odd");
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

template <typename T>
std::tuple<T, T, T> extgcd(T a, T b){
    T s1 = 1, t1 = 0, s2 = 0, t2 = 1;
    while(b != 0){
        std::tie(s1, t1, s2, t2) = std::make_tuple(s2, t2, s1 - (a / b) * s2, t1 - (a / b) * t2);
        std::tie(a, b) = std::make_tuple(b, a % b);
    }
    return std::make_tuple(s1, t1, a);
}

template <typename T>
T mod_inverse(T a, T mod){
    T b;
    std::tie(b, std::ignore, std::ignore) = extgcd(a, mod);
    if(b < 0){b += mod;}
    return b;
}

template <typename T>
struct Combinatorics{
    T modulo;
    std::vector<T> fact, inv_fact;

    Combinatorics(T max, T modulo) : modulo(modulo), fact(max + 1), inv_fact(max + 1) {
        fact[0] = 1;
        for(T i=1;i<=max;++i){
            fact[i] = i * fact[i - 1] % modulo;
        }

        inv_fact[max] = mod_inverse(fact[max], modulo);
        for(T i=max;i>0;--i){
            inv_fact[i - 1] = i * inv_fact[i] % modulo;
        }
    }

    T nPk(T n, T k){
        if(n < k){return 0;}
        return fact[n] * inv_fact[n - k] % modulo;
    }

    T nCk(T n, T k){
        if(n < k){return 0;}
        return fact[n] * inv_fact[k] % modulo * inv_fact[n - k] % modulo;
    }

    T nHk(T n, T k){
        if(n == 0 && k == 0){return 1;}
        return nCk(n + k - 1, k);
    }
};

constexpr ll MOD = 1'000'000'007;
Combinatorics<ll> comb(200100, MOD);
int N, K;
ll A[100100];

ll f(){
    ll res = 0;

    for(int i=K;i<=N;++i){
        res = (res + A[i-1] * comb.nCk(i-1, K-1) % MOD) % MOD;
    }

    return res;
}

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

  std::cin >> N >> K;

  for(int i=0;i<N;++i){
      std::cin >> A[i];
  }

  std::sort(A, A + N);

  ll x = f();

  std::reverse(A, A + N);

  ll y = f();

  ll res = (x + MOD - y) % MOD;
  std::cout << res << std::endl;
}


Measured memory_bytes: 4224
import math

N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)

K = int(math.log2(N-1))

if N == 2:
    print(A[0])
else:
    ans = A[0]
    ind = 1
    num = 0
    for i in range(N-2):
        if num < 2:
            ans += A[ind]
            num += 1
        else:
            ind += 1
            ans += A[ind]
            num = 1
        
    print(ans)




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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int K;
  cin >> K;
  int tmp = N;
  vector<char> D(K);
  REP(i, K) cin >> D[i];

  while(1) {
    string ntos = to_string(tmp);
    bool flag = true;
    for(int i = 0; i < ntos.size(); i++) {
      for(int j = 0; j < K; j++) {
        if(ntos[i] == D[j]) {
          flag = false;
          break;
        }
      }
      if(!flag) break;
    }
    if(flag) {
      break;
    } else {
      tmp++;
    }
  }

  cout << tmp << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Math;
class Project
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();
        if(char.IsUpper(s, 0))
        {
            Console.WriteLine("A");
        }
        else
        {
            Console.WriteLine("a");
        }
    }
}

Measured memory_bytes: 25796
// https://atcoder.jp/contests/abc084/tasks/abc084_c
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main()
{
    int N;
    cin >> N;
    vector<int> C(N - 1), S(N - 1), F(N - 1);
    for (int i = 0; i < N - 1; ++i) cin >> C[i] >> S[i] >> F[i];
    vector<int> res(N);
    for (int i = 0; i < N; ++i)
    {
        int t = 0;
        for (int in = i; in < N - 1; ++in)
        {
            if (t < S[in]) t = S[in] + C[in];
            else if (t % F[in] == 0) t += C[in];
            else t = t + F[in] - t % F[in] + C[in];
        }
        res[i] = t;
    }

    for (int i = 0; i < N; ++i)
    {
        cout << res[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3624
n = int(input())
nums = list(map(int,input().split()))

def search(nums, state):
    cur = nums[0]
    ans = 1
    for num in nums[1:]:
        if state == "up":
            if cur > num:
                ans += 1
                state = "neutral"
        
        elif state == "down":
            if cur < num:
                ans += 1
                state = "neutral"
        
        elif state == "neutral":
            if cur > num:
                state = "down"
            elif cur < num:
                state = "up"
            else:
                state = "neutral"
        
        cur = num
    return ans 
    
print(min(search(nums, "up"), search(nums, "down")))

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

int main() {
int x,y,sum = 0;
cin >> x >> y;
bool flag = false;

for(int i = x; i>=0; i--){//つるの数
 for(int k = 0; k<=x; k++){//カメの数
     sum = 2*i + 4*k;
     if(sum == y && (i+k) == x){
         flag = true;
         break;
     }
      if(flag){
         break;
        }
    }
}
 if(flag){
    cout << "Yes" << endl;
 }
 else{
    cout << "No" << endl;
 }
}

Measured memory_bytes: 3596
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;

inline char gc()
{
		static const int L = 1000;
		static char sxd[L], *sss = sxd, *ttt = sxd;
		if(sss == ttt)
		{
				ttt = (sss = sxd) + fread(sxd, 1, L, stdin);
				if(sss == ttt)
						return EOF;
		}
		return *sss++;
}

#define dd c = getchar()
inline int read(int& x)
{
		x = 0;
		char dd;
		bool f = false;
		for(; !isdigit(c); dd)
		{
				if(c == EOF)
						return -1;
				if(c == '-')
						f = true;
		}
		for(; isdigit(c); dd)
				x = (x << 1) + (x << 3) + (c ^ 48);
		if(f)
				x = -x;
		return 1;
}
#undef dd

int i,j,n,x[100010],m,d[100010],z[100010],t[100010],c;
long long K;
double a[100010];
int main()
{
	read(n);
	for(i=1;i<=n;++i) read(x[i]);
	read(m);
	cin>>K;
	for(i=1;i<=n;i++)
	{
		d[i]=i;
		z[i]=i;
	}
	for(i=1;i<=m;i++)
	{
		read(c);
		swap(d[c],d[c+1]);
	}
	while(K)
	{
		if(K&1)
		{
			for(i=1;i<=n;i++) t[i]=z[d[i]];
			for(i=1;i<=n;i++) z[i]=t[i];
		}
		for(i=1;i<=n;i++) t[i]=d[d[i]];
		for(i=1;i<=n;i++) d[i]=t[i];
		K>>=1;
	}
	for(i=1;i<=n;i++)
	  a[i]=x[z[i]]-x[z[i]-1];
	for(i=1;i<=n;i++)
	  printf("%.1lf\n",a[i]+=a[i-1]);
	return 0;
}

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

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        s: String,
    }
    let mut v = vec![s];
    v.push("2019/04/30".to_string());
    v.sort();
    if v[1] == "2019/04/30" {
        println!("Heisei");
    } else {
        println!("TBD");
    }
}


Measured memory_bytes: 4352
import java.util.*;
public class Main {	
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new AOJ0030();
	}
	
	
	class AOJ0030{
		int bfs(int nowN,int Sum,int before){//現在の足した回数,足した合計値,前の数
			int cnt = 0;
			if(ans>ans)return 0;//超えている時点でアウト
			if(nowN == n){
				if(Sum == ans)return 1;//nかつansの場合1を返す。
				else return 0;//そうでない時は0
			}
			for(int i=before;i<10;i++){
				cnt+=bfs(nowN+1,Sum+i,i+1);
			}
			return cnt;
		}
		int n,ans;
		AOJ0030(){
			Scanner in = new Scanner(System.in);
			while(true){
				n = in.nextInt();
				ans = in.nextInt();
				if(n+ans==0)break;
				int result = bfs(0,0,0);
				System.out.println(result);
			}
		}
		
		
		
	}
}

Measured memory_bytes: 18284
s=input()
if len(s)!=26:
  for i in range(26):
    if chr(97+i) not in s:
      print(s+chr(97+i))
      break
else:
  for i in range(25)[::-1]:
    checking=s[i]
    for j in range(ord(checking)+1,123):
      if chr(j) not in s[:i]:
        print(s[:i]+chr(j))
        exit()
  print(-1)

Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long int

using namespace std;

int main(void){
    cin.sync_with_stdio(false);
    string S; cin>>S;
    cout << (S.substr(0,4) == "YAKI" ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define N 200000
int A[26][N]={0}, pos[26]={0};
int NEXT[26][N]={0};

int  main(){
  int l, i, tmp, ex, cur, j, prev, st, zz;
  long long int loop=0;
  char s[N], t[N];
  scanf("%s", s);
  scanf("%s", t);
  for (i=0; i<26; i++){
    for (j=0; j<N; j++){
      NEXT[i][j]=-1;
    }
  }

  l=strlen(s);  
  for (i=0; i<l; i++){
    tmp=s[i]-'a';
    A[tmp][pos[tmp]]=i; 
    if (pos[tmp]==0) st=-1; else st=A[tmp][pos[tmp]-1];
    for (j=st; j<i; j++) NEXT[tmp][j+1]=i;
    pos[tmp]++;
  }

/*
  for (i=0; i<26; i++){
    for (j=0; j<10; j++){
      printf("%d ", NEXT[i][j]);
    }
    printf("\n");
  }
*/

  
  cur=-1;
  for (i=0; i<strlen(t); i++){
 //   printf("%lld %d\n", loop, cur);
    tmp=t[i]-'a';
  //  printf("%c\n", tmp+'a');
    ex=0;
    if (pos[tmp]==0) {
      printf("-1\n"); return 0;
    }
    zz=NEXT[tmp][cur+1]; 
    if (zz>cur) {
        ex=1; cur=zz; continue;
    }
    cur=A[tmp][0]; loop++;
  }
  printf("%lld\n", loop*strlen(s)+cur+1);
  return 0;
}


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

int main()
{
    string s;
    cin >> s;
    int n = s.length();

    map<char, int> T;
    rep(i, n)
    {
        T[s[i]] = 1;
    }

    if (T['N'] && T['W'] && T['S'] && T['E'])
        cout << "Yes" << endl;
    else if (T['N'] && !T['W'] && T['S'] && !T['E'])
        cout << "Yes" << endl;
    else if (!T['N'] && T['W'] && !T['S'] && T['E'])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
using namespace std;
typedef long long int ll;

constexpr ll mod=1e9+7;

ll mod_pow(ll a,ll b){
    a%=mod;
    if(b==0)return 1;
    if(b==1)return a;
    ll res=mod_pow(a,b/2)%mod;
    res*=res; res%=mod;
    if(b%2)res*=a;
    return res%mod;
}

struct perm{
private:
    int sz;
public:
    vector<ll> p,invp;
    perm(int n){
        sz=n+1;
        p.resize(sz),invp.resize(sz);
        p[0]=1;
        for(int i=1;i<=sz-1;i++){
            p[i]=p[i-1]*i%mod;
        }
        invp[sz-1]=mod_pow(p[sz-1],mod-2);
        for(int i=sz-2;i>=0;i--){
            invp[i]=invp[i+1]*(i+1)%mod;
        }
    }
    ll comb(ll x,ll y){
        if(x<y||y<0)return 0;
        return (p[x]*invp[x-y]%mod)*invp[y]%mod;
    }
};
perm p(1<<21);

ll a[500500];
ll res[500500];

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,m; cin >> n >> m;
    a[1]=0;
    a[2]=1;
    for(int i=3;i<=m;i++){
        a[i]=(i-1)*(a[i-1]+a[i-2])%mod;
    }
    res[0]=a[m];
    ll ans=0;
    for(ll i=1;i<=m-n;i++){
        res[i]=p.comb(m-n,i)*a[m-i]%mod;
    }
    for(int i=0;i<=m-n;i++){
        (ans+=res[i])%=mod;
    }
    (ans*=p.p[m]*mod_pow(mod_pow(p.p[m-n],mod-2),2)%mod)%=mod;
    cout << ans << endl;
}

Measured memory_bytes: 43796
#include <iostream>

using namespace std;

int main(){
	long long x,y;
	cin >> x >> y;
	
	long long num = x, count = 1;
	
	while(num * 2 <= y){
		num *= 2;
		count++;
	}
	
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3564
# Enter your code here. Read input from STDIN. Print output to STDOUT

arr = []
for _ in range(5):
    arr.append(int(input()))

k = int(input())
cpt = 0
for i in range(5):
    for j in range(i+1,5):
        if arr[j] - arr[i] > k:
            cpt = 1
if cpt:
    print(':(')
else:
    print('Yay!')



Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N; cin >> N; 
	int A[200010] = {}; 
	int M[200010] = {}; 
	for(int i = 0; i < N; i++) cin >> A[i];
	M[0] = A[0]; 
	for(int i = 1; i < N; i++) M[i] = min(M[i-1], A[i]); 
	int ans = 0; 
	for(int i = 0; i < N; i++){
		if(M[i] == A[i]) ans ++; 
	}
	cout << ans << endl; 
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acosl(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

//約数列挙
//昇順
//#include <vector>
//#include <cmath>
std::vector<long long> div(long long n) {
	std::vector<long long> v(1, 1);
	if (n == 1) return v;
	for (long long i = 2; i <= sqrt(n); i++) {
		if (n % i == 0) v.push_back(i);
	}
	if (sqrt(n) == (long long)sqrt(n)) {
		for (long long i = v.size() - 2; i >= 0; i--) v.push_back(n / v[i]);
	}
	else {
		for (long long i = v.size() - 1; i >= 0; i--) v.push_back(n / v[i]);
	}
	return v;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	ll n;
	cin >> n;
	vector<ll> a(n);
	for (ll i = 0; i < n; i++) cin >> a[i];
	sort(all(a));

	set<ll> st;
	st.insert(a[0]);
	ll ans = 1;
	if (n > 1 && a[0] == a[1]) ans--;
	for (ll i = 1; i < n; i++) {
		vector<ll> v = div(a[i]);
		for (ll j = 0; j < v.size(); j++) {
			if (st.find(v[j]) != st.end()) {
				break;
			}
			if (j == v.size() - 1) {
				if (i < n - 1 && a[i] == a[i + 1]) break;
				ans++;
			}
		}
		st.insert(a[i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 14160