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

public class Main {
    int mod = 1000000007;

    public static void main(String[] args) throws IOException {
        FastReader sc = new FastReader();
        int k = sc.nextInt();
        String str = sc.next();
        if (str.length() <= k){
            System.out.println(str);
        }else {
            String ans = str.substring(0,k);
            ans+="...";
            System.out.println(ans);
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Measured memory_bytes: 36464
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int w = sc.nextInt();
			if(w == -1)break;
			
			int pay = 0;
			if(w < 10)pay += 1150;
			if(10 <= w && w < 20)pay += 125 * (w-10) + 1150;
			if(20 <= w && w < 30)pay += 140 * (w-20) + 125 * 10 + 1150;
			if(30 <= w)pay += 160 * (w-30) + 125 * 10 + 140 * 10 + 1150;
			
			System.out.println(4280-pay);
		}
		sc.close();
	}
}

Measured memory_bytes: 18572
/*author : Yashvardhan
Tuesday, April 07, 2020
8:18 PM
*/

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second
#define mp make_pair
#define endl '\n'
#define all(a) a.begin(), a.end()
#define initialise(a, x) memset(a, x, sizeof(a))
#define rev(Y) reverse(all(Y))
#define printArr(name,from,to) for(int x = from; x < to; x++) cout << name[x] << " ";


#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#ifdef __APPLE__
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
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
#define debug(...)
#endif

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int takemod(int a){return ((a%mod)+mod)%mod;}

int pow(int a, int b, int m)
{
	int ans = 1;
	a %= m;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

int modinv(int a){return takemod( pow( takemod(a), mod-2,mod ) );}


signed main()
{

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

	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();
	
	int n,m;
	cin >> n >> m;

	int ans = ((n)*(n-1))/2;
	ans += (m*(m-1))/2;

	cout << ans << endl;
	

	t2 = clock();
	cerr << endl << t2-t1 << endl;
	
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>

using namespace std;

int num_of_selected[1001],total;

struct Info{
	Info(){
		id = group = ans = penalty = 0;
	}
	int id,group,ans,penalty;
};

void func(int N){

	Info info[N];

	for(int i = 0; i < N; i++){
		scanf("%d %d %d %d",&info[i].id,&info[i].group,&info[i].ans,&info[i].penalty);
	}

	for(int i = 1; i <= N-1; i++){
		for(int k = N-1; k >= i; k--){
			if((info[k].ans > info[k-1].ans) || (info[k].ans == info[k-1].ans && info[k].penalty < info[k-1].penalty) ||
					(info[k].ans == info[k-1].ans && info[k].penalty == info[k-1].penalty && info[k].id < info[k-1].id))swap(info[k],info[k-1]);
		}
	}

	total = 0;
	for(int i = 0; i < N && total < 26; i++){
		if(total < 10 && num_of_selected[info[i].group] < 3){
			num_of_selected[info[i].group]++;
			total++;
			printf("%d\n",info[i].id);
		}else if(total < 20 && num_of_selected[info[i].group] < 2){
			num_of_selected[info[i].group]++;
			total++;
			printf("%d\n",info[i].id);
		}else if(total < 26 && num_of_selected[info[i].group] == 0){
			num_of_selected[info[i].group]++;
			total++;
			printf("%d\n",info[i].id);
		}
	}
}

int main(){

	int N;

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		for(int i = 1; i<= 1000; i++)num_of_selected[i] = 0;

		func(N);
	}

	return 0;
}

Measured memory_bytes: 2612
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

//Code Short
#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define DSORT(n) sort(n.begin(),n.end())
#define QECHO(n) cout << n
#define QECHOS(n) cout << n << " "

//Define Math
const double EPS = 1e-10;
const double PI  = acos(-1.0);

using namespace std;
typedef long long ll;
/* prototype */
int EDSum(ll);//各桁の和
vector<int> SOE(int,int);//素数 (Min,Max)
int MinCM(int,int);//最小公倍数(num1,num2)
int MaxCD(int,int);//最大公約数(num1,num2)
vector<int> igets(int);//cin * N
ll nPr(ll,ll); //(n,r)
ll nE(ll); //(n)
ll nCr(ll,ll); //(n,r)

void solve(){
    //START
   int a,b;cin >> a >>b;
   cout << ceil((float)(a+b)/2) << endl;
}

int main(void){cin.tie(0);ios::sync_with_stdio(false);solve();}
int EDSum(ll number) {
  int ans = 0;
  while (1) {
    ans += number % 10;
    number /= 10;
    if (number == 0) break;
  }
  return ans;
}

vector < int > SOE(int min, int max) {
  if (min < 2) min = 2;
  vector < int > int_array;
  for (int i = min; i <= max; i++) int_array.push_back(i);
  vector < int > sosu;
  double stop = sqrt(max);
  while (true) {
    sosu.push_back(int_array.front());
    int_array.erase(int_array.begin());
    if (stop < (double)(sosu.back())) break;
    for (int i = 0; i < (int) int_array.size(); i++) {
      if (int_array[i] % sosu.back() == 0)
        int_array.erase(int_array.begin() + i);
    }
  }
  sosu.insert(sosu.end(), int_array.begin(), int_array.end());
  return sosu;
}

int MinCM(int a, int b) {
  int c = a * b;
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return c / b;
}

int MaxCD(int a, int b) {
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
vector < int > igets(int N) {
  vector < int > A;
  int temp;
  for (int i = 0; i < N; ++i) {
    cin >> temp;
    A.push_back(temp);
  }
  return A;
}

ll nPr(ll n, ll r) {
  ll ans = 1;
  r = n - r;
  while (n != r) {
    ans *= n;
    --n;
  }
  return ans;
}

ll nE(ll n) {
  return nPr(n, n);
}

ll nCr(ll n, ll r) {
  if (r == 0) return -1;
  else {
    if (0 != n - r && n - r < r) r = n - r;
    return nPr(n, r) / nE(r);
  }
}

Measured memory_bytes: 256
fn main() {
    let s: String = read();
    let mut pas: u8 = b'i';
    for ss in s.chars() {
        if !(pas == b'h' && ss == 'i') && !(pas == b'i' && ss == 'h') {
            println!("No");
            exit(0);
        }
        pas = ss as u8;
    }
    if pas == b'i' {
        println!("Yes");
    } else {
        println!("No");
    }
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


Measured memory_bytes: 4352
import sys
sys.setrecursionlimit(100000000)


def main():
    solve()


def solve():
    for data in get_dataset():
        print search(data)


def search(data):
    count = 0
    H = len(data)
    W = len(data[0])
    for i in xrange(H):
        for j in xrange(W):
            if data[i][j] == '.':
                continue
            _search(i, j, H, W, data[i][j], data)
            count += 1
    return count


def _search(i, j, H, W, cell, data):
    data[i][j] = '.'
    for a in xrange(i-1, i+2):
        if not -1 < a < H:
            continue
        for b in xrange(j-1, j+2):
            if not -1 < b < W:
                continue

            if a != i and b != j:
                continue

            if data[a][b] == '.':
                continue

            if cell == data[a][b]:
                _search(a, b, H, W, cell, data)
    return


def get_dataset():
    dataset = []
    while True:
        line = raw_input().rstrip().split()
        H = int(line[0])
        if H == 0:
            break

        data = []
        for i in xrange(H):
            data.append(list(raw_input().rstrip()))
        dataset.append(data)
    return dataset


if __name__ == '__main__':
    main()

Measured memory_bytes: 15768
#pragma GCC optimize("Ofast", "unroll-loops")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

int n;
vector<vector<int>> g;

void input() {
	int m;
	cin >> n >> m;
	g.resize(n);
	while (m--) {
		int a, b;
		cin >> a >> b;
		--a, --b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
}

vector<int> res;

void bfs() {
	static vector<bool> is_visited;
	is_visited.resize(n, false);
	is_visited[0] = true;
	queue<pair<int, int>> q;
	q.push(pair<int, int>(0, -1));
	while (!q.empty()) {
		auto p = q.front();
		q.pop();
		res[p.first] = p.second;
		for (auto c : g[p.first]) {
			if (!is_visited[c]) {
				is_visited[c] = true;
				q.push(pair<int, int>(c, p.first));
			}
		}
	}
}

void solve() {
	input();
	res.resize(n);
	bfs();
	cout << "Yes" << endl;
	for (int i = 1; i < n; ++i)
		cout << (++res[i]) << endl;
}

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

Measured memory_bytes: 10508
#include<stdio.h>
#include<string.h>
int main(){
  char moji[200],mem[200];
  int i;
  int j,k,h,h2;
  int n;
  int m;
  while(scanf("%s",&moji)){
    if(moji[0]=='-') break;
    m = strlen(moji);
    //printf("%d\n",m);
    scanf("%d",&i);
    for(j=0;j<i;j++){
      h = 0;
      h2 = 0;
      scanf("%d",&n);
      for(k=n;k<m;k++){
	mem[h] = moji[k];
	h++;
      }
      for(k=h;k<m;k++){
      mem[k] = moji[h2];
      h2++;
      }
      for(k=0;k<m;k++) moji[k] = mem[k];
    }
    for(j=0;j<m;j++) printf("%c",moji[j]);
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 996
import java.io.*;
import java.util.*;
import java.lang.Math;
import java.util.Arrays;

public class Main {
    public static void main(final String[] args) {

        Scanner sc = new Scanner(System.in);
        
        String s;
        s = sc.nextLine();
        for (int i = 0; i < s.length(); i++) {
            if ('a' <= s.charAt(i) && s.charAt(i) <= 'z') {
                System.out.printf("%c", s.charAt(i) - 'a' + 'A');
            } else if('A' <= s.charAt(i) && s.charAt(i) <= 'Z'){
                System.out.printf("%c", s.charAt(i) - 'A' + 'a');
            } else {
                System.out.printf("%c", s.charAt(i));
            }
        }
        System.out.println();
    }
  
}


Measured memory_bytes: 29984
def main():
    n = int(input())
    A = list(map(int, input().split()))

    filled = [0]*(n+1)
    ans = []
    for i in range(n-1, -1, -1):
        if sum(filled[::i+1][1:]) % 2 != A[i]:
            filled[i+1] = 1
            ans.append(i+1)
    print(len(ans))
    print(' '.join(map(str, ans)))

if __name__ == '__main__':
    main()

Measured memory_bytes: 20796
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
constexpr int INF = 0x3f3f3f3f;
constexpr ll LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr double EPS = 1e-8;
constexpr int MOD = 1000000007;
// constexpr int MOD = 998244353;
constexpr int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
constexpr int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  ll n; int x, m; cin >> n >> x >> m;
  vector<int> a{x};
  vector<bool> exist(m, false);
  exist[x] = true;
  ll cur = x;
  while (!exist[cur * cur % m]) {
    cur = cur * cur % m;
    a.emplace_back(cur);
    exist[cur] = true;
  }
  cur = cur * cur % m;
  vector<int> loop;
  while (a.back() != cur) {
    loop.emplace_back(a.back());
    a.pop_back();
  }
  loop.emplace_back(cur);
  a.pop_back();
  reverse(ALL(loop));
  ll ans = 0;
  for (int e : a) {
    if (n > 0) {
      --n;
      ans += e;
    }
  }
  ans += accumulate(ALL(loop), 0LL) * (n / loop.size());
  n %= loop.size();
  REP(i, n) ans += loop[i];
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3828
/*
 * C=V-E
 * Ek=Ek-1*(sum_{i}(a[1][i]=='#'&a[n][i]=='#'))+Vk-1*(sum_{ij}(a[i][j]=='#'&a[i][j+1]=='#'))
 * Vk=Vk-1*(sum_{ij}(a[i][j]=='#'))
 * E1=0,V1=1
 * matrix fast power to solve E and V 
 * [Warring] : this code is not write by EDT.
 */
 
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define lint long long
#define mod 1000000007
#define N 1010
#define debug(x) cerr<<#x<<"="<<x
#define sp <<" "
#define ln <<endl
using namespace std;
inline int fast_pow(int x,lint k,int ans=1)
{   for(;k;k>>=1,x=(lint)x*x%mod) (k&1)?ans=(lint)ans*x%mod:0;return ans;   }
bool s[N][N],t[N][N];
struct mtx{
    int v[3][3],n,m;mtx(){}
    mtx(int a,int b,int c,int d)
    { n=m=2,v[1][1]=a,v[1][2]=b,v[2][1]=c,v[2][2]=d; }
    inline mtx operator=(const mtx &b)
    { n=b.n,m=b.m;rep(i,1,n) rep(j,1,m) v[i][j]=b.v[i][j];return *this; }
    inline mtx operator*(const mtx &b)const
    {
        const mtx &a=*this;mtx c(0,0,0,0);
        rep(i,1,n) rep(k,1,b.m) rep(j,1,m)
            (c.v[i][k]+=(lint)a.v[i][j]*b.v[j][k]%mod)%=mod;
        return c;
    }
    inline mtx operator*=(const mtx &b)
    {   return (*this)=(*this)*b;   }
}A;
inline mtx fast_pow(mtx A,lint k)
{
    mtx ans=A;if(!(--k)) return A;
    for(;k;k>>=1,A*=A) (k&1)?ans*=A,0:0;
    return ans;
}
inline int mol(int x) { return x%=mod,(x<0?x+mod:x); }
int main()
{
    int n,m;lint k;scanf("%d%d%lld",&n,&m,&k);
    if(k<=1) return !printf("1\n");
    rep(i,1,n) for(int j=1,x;j<=m;s[i][j++]=(x=='#'))
        while((x=getchar())!='.'&&x!='#');
    int zy=0,sx=0,cnt=0,xl=0;
    rep(i,1,n) zy+=(s[i][1]&s[i][m]);
    rep(j,1,m) sx+=(s[1][j]&s[n][j]);
    rep(i,1,n) rep(j,1,m) cnt+=s[i][j];
    if(zy&&sx) return !printf("1\n");
    if(!zy&&!sx) return !printf("%d\n", fast_pow(cnt,k-1));
    if(sx)
    {
        rep(i,1,n) rep(j,1,m) t[j][i]=s[i][j];swap(n,m);
        rep(i,1,n) memcpy(s[i],t[i],sizeof(bool)*(m+1));
    }
    zy+=sx,sx=0;
    rep(i,1,n) rep(j,1,m-1) xl+=(s[i][j]&s[i][j+1]);
    A=mtx(cnt,0,xl,zy),A=fast_pow(A,k-1);
    return !printf("%d\n",mol(A.v[1][1]-A.v[2][1]));
}

Measured memory_bytes: 2176
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>

#define INF 0x7fffffff
#define MOD 10000007
#define N 30

using namespace std;

struct node
{
      double a,b,c;
} color[N];
int ans[N];
int n,m;
double Min;

double squr(double a,double b,double c)
{
      return a*a+b*b+c*c;
}
void dfs(int now,int tot)
{
      if(tot==m)
      {
            double cnt=0.0;
            for(int i=1;i<=m;i++)
            {
                  for(int j=i+1;j<=m;j++)
                  {
                        double aa=fabs(color[ans[i]].a-color[ans[j]].a);
                        double bb=fabs(color[ans[i]].b-color[ans[j]].b);
                        double cc=fabs(color[ans[i]].c-color[ans[j]].c);
                        cnt=cnt+squr(aa,bb,cc);
                  }
            }
            if(cnt>Min) Min=cnt;
            return;
      }
      if(m-tot>n-now+1) return;
      for(int i=now;i<=n;i++)
      {
            ans[tot+1]=i;
            dfs(i+1,tot+1);
      }
}
int main()
{
      scanf("%d%d",&n,&m);
      for(int i=1;i<=n;i++)
      {
            scanf("%lf%lf%lf",&color[i].a,&color[i].b,&color[i].c);
      }
      memset(ans,0,sizeof(ans));
      Min=0.0;
      dfs(1,0);
      printf("%lf\n",Min);
      return 0;
}

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

int main(){
 int a, b, c;
  cin >> a >> b >> c;
if(a < c && c < b){
cout << " Yes" <<endl;
}
 else if(b < c && c< a){
cout << " Yes" <<endl;
}
else {
cout << " No" <<endl;
}
}
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<int,int>
#define V vector<ll>
#define M map<int,int>
#define S set<int>
#define L list<int>
 
#define pb(a) push_back(a)
#define mp make_pair

int main(){

  CIN(a,b,c,d,e,f);

  double maxpar = -INF;
  int maxwater = -INF;
  int maxsuger = -INF;

  for(int i=0;i*a*100<f;++i)
    for(int j=0;i*a*100+j*b*100<f;++j)
      for(int k=0;k*c+(i*a+j*b)*100<=f&&k*c<=(i*a+j*b)*e;k++)
        for(int l=0;k*c+l*d+(i*a+j*b)*100<=f&&k*c+l*d<=(i*a+j*b)*e;l++){
          // dump((i*a+j*b)*100+k*c+l*d);
          // dump(k*c+l*d);
          if(maxpar<1.0*(k*c+l*d)/((i*a+j*b)*100+k*c+l*d)){
            maxpar = 1.0*(k*c+l*d)/((i*a+j*b)*100+k*c+l*d);
            maxwater=(i*a+j*b)*100+k*c+l*d;
            maxsuger=k*c+l*d;
          }
        }


  SCOUT(maxwater);
  COUT(maxsuger);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define intm INT_MAX
#define llm LLONG_MAX

using namespace std;
int MOD = 998244353;

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	int k;
	cin >> k;
	if( k <= 9 ){ cout << k; return 0; }
	vector<ll> v1;
	for(int i=1; i <= 9; i++) v1.push_back(i);
	k -= 9;
	while(1){
        vector<ll> old;
        swap(old,v1);
        for(auto c: old){
            int cur = c%10;
            if( cur-1 >= 0 ) v1.push_back( c*10 + cur-1 );
            v1.push_back(c*10 + cur);
            if( cur+1 <= 9 ) v1.push_back( c*10 + cur +1 );
        }
        if( k <= v1.size() ){
            cout << v1[k-1]; return 0;
        }
        k -= v1.size();
	}



}


Measured memory_bytes: 1712
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	int a;
	long long s=0;
	for(int i=0;i<m;i++){
		cin>>a;
		s+=a;
	}
	if(s>n) cout<<"-1\n";
	else cout<<n-s<<endl;
}

Measured memory_bytes: 3600
process.stdin.resume();
process.stdin.setEncoding('utf8');
var lines = [];
var reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
});
reader.on('line', (line) => {
    lines.push(line);
});
reader.on('close', () => {
    solve(lines[0]);
});

function solve(input) {
    if (input == 7 || input == 5 || input == 3) {
        console.log("YES");
    }
    else {
        console.log("NO");
    }
}

Measured memory_bytes: 7500
#!/usr/bin/env python3
class UnionFind():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x
n,m,k = map(int,input().split())
uf = UnionFind(n)
#初期化したら友達関係を受け取ってufを形成していく union
friend = [0]*n
# 友達が何人いるかも必要
for i in range(m):
    a,b = map(int,input().split())
    friend[a-1] += 1
    friend[b-1] += 1
    uf.union(a-1,b-1)
# uf が完成したら,c,d を受け取り、parentの値が同じならblock[c],bloc[d]+=1をする
block = [0]*n
for j in range(k):
    c,d = map(int,input().split())
    if uf.find(c-1) == uf.find(d-1):
        block[c-1]+=1
        block[d-1]+=1
"""
print(uf.parents)
print(block)
print(friend)"""
for i in range(n):
    #print(abs(uf.parents[uf.find(i)]),":",i)
    print(abs(uf.parents[uf.find(i)]) - 1 - friend[i] - block[i],end=" ")


Measured memory_bytes: 93528
#include<bits/stdc++.h>
#define lson l, mid, i<<1
#define rson mid+1, r, i<<1|1
#define PII pair<int, int>
#define Size(x) (int)(x.size())
using namespace std;
typedef long long LL;
const int MOD = 1e9+7;
const auto INF = 0x3f3f3f3f;
const int N = 1e5+5;

vector<int> maps[N];
bool visit[N];
int mark[N], num;
bool flag;

void dfs(int u, int id) {
    mark[u] = id;
    if(!id)
        num++;
    for(int i=0; i<Size(maps[u]) && flag; i++) {
        int v = maps[u][i];
        if(visit[v]) {
            if(mark[v] != (id^1)) {
                flag = false;
                return;
            }
            continue;
        }
        visit[v] = true;
        dfs(v, id^1);
    }
}

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    for(int i=1; i<=m; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        maps[u].push_back(v);
        maps[v].push_back(u);
    }
    visit[1] = true;
    flag = true;
    num = 0;
    dfs(1, 0);
    if(!flag) {
        printf("%lld\n", (LL)n*(n-1)/2 - m);
    } else {
        printf("%lld\n", (LL)num*(n-num) - m);
    }
}






Measured memory_bytes: 6656
k = int(input())
n = 50
a = [0] * n
cnt = k // n
rest = k % n
for i in range(n):
	a[i] = cnt + i
for i in range(rest):
	for j in range(n):
		if i == j:
			a[j] += n
		else:
			a[j] -= 1
print(50)
print(*a)

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

using namespace std;
typedef long long ll;

#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
const ll N = 123456;

int a[N];

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

    int n;
    cin >> n;

    rep(i , 1 , n) cin >> a[i];

    if(n == 1) {
        cout << "Yes" << endl;
        return 0;
    }

    int maxi = a[1];
    rep(i , 2 , n) {
        if(maxi <= a[i]) {
            if(maxi <= a[i] - 1) {
                maxi = a[i] - 1;
            }
            else maxi = a[i];
        }
        else {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 640
def I(): return int(input())
N = I()
ans = 0
if N>=105:
    for i in range(105,N+1,2):
        count_yakusuu = 0
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                count_yakusuu += 2
        if count_yakusuu==8:
            ans += 1
print(ans)

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

#define x first
#define y second

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

ll N,x;
ll a[2000];
ll mins[2000];

int main() {
	cin >> N >> x;
	for (int c=0;c<N;c++) cin >> a[c];
	fill(mins,mins+N,INT_MAX);
	ll mc=LLONG_MAX;
	for (ll numshift=0,shifcost=0;numshift<N;numshift++,shifcost+=x) {
		for (int c=0;c<N;c++) mins[(numshift+c)%N]=min(mins[(numshift+c)%N],a[c]);
		mc=min(mc,accumulate(mins,mins+N,0ll)+shifcost);
	}
	cout << mc << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<cmath>
#include<cstdio>
#include<set>
#include<map>
#include<iomanip>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++) 
#define lint long long
#define all(x) (x).begin(), (x).end()

int n;
int h[100];

int flower(int l, int r){
    bool allpos = true; bool all0 = true;
    int x;
    for(int i = l; i<r; i++){
        if(h[i] != 0) all0 = false;
        if(h[i] == 0) {allpos = false; x = i; }
    }

    if(all0){
        return 0;
    }
    else if(allpos){
        for(int i = l; i<r; i++) h[i]--;
        return flower(l, r)+1;
    }
    else{
        return flower(l, x) + flower(x+1, r);
    }
}

int main(){
    cin>>n;
    rep(i,n) cin>>h[i];
    int res = flower(0, n);
    cout<<res<<endl;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
int Palin(string str)
{
    int n=str.size();
    for(int i=0;i<n;i++)
    {
        if(str[i]!=str[n-1-i])
        {
            return 0;
        }
    }
    return 1;
}
signed main()
{
    SPEED;
    string str,s1,s2;
    cin>>str;
    int n=str.size();
    s1=str.substr(0,n/2);
    s2=str.substr(n/2+1,n/2);
    int sum=0;
    sum+=Palin(str)+Palin(s1)+Palin(s2);
    if(sum==3)
    cout<<"Yes";
    else
    cout<<"No";
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>

#include<vector>
#include<string>

#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
const ll INF = 1e12+1;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}

int n;

int cnt[50][30];
string S[50];
char res[51];

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> S[i];

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < S[i].length(); j++) {
            cnt[i][S[i][j]-'a']++;
        }
    }
    int index = 0;
    for (int i = 0; i < 26; i++) {
        int c = cnt[0][i];
        for (int k = 1; k < n; k++) {
            chmin(c,cnt[k][i]);
        }
        for (int k = index; k < index+c; k++) {
            res[k] = 'a' + i;
        }
        index += c;
    }
    cout << res << endl;

    
}

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

int main() {
    int n; cin >> n;
    int ans = 1e9;
    for (int i = 0; i < n; ++i) {
        int a; cin >> a;
        int cnt = 0;
        while (a % 2 == 0) {
            a /= 2;
            cnt++;
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define in inline
#define int long long
#define re register
using namespace std;
in int read() {
	re int t=0;
	re char v=getchar();
	while(v<'0'||v>'9')v=getchar();
	while(v>='0'&&v<='9') {
		t=(t<<3)+(t<<1)+(v^48);
		v=getchar();
	}
	return t;
}
int n,m,ans[100002],A,B,C,dp[100002][3][3][3],pre[100002][3][3][3];
char s[12];
long long sum;
inline void work(re int x,re int a,re int b,re int c){
	if(x==0)return;
	re int xx=pre[x][a][b][c];
	if(xx==1)++a,--b;
	if(xx==2)--a,++b;
	if(xx==3)++a,--c;
	if(xx==4)--a,++c;
	if(xx==5)++b,--c;
	if(xx==6)--b,++c;
	work(x-1,a,b,c);
	if(xx==2||xx==4)puts("A");
	if(xx==1||xx==6)puts("B");
	if(xx==3||xx==5)puts("C");
}
signed main(){
	n=read();A=read();B=read();C=read();
//	if(A+B+C==2ll)return 1;
	if(A+B+C!=2ll){
		for(re int i=1;i<=n;++i){
			scanf("%s",s+1);
			if(s[1]=='A'&&s[2]=='B'){
				if(A>B){--A;++B;ans[i]=2;
				}
				else{
					if(B==0){
						puts("No");
						return 0;
					}
					--B;++A;
					ans[i]=1;
				}
			}
			if(s[1]=='A'&&s[2]=='C'){
				if(A>C){
					--A;++C;
					ans[i]=3;
				}
				else{
					if(C==0){
						puts("No");
						return 0;
					}
					--C;++A;
					ans[i]=1;
				}
			}
			if(s[1]=='B'&&s[2]=='C'){
				if(B>C){
					--B;++C;
					ans[i]=3;
				}
				else{
					if(C==0){
						puts("No");
						return 0;
					}
					--C;++B;
					ans[i]=2;
				}
			}
		}
		puts("Yes");
		for(re int i=1;i<=n;++i){
			if(ans[i]==1)puts("A");
			if(ans[i]==2)puts("B");
			if(ans[i]==3)puts("C");
		}
	}
	else{
		dp[0][A][B][C]=1;
		for(re int ii=1;ii<=n;++ii){
			scanf("%s",s+1);
			if(s[1]=='A'&&s[2]=='B'){
				for(re int i=0;i<=1;++i){
					for(re int j=1;j<=2;++j){
						for(re int k=0;k<=2;++k){
							if(dp[ii-1][i+1][j-1][k]){
								dp[ii][i][j][k]=1;
								pre[ii][i][j][k]=1;
							}
						}
					}
				}
				for(re int i=1;i<=2;++i){
					for(re int j=0;j<=1;++j){
						for(re int k=0;k<=2;++k){
							if(dp[ii-1][i-1][j+1][k]){
								dp[ii][i][j][k]=1;
								pre[ii][i][j][k]=2;
							}
						}
					}
				}
			}
			if(s[1]=='A'&&s[2]=='C'){
				for(re int i=0;i<=1;++i){
					for(re int j=0;j<=2;++j){
						for(re int k=1;k<=2;++k){
							if(dp[ii-1][i+1][j][k-1]){
								dp[ii][i][j][k]=1;
								pre[ii][i][j][k]=3;
							}
						}
					}
				}
				for(re int i=1;i<=2;++i){
					for(re int j=0;j<=2;++j){
						for(re int k=0;k<=1;++k){
							if(dp[ii-1][i-1][j][k+1]){
								dp[ii][i][j][k]=1;
								pre[ii][i][j][k]=4;
							}
						}
					}
				}
			}
			if(s[1]=='B'&&s[2]=='C'){
				for(re int i=0;i<=2;++i){
					for(re int j=0;j<=1;++j){
						for(re int k=1;k<=2;++k){
							if(dp[ii-1][i][j+1][k-1]){
								dp[ii][i][j][k]=1;
								pre[ii][i][j][k]=5;
							}
						}
					}}
				for(re int i=0;i<=2;++i){
					for(re int j=1;j<=2;++j){
						for(re int k=0;k<=1;++k){
							if(dp[ii-1][i][j-1][k+1]){
								dp[ii][i][j][k]=1;
								pre[ii][i][j][k]=6;
							}
						}
					}
				}
		}
		}
		for(re int i=0;i<=2;++i){
			for(re int j=0;j<=2;++j){
				for(re int k=0;k<=2;++k){
					if(dp[n][i][j][k]){
						puts("Yes");
						work(n,i,j,k);
						return 0;
					}
				}
			}
		}
		puts("No");
	}
}

Measured memory_bytes: 48976
#include <bits/stdc++.h>
#define rep(i,n) for(ll i = 0; i < (ll)(n); ++i)
#define MOD 1000000007

using namespace std;
using ll = long long;

int main() {
	int n, k;
	cin >> n >> k;
	vector<bool> snuke(n, false);
	int ans = n;
	rep(i, k) {
		int d;
		cin >> d;
		rep(j, d) {
			int a;
			cin >> a;
			a--;
			if (!snuke[a]) {
				ans--;
				snuke[a] = true;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

const int mod = 1e9+7;

void add(int &x,int y){
	x+=y;
	if(x>=mod)	x-=mod;
	if(x<0)		x+=mod;
}

int dp[3001][3001][2];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	dp[0][0][1]=1;
	for(int i=1;i<=n;i++)
		dp[0][i][0]=1;
	for(int i=0;i<m;i++)
		for(int j=0;j<=n;j++)
			for(int k=0;k<2;k++){
				// RR
				{
					int nk=k;
					if(j>=1){
						if(j==1)	nk|=1;
						add(dp[i+1][j-1][nk],dp[i][j][k]);
					}
				}
				// RB
				{
					int nk=k;
					if(j>=1){
						if(j==1)	nk|=1;
						add(dp[i+1][j][nk],dp[i][j][k]);
					}
				}
				// BB
				{
					if(j<n)
						add(dp[i+1][j+1][k],dp[i][j][k]);
				}
				// BR
				{
					if(j<n)
						add(dp[i+1][j][k],dp[i][j][k]);
				}
			}
	int ans=0;
	for(int i=0;i<=n;i++)
		add(ans,dp[m][i][1]);
	cout<<ans<<endl;
}


Measured memory_bytes: 70656
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
const int M = 1000000007;

int main() {
    int m, n;
    cin >> m;
    map<string, bitset<256>> mp;
    for (int i = 0; i < m; ++i) {
        string s;
        int l, r;
        cin >> s >> l >> r;
        bitset<256> bs;
        for (int j = l; j <= r; ++j)
            bs.set(j);

        mp[s] = bs;
    }
    for (int i = 0; i < 256; ++i) {
        bitset<256> bs;
        bs.set(i);
        mp[to_string(i)] = bs;
    }
    cin >> n;
    stack<bitset<256>> st;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        switch (s[0]) {
            case '+':
            case '-':
            case '*':
            case '/':
            {
                bitset<256> b = st.top();
                st.pop();
                if (s[0] == '/' && b[0]) {
                    puts("error");
                    return 0;
                }
                bitset<256> a = st.top();
                st.pop();
                bitset<256> bs;
                for (int i = 0; i < 256; ++i) {
                    if (!a[i]) continue;
                    for (int j = 0; j < 256; ++j) {
                        if (!b[j]) continue;
                        switch (s[0]) {
                            case '+':
                                bs.set((i + j) % 256);
                                break;
                            case '-':
                                bs.set((i - j + 256) % 256);
                                break;
                            case '*':
                                bs.set((i * j) % 256);
                                break;
                            case '/':
                                bs.set((i / j) % 256);
                                break;
                        }
                    }
                }
                st.push(bs);
                break;
            }
            default:
                st.push(mp[s]);
                break;
        }
    }
    puts("correct");
    return 0;
}

Measured memory_bytes: 3320
char tree1[301],tree2[301];
p1,p2,disp;
Skip(char*tree,int*pp){
	int h=0;
	do{
		if(tree[*pp]=='(')
			h++;
		if(tree[*pp]==')')
			h--;
		if(disp)
			putchar(tree[*pp]);
		++*pp;
	}while(h);
}
R(disp){
	if(tree1[p1]=='('&&tree2[p2]=='('){
		putchar('(');
		p1++,p2++;
		R();
		if(tree1[p1]!=','||tree2[p2]!=',')
			exit(puts("error','"));
		putchar(',');
		p1++,p2++;
		R();
		if(tree1[p1]!=')'||tree2[p2]!=')')
			exit(puts("error')'"));
		putchar(')');
		p1++,p2++;
	}else{
		if(tree1[p1]=='(')
			Skip(tree1,&p1);
		if(tree2[p2]=='(')
			Skip(tree2,&p2);
	}
}
main(){
	char ope[2];
	for(;~scanf("%s%s%s",ope,tree1,tree2);){
		p1=p2=0;
		disp=*ope=='u';
		R();
		puts("");
	}
	exit(0);
}

Measured memory_bytes: 0
import java.util.*;
import java.lang.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] input = new int[5];

		for(int i = 0; i < 5; i++){
			input[i] = sc.nextInt();
		}
		int k = sc.nextInt();

		for(int i = 0; i < input.length; i++){
			for(int j = i + 1; j < input.length; j++){
				if(input[j] - input[i] > k){
					System.out.println(":(");
					return;
				}
			}
		}
		System.out.println("Yay!");
	}
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=0;i<(n);i++)
string s[20];
int dis[20][20];
int ans=0,h,w;
struct Corr{
  int y;
  int x;
};
queue<Corr> q;

void reset(){
  REP(i,20) REP(j,20) dis[i][j]=-1;
}

int bfs(int y,int x){
  Corr start={y,x};q.push(start);dis[y][x]=0;
  
  while(!q.empty()){
    Corr now=q.front();q.pop();
    int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
    
    REP(i,4){
      Corr next={now.y+dy[i],now.x+dx[i]};
      if(next.x>=0&&next.x<w&&next.y>=0&&next.y<h
         &&s[next.y].at(next.x)=='.'&&dis[next.y][next.x]==-1){
        dis[next.y][next.x]=dis[now.y][now.x]+1;
        q.push(next);
        ans=max(ans,dis[next.y][next.x]);
      }
    }
  }
  
}

int main(){
  cin>>h>>w;
  REP(i,h) cin>>s[i];
  REP(i,h) REP(j,w){
    reset();
    if(s[i].at(j)=='.') bfs(i,j);
  }

  cout<<ans;
}

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

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {
  i64 N, i;
  cin >> N;
  vi a(N);
  i64 S = 0;
  REP(0, N, i) {
    cin >> a[i];
    S ^= a[i];
  }

  REP(0, N, i) {
    if(i != 0) {
      cout << " ";
    }
    cout << (a[i] ^ S);
  }
  cout << endl;
  
  return 0;
}


Measured memory_bytes: 4776
#include<bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	string s;
	cin>>s;
	if(s[0]==s[1] && s[1]==s[2]) cout<<"Yes";
	else if(s[1]==s[2] && s[2]==s[3]) cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 3652
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let _: String = input();
    let s: Vec<char> = input::<String>().chars().collect();
    let _: String = input();
    println!("A{}C", s[0]);
}


Measured memory_bytes: 4352
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"


int main(int argc, char const *argv[]) {
  int N;
  std::cin >> N;

  int flag = 0;
  for (size_t i = 0; i < 20; i++) {
    int amari = N - i * 7;

    if (amari > -1) {
      if (amari % 4 == 0) {
        flag = 1;
      }
    }

  }

  if (flag == 1) {
    std::cout << "Yes" << '\n';
  }else{
    std::cout << "No" << '\n';
  }
  return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

ll mod_pow(ll a,ll n){
  ll res=1;
  while(n>0){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll N,K;
ll dp[2001][2001];

int main(){
  cin>>N>>K;
  dp[0][0]=1;
  rep(i,K){
    ll sum=0;
    repl(j,1,N+1){
      (sum+=dp[i][j-1])%=mod;
      (dp[i+1][j]+=sum)%=mod;
      if(j>i&&j!=N){
        (dp[i+1][j]+=dp[i][j])%=mod;
      }
    }
  }
  cout<<dp[K][N]*mod_pow(2,N-K-1)%mod<<endl;
  return 0;
}


Measured memory_bytes: 31488
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N = I()
txy = []
for i in range(N):
    txy.append(LI())

txy = sorted(txy, key=lambda x:x[0])
#  print(txy)
count = 0
current = [0,0]
for item in txy:
    #  print(count, current)
    dist = abs(current[0] - item[1]) + abs(current[1] - item[2])
    if dist > item[0] - count:
        # 足らず
        print('No')
        exit()
    elif dist == item[0] - count:
        # ちょうど
        count = item[0]
        current = [item[1], item[2]]
    else:
        # 余り
        rest = item[0] - count - dist
        count = item[0]
        current = [item[1], item[2]]
        #  print('rest', rest)
        if rest % 2 != 0:
            # いけない
            print('No')
            exit()
print("Yes")




Measured memory_bytes: 25104
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
#include <list>
#include <queue>
#include <stack>

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> h(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	vector<vector<int>> g(n);
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		g[a-1].push_back(h[b-1]);
		g[b-1].push_back(h[a-1]);
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (g[i].size() == 0)ans++;
		else {
			bool tf = true;
			for (int j = 0; j < g[i].size(); j++) {
				if (h[i] <= g[i][j])tf = false;
			}
			if (tf)ans++;
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 8800
fun main(args: Array<String>) {
    var n = readLine()!!.toInt()
    var v = readLine()!!.split(" ").map(String::toInt)
    var c = readLine()!!.split(" ").map(String::toInt)
    var ans = 0

    for (bit in 0 until 1.shl(n)) {
        var f = 0
        for (i in 0 until n) {
            if (bit.shr(i).and(1) == 1) f += v[i] - c[i]
        }
        if (f > ans) ans = f
    }
    println(ans)
}

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

int main() {
    using namespace std;
    string s;
    cin >> s;
    size_t N{s.size()};
    vector<unsigned long> ans(N);
    for(unsigned long i = 0, e = 0, o = 0; i < N; ++i){
        if(s[i] == 'R'){
            swap(++o, e);
        }else{
            ans[i] += o;
            ans[i - 1] += e;
            e = o = 0;
        }
    }
    for(unsigned long i = N, e = 0, o = 0; i--;){
        if(s[i] == 'L'){
            swap(++o, e);
        }else{
            ans[i] += o;
            ans[i + 1] += e;
            e = o = 0;
        }
    }
    copy(ans.begin(), ans.end(), ostream_iterator<unsigned long>(cout, " "));
    return 0;
}

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

int main()
{
	int l,r,d,c=0;
	cin >> l >>  r >> d;
	for(int i=l;i<=r;i++)
	{
		if(i%d==0)
		{
			c++;
		}
	}
	
	cout << c;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    long double w, h, x, y; cin >> w >> h >> x >> y;
    cout << w * h / 2.0 << " " << (2 * x == w && 2 * y == h ? "1" : "0") << "\n";
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>
#include<limits.h>
#define MAX 100002
int abs(int a){
    if(a>0) return a;
    else return a*(-1);
}

int min(int a,int b){
    if(a>b) return b;
    else return a;
}

int main(){
    int N,K;
    scanf("%d %d",&N,&K);
    int h[MAX];
    for(int i=0;i<N;i++)
        scanf("%d",h+i);
    int DP[MAX];
    DP[0]=0;
    for(int i=1;i<N;i++){
        int m=INT_MAX;
        for(int j=1;j<=K && i-j>=0;j++)
            m = min(m,DP[i-j]+abs(h[i]-h[i-j]));
        DP[i] = m;
    }
    printf("%d",DP[N-1]);
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}

/*------------------------------------------------------------------*/


int main(){
    int n, m; cin >> n >> m;
    vector<int> a(m), b(m);
    rep(i, m){
        cin >> a[i] >> b[i];
        a[i]--, b[i]--;
    }
    vector<int> from_1(n, false);
    vector<int> to_n(n, false);
    rep(i, m){
        if(a[i] == 0) from_1[b[i]] = true;
        if(b[i] == n - 1) to_n[a[i]] = true;
    }
    rep(i, n){
        if(from_1[i] and to_n[i]){
            cout << "POSSIBLE" << endl;
            return 0; 
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0; 
}

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

int main() {
  int k;
  cin >> k;
  int cnt = 0;

  queue<ll> q;

  rep(i, 10) q.push(i);
  cnt = 0;

  while (! q.empty()) {
    cnt ++;
    ll x = q.front();
    q.pop();
    // cout << x << endl;
    if (cnt == k) {
      cout << x << endl;
      break;
    }

    for (int si = -1; si <= 1; si++) {
      ll xx = 10 * x + (x % 10) + si;
      if (x % 10 == 0 && si == -1) {
        continue;
      }
      if (x % 10 == 9 && si == 1) {
        continue;
      }
      q.push(xx);

    }
  }

  return 0;
}


Measured memory_bytes: 1792
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>
#include <stdio.h>
int main(){
  int n,m;scanf("%d %d",&n,&m);
  int ans[n];
  for(int i = 0; n > i; i++){
    ans[i] = -1;
  }
  for(int i = 0; m > i; i++){
    int a,b;scanf("%d %d",&a,&b);
    a--;
    if(!(ans[a] == -1 || ans[a] == b)){
      printf("-1");
      return 0;
    }
    ans[a] = b;
  }
  if(n==1 && ans[0] < 1){
    printf("0");
    return 0;
  }
  if(ans[0] == 0){
    printf("-1");
    return 0;
  }
  for(int i = 0; n > i; i++){
    
    if(!i){
      if(ans[i] != -1){
         printf("%d",(ans[i]));
      }else{
         printf("1");
      }
     
    }else{
      if(ans[i] != -1){
         printf("%d",(ans[i]));
      }else{
         printf("0");
      }
    }
  }printf("\n");
}


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

int main(){
    int n;
    cin >> n;
    vector<pii> x(n);
    rep(i,n){
        int a,b;
        cin >> a >> b;
        x[i].first = b;
        x[i].second = a;
    }
    int t = 0;
    sort(x.begin(),x.end());
    bool ok = true;
    rep(i,n){
        t += x[i].second;
        if(t > x[i].first)ok = false;
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 1792