akhauriyash/Code-Regression huggingface dataset:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007




n = I()
L = sorted(LI())
a = L[-1]
L = L[:-1]
l = bisect_left(L, a / 2)
if l < n - 1 and L[l] - a / 2 < a / 2 - L[l - 1]:
    print(a, L[l])
else:
    print(a, L[min(l - 1, n-2)])

Measured memory_bytes: 59632
/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define ll long long int
#define endl '\n'
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef queue<int> qii;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define all(x) x.begin(),x.end()
#define rep(i,k,n) for (int i = k; i < n; ++i) 
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i) 
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;

void solve(){
    int n;
    cin>>n;
    bool f=0;
    while(n){
        if(n%10==7){
            f=1;
            break;
        }
        n/=10;
    }
    cout<<(f?"Yes":"No");
}

int main(){ 
    // #ifndef ONLINE_JUDGE  
        // freopen("input.txt", "r", stdin); 
        // freopen("output.txt", "w", stdout); 
    // #endif 
    fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}


Measured memory_bytes: 3608
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

int A = 0, B = 0, K = 0, T = 0, W = 0, N = 0, H = 0;
int n = 0;
double L = 0;
double S = 0;
double ar = 0, br = 0, cr = 0;
int answer = 0;

string C;
string sA, strB;
vector<vector<char>> map;
vector<int> card;
vector<string> str;

int sum = 0;


void input() {

	while (true) {
		CI n;
		if (n == 0) {
			break;
		}
		card.push_back(n);
	}

	return;
}


int main(void) {
	int goo = 0;
	int choki = 0;
	int paa = 0;
	input();

	REP(i, card.size() / 5) {
		for (int j = (i * 5); j < (i * 5) + 5; j++) {
			switch (card[j]) {
			case 1:
				goo++;
				break;
			case 2:
				choki++;
				break;
			case 3:
				paa++;
				break;
			default:
				break;
			}
		}
		if ((goo > 0 && choki > 0 && paa > 0) || goo == 5 || paa == 5 || choki == 5) {
			REP(j, 5)CO 3 E
		}
		else {
			if (goo > 0 && choki > 0 && paa <= 0) {
				for (int j = i * 5; j < (i * 5) + 5; j++) {
					switch (card[j]) {
					case 1:
						CO 1 E
							break;
					case 2:
						CO 2 E
							break;
					default:
						break;
					}
				}
			}
			if (goo <= 0 && choki > 0 && paa > 0) {
				for (int j = i * 5; j < (i * 5) + 5; j++) {
					switch (card[j]) {
					case 1:
						break;
					case 2:
						CO 1 E
							break;
					case 3:
						CO 2 E
							break;
					default:
						break;
					}
				}
			}
			if (goo > 0 && choki <= 0 && paa > 0) {
				for (int j = i * 5; j < (i * 5) + 5; j++) {
					switch (card[j]) {
					case 1:
						CO 2 E
						break;
					case 2:
						break;
					case 3:
						CO 1 E
						break;
					default:
						break;
					}
				}
			}
			

		}
		goo = 0;
		choki = 0;
		paa = 0;
	}


	return 0;
}

Measured memory_bytes: 3152
import numpy as np 
N = int(input())
# N = 1000
# G = np.zeros((N,N),dtype = np.bool)

linked = [[] for i in range(N)]
pairs = []

for i in range(N-1):
    a,b = map(int,input().split())
    # a,b = 1,2
    pairs.append((a,b))
    linked[a-1].append(b-1)
    linked[b-1].append(a-1)

Cs = list(sorted(map(int,input().split()),reverse=True))
# Cs = [1 for i in range(N)]

# print(Cs)

links = np.array([0 for i in range(N)])

for i in range(N):
    links[i] = len(linked[i])

# minag = np.argmin(links)
nodeval = np.array([0 for i in range(N)])

stack = [1]

visited = [False for i in range(N)]

while(len(stack)>0):
    minag = stack.pop()
    nodeval[minag] = Cs.pop(0)
    for l in linked[minag]:
        if not visited[l]:
            stack.append(l)
    visited[minag] = True
    # print(nodeval)

sumval=0
for p in pairs:
    sumval += min(nodeval[p[0]-1], nodeval[p[1]-1] )

print(sumval)
for i,l in enumerate(nodeval):
    print(l,end=" " if i!=N-1 else "\n")


Measured memory_bytes: 16228
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,i,sum=0,s=0,min=12345,j,t,d;
	cin>>n;
	long long a[n];
	for(i=0;i<n;i++)
	{
	cin>>a[i];
	s+=a[i];
	}
	for(i=0;i<n;i++)
	{
		sum=0;
		t=i;
		for(j=0;j<n;j++)
		{
			if(j<=t)
			{
				sum+=a[j];
			}
		}
		d=abs(s-sum-sum);
		if(min>d)
		min=d;
	}
	cout<<min<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)

#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))

#define endl "\n"
#define pb push_back
#define rtn return
#define elif else if

#define MOD 1000000007
 
const int dx_4[]={1,0,-1,0}, dy_4[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};

typedef long long ll;
typedef unsigned long long ull;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	int n, m, d[200000], t[200000];
	cin >> n;
	REP(i, n) cin >> d[i];
	cin >> m;
	REP(i, m) cin >> t[i];

	map<int, int> mpa, mpb;

	REP(i, n) mpa[d[i]]++;
	REP(i, m) mpb[t[i]]++;

	REP(i, m){
		if(mpa[t[i]] < mpb[t[i]]){
			cout << "NO" << endl;
			rtn 0;
		}
	}
	cout << "YES" << endl;

	rtn 0;
}

Measured memory_bytes: 22656
#include <iostream>
#include <bits/stdc++.h>
#include<math.h>
using namespace std;
long  long  x,sum,cnt;
int main()
{
     cin>>x;
sum=100;
   while(sum<x)
{
      sum=sum+(sum/100);
    cnt++;
}
cout<<cnt<<endl;
     return 0;
}

Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastReader fastReader = new FastReader();
        double D = fastReader.nextInt();
        double T = fastReader.nextInt();
        double S = fastReader.nextInt();

        if(D / S <= T ) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

    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: 32892
import itertools

s = input()
x,y = map(int,input().split())
d = [len(fs) for fs in s.split('T')]
x -= d[0]
dx = d[2::2]
dy = d[1::2]

def check(d,x):
    set_ = set([0])
    for dx in d:
        set_ = {a+b for a,b in itertools.product(set_,[dx,-dx])}
    return x in set_
if check(dx,x) and check(dy,y):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3752
n=int(input())
m=list(map(int,input().split()))
m.sort()
m=m[::-1]
ans=0

for i in range(n-1):
  ans+=m[i]*(0.5)**(i+1)
  
ans+=m[n-1]*0.5**(n-1)
  
print(ans)




Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstdio>
using namespace std;

int a[200010];

int main(void)
{
    int N, K;
    cin >> N >> K;
    
    for(int i = 0; i < N; i++)
    {
        int x;
        cin >> x;
        a[x-1]++;
    }

    sort(a, a+N);

    int sum = 0;
    
    for(int i = 0; i < (N - K); i++) sum += a[i];

    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

bool first_win(int N, const vector<vector<int>> &Es) {
    vector<int> visited(N, 0);
    visited[0] = 1;
    visited[N - 1] = -1;
    vector<int> f1{0};
    vector<int> fN{N - 1};
    vector<int> new_f1;
    vector<int> new_fN;
    while (not (f1.empty() and fN.empty())){
        new_f1.clear();
        for (auto v : f1){
            for (u : Es[v]){
                if (visited[u] != 0) continue;
                visited[u] = 1;
                new_f1.push_back(u);
            }
        }
        new_fN.clear();
        for (auto v : fN){
            for (u : Es[v]){
                if (visited[u] != 0) continue;
                visited[u] = -1;
                new_fN.push_back(u);
            }
        }
        swap(f1, new_f1);
        swap(fN, new_fN);
    }
    return accumulate(visited.begin(), visited.end(), 0) > 0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<vector<int>> Es(N, vector<int>());
    for (int i = 0; i < N - 1; ++i){
        int a, b;
        cin >> a >> b;
        Es[a - 1].push_back(b - 1);
        Es[b - 1].push_back(a - 1);
    }
    if (first_win(N, Es)){
        cout << "Fennec" << endl;
    }else{
        cout << "Snuke" << endl;
    }
    return 0;
}

Measured memory_bytes: 6400
#include <iostream>
#include <string>
#include <cstring>

using namespace std;

int dx[4] = {0,-1,0,1};
int dy[4] = {1,0,-1,0};

int main(){
	int n;
	cin >> n;
	while(n--){
		int h,w;
		cin >> h >> w;
		int field[h][w]; //0:plain 1:stone 2:steel 3.water
		string str;
		string ope;
		pair<int,int> pos; //position of a tank
		int dir; //direction of a tank
		
		//read data
		for(int i=0;i<h;i++){
			cin >> str;
			for(int j=0;j<w;j++){
				if(str[j] == '.'){
					field[i][j] = 0;
				}else if(str[j] == '*'){
					field[i][j] = 1;
				}else if(str[j] == '#'){
					field[i][j] = 2;
				}else if(str[j] == '-'){
					field[i][j] = 3;
				}else{
					pos.first = i;
					pos.second = j;
					field[i][j] = 0;
					if(str[j] == '>'){
						dir = 0;
					}else if(str[j] == '^'){
						dir = 1;
					}else if(str[j] == '<'){
						dir = 2;
					}else{
						dir = 3;
					}
				}
			}
		}
		
		//operate
		int num;
		cin >> num;
		cin >> ope;
		for(int i=0;i<ope.size();i++){
			if(ope[i] == 'R'){
				dir = 0;
				if(pos.second + 1 < w && field[pos.first][pos.second+1] == 0){
					pos.second++;
				}
			}else if(ope[i] == 'U'){
				dir = 1;
				if(0 <= pos.first - 1 && field[pos.first-1][pos.second] == 0){
					pos.first--;
				}
			}else if(ope[i] == 'L'){
				dir = 2;
				if(0 <= pos.second - 1 && field[pos.first][pos.second-1] == 0){
					pos.second--;
				}
			}else if(ope[i] == 'D'){
				dir = 3;
				if(pos.first + 1 < h && field[pos.first+1][pos.second] == 0){
					pos.first++;
				}
			}else{
				int x = pos.first, y = pos.second;
				while(1){
					x += dx[dir];
					y += dy[dir];
					if(0 <= x && x < h && 0 <= y && y < w){
						if(field[x][y] == 1){
							field[x][y] = 0;
							break;
						}else if(field[x][y] == 2){
							break;
						}
					}else{
						break;
					}
				}
			}
		}
		
		//result
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if(i == pos.first && j == pos.second){
					if(dir == 0){
						cout << ">";
					}else if(dir == 1){
						cout << "^";
					}else if(dir == 2){
						cout << "<";
					}else{
						cout << "v";
					}
				}else{
					if(field[i][j] == 0){
						cout << ".";
					}else if(field[i][j] == 1){
						cout << "*";
					}else if(field[i][j] == 2){
						cout << "#";
					}else{
						cout << "-";
					}
				}
			}
			cout << endl;
		}
		if(n) cout << endl;
	}
}

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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) if((x)>(y))(x)=(y)
#define chmax(x,y) if((x)<(y))(x)=(y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, a[100100], r, dm = INT_MAX;

signed main() {
	cin >> n;
	rep(i,n) cin >> a[i];
	sort(a,a+n);
	cout << a[n-1] << ' ';
	rep(i,n-1) {
		int d = abs(a[n-1] - a[i]*2);
		if (d<dm) dm = d, r = a[i];
	}
	cout << r << ln;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)


struct st{int x,y,w;};
map<pii,int> mp;


int solve(int y,int x){
	int sum = 0;
	rep(i,2){
		rep(j,2){
			if(mp.count(pii(y+i,x+j))!=0){
				sum+=mp[pii(y+i,x+j)];
			}
		}
	}
	return sum;
}

int main(){
	int n;
	cin>>n;
	rep(i,n){
		int a,b,c;
		cin>>a>>b>>c;
		mp[pii(a,b)]=c;
	}
	
	int ans = -1;
	int dy[]={0,-1,0,-1};
	int dx[]={0,-1,-1,0};
	
	for(auto &elm:mp){
		int y,x;
		tie(y,x) = elm.first;
		rep(j,4){
			int ddy = y+dy[j];
			int ddx = x+dx[j];
			ans = max(ans,solve(ddy,ddx));
		}
	}
	
	cout<<ans<<" / 1"<<endl;
}

Measured memory_bytes: 9336
<?php
define('MOD', 10**9+7);

//error_reporting(0);
//$N = trim(fgets(STDIN));
list($n,$a,$b) = explode(" ",trim(fgets(STDIN)));
//$X = array_map('intval',explode(" ",trim(fgets(STDIN))));
//function chmax(&$a,$b) {if ($a<$b){$a=$b;return true;}return false;}
//function chmix(&$a,$b) {if ($a>$b){$a=$b;return true;}return false;}
//

$t = powerm(2,$n)-1;
$nca = nCm($n,$a);
$ncb = nCm($n,$b);

printf("%d\n",subm(subm($t,$nca),$ncb));

//https://atcoder.jp/contests/abc145/submissions/8474723

define('MOD', 10**9+7);

//足し算
function addm($a, $b){
    return ($a + $b) % MOD;
}
//引き算
function subm($a, $b){
    return ($a + MOD - $b) % MOD;
}
//掛け算
function mulm($a, $b){
    return ($a * $b) % MOD;
}
//割り算
function divm($a, $b){
    return mulm($a, powerm($b, MOD - 2));
}
//累乗
function powerm($a, $b){
    if($b == 0)return 1;
    if($b & 1)return (powerm($a, $b>>1)**2 % MOD) * $a % MOD;
    return powerm($a, $b>>1)**2 % MOD;
}
//階乗
function factorialm($a){
    if($a == 0)return 1;
    return factorialm($a - 1) * $a % MOD;
}
//順列
function nPm($n, $m){
    if($m == 0)return 1;
    return nPm($n, $m - 1) * ($n - $m + 1) % MOD;
}
//組み合わせ
function nCm($n, $m){
    $m = min($m, $n-$m);
    return divm(nPm($n, $m), factorialm($m));
}



Measured memory_bytes: 61944
#include <cstdio>
int k=38,n=k*k-k+1;
int f[40][41];
int main(){
	printf("%d %d\n",n,k);
	for (int j=1;j<=k;j++){
		printf("%d ",n);
		for (int i=1;i<k-1;i++){
			f[i][j]=(j-1)*(k-1)+i;
			printf("%d ",f[i][j]);
		}
		f[k-1][j]=j*(k-1);
		printf("%d\n",f[k-1][j]);
	}
	for (int i=1;i<k;i++){
		for (int l=1;l<k;l++){ 
		int h=l;
		for (int j=1;j<k;j++){
			printf("%d ",f[h][j]);
			h=(h+i-2) % (k-1)+1;
		}
		printf("%d\n",n+i-k);} 
	}	
}

Measured memory_bytes: 384
C = input()

alphabet_list = ['a','b','c','d','e','f','g','h','i',
                 'j','k','l','m','n','o','p','q','r',
                 's','t','u','v','w','x','y','z']

num = alphabet_list.index(C)

print(alphabet_list[num+1])

Measured memory_bytes: 3060
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>

#define lint long long
#define VI vector<int>
#define VL vector<lint>
#define VC vector<char>
#define VVI vector<vector<int>>
#define rep(i, n) for(int i = 0 ; i < n ; i++)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c.begin(), c.end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX

using namespace std;

int main(){
    string s;
    cin >> s;
    int w;
    cin >> w;
    for(int i = 0 ; i < s.size() ; i += w){
        cout << s[i];
    }
    cout << endl;
    return 0;
}

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


int main() {
	string s = "2019/04/30";
	string S;
	cin >> S;
	if(S <= s) {
		cout << "Heisei" << endl;
	}else {
		cout << "TBD" << endl;
	}
	return 0;
}


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

namespace ABC
{
    class ProgramC
    {
        static void Main(string[] args)
        {
            var num = new int[3];
            var inputs = Console.ReadLine().Split(" ");
            num[0] = int.Parse(inputs[0]);
            num[1] = int.Parse(inputs[1]);
            num[2] = int.Parse(inputs[2]);

            var result = 0;

            while (true)
            {
                if (num[0] == num[1] && num[0] == num[2])
                {
                    Console.WriteLine(result);
                    return;
                }

                result++;

                var min = num.Min();
                var minCount = num.Count(x => x == min);

                for (var i = 0; i < 3; i++)
                {
                    if (num[i] == min)
                    {
                        num[i] += minCount == 1 ? 2 : 1;
                    }
                }
            }

        }
    }
}


Measured memory_bytes: 27960
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<P> v(n);
    map<P, int> m;
    for(int i=0; i<n; ++i) {
        int x, y, w;
        cin >> x >> y >> w;
        auto p = make_pair(x, y);
        v[i] = p;
        m[p] = w;
    }
    int res = 0;
    sort(v.begin(), v.end());
    for(int i=0; i<v.size(); ++i) {
        int dx[4] = {0, 0, 1, 1},
            dy[4] = {0, 1, 0, 1};
        int cand = 0, cand2 = 0;
        for(int j=0; j<4; ++j) {
            cand += m[make_pair(v[i].first+dx[j], v[i].second+dy[j])];
            cand2 += m[make_pair(v[i].first+dx[j], v[i].second-dy[j])];
        }
        res = max(res, cand);
        res = max(res, cand2);
    }
    cout << res << " / 1" << endl;
}


Measured memory_bytes: 41072
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <sstream>
using namespace std;
typedef long long ll;
ll b,ka,t,w,ki,y,m,d;
int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
bool uru(ll num){
	if(num%4)return false;
	else if(num%100)return true;
	else if(num%400)return false;
	else return true;
}
void num_to_s(ll num){
	y=2012;
	m=d=0;
	if(num<=10){
		m=12;
		d=21+num;
	}else{
		num-=10;
		while(num>0){
			y++;
			if(uru(y))num-=366;
			else num-=365;
		}
		if(uru(y)){
			num+=366;
			month[1]=29;
		}else{
			num+=365;
		}
		int k;
		for(k=0;num>0;k++){
			num-=month[k];
		}
		k--;
		m=k+1;
		d=num+month[k];
	}
	cout<<y<<"."<<m<<"."<<d<<endl;
	month[1]=28;
	return;
}
void num_to_m(ll num){
	b=ka=t=w=ki=0;
	ki=num%20;
	num/=20;
	w=num%18;
	num/=18;
	t=num%20;
	num/=20;
	ka=num%20;
	num/=20;
	b=num%13;
	cout<<b<<"."<<ka<<"."<<t<<"."<<w<<"."<<ki<<endl;
	return;
}

int main()
{
	string tmp;
	while(cin>>tmp){
		stringstream ss;
		y=m=d=0;
		b=ka=t=w=ki=0;
		int p1=tmp.find('.');
		int p2=tmp.find('.',p1+1);
		int p3=tmp.find('.',p2+1);
		int p4=tmp.find('.',p3+1);
		tmp[p1]=tmp[p2]=' ';
		if(tmp=="#"){
			break;
		}else if(p1>=4){//seireki
			ss.str(tmp);
			ss>>y>>m>>d;
			//cout<<y<<"."<<m<<"."<<d<<endl;
			ll num=0,num2=0;
			y--;
			if(y==2011){
				num=d-21;
			}else{
				num=(y-2012)*365+y/4-y/100+y/400;
				num-=2012/4-2012/100+2012/400;
				for(int i=1;i<m;i++){
					num2+=month[i-1];
				}
				num2+=d+10;
				if(uru(++y)&&m>=3)num2++;
			}
			num_to_m(num+num2);
		}else{//mayareki
			tmp[p3]=tmp[p4]=' ';
			ss.str(tmp);
			ss>>b>>ka>>t>>w>>ki;
			//cout<<b<<"."<<ka<<"."<<t<<"."<<w<<"."<<ki<<endl;
			ka+=b*20;
			t+=ka*20;
			w+=t*18;
			ki+=w*20;
			num_to_s(ki);
		}
	}
	return 0;
}

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

int main(){
    int A,B,C;
    cin >> A >> B >> C;
    int distance = A - B;
    int ans = C - distance;

    if(ans < 0)cout << 0 << endl;
    else cout << ans << endl;

    return 0;
}


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

struct UnionFind {
  vector<int> data;
  
  UnionFind(int sz){
    data.assign(sz, -1);
  }
  
  bool unite(int x, int y){
    x = root(x), y = root(y);
    if(x == y) return false;
    if(data[x] > data[y]) swap(x, y); //rank?
    data[x] += data[y];
    data[y] = x;
    return true;
  }
  
  int root(int x){
    if(data[x] < 0) return x;
    return data[x] = root(data[x]); //経路圧縮
  }
  
  bool same(int x, int y){
    return root(x) == root(y);
  }
  
  int size(int x){
    return (-data[root(x)]);
  }
};

int n, m, k;
vector<int> num_of_friends(101010, 0);
vector<vector<int>> blocks(101010, vector<int>(0));

int main(){
  cin >> n >> m >> k;
  UnionFind uf(n + 1);
  
  rep(i, m){
    int a, b;
    cin >> a >> b;
    num_of_friends[a]++;
    num_of_friends[b]++;
    uf.unite(a, b);
  }
  
  rep(i, k){
    int c, d;
    cin >> c >> d;
    blocks[c].push_back(d);
    blocks[d].push_back(c);
  }
  
  for(int i = 1; i <= n; i++){
    int res = uf.size(i) - 1;
    res -= num_of_friends[i];
    for(int x : blocks[i]){
      if(uf.same(i, x))
        res--;
    }
    cout << res << ((i == n)? "\n" : " ");
  }
  
  return 0;
}

Measured memory_bytes: 6784
#include <cstdio>
#include <iostream>
#include <deque>
#include <algorithm>
using namespace std;

int main(){
  int n; cin >> n;
  string s[300];
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  deque<int> v[2*n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      v[i].push_back(s[i][j]-'a');
      v[i+n].push_back(s[i][j]-'a');
    }
    for (int j = 0; j < n; j++) {
      v[i].push_back(s[i][j]-'a');
      v[i+n].push_back(s[i][j]-'a');
    }
  }
  /*
  for (int i = 0; i < 2*n; i++) {
    for (int j = 0; j < 2*n; j++) {
      cout << "\t" << v[i][j];
    }
    cout << "\n";
  }
  */
  long long count = 0;
  for (int i = 0; i < n; i++) {
    bool frag = true;
    for (int j = 0; j < n; j++) {
      if (!frag) break;
      for (int k = 0; k < n; k++) {
        if (v[i+j][k] != v[i+k][j]) {
          frag = false;
          break;
        }
      }
      if (j == n-1 && frag) {
        count++;
      }
    }
  }
  cout << count * n << endl;
  return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <cmath>
#include <cstdio>
#include <stack>
#include <queue>
#include <vector>
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

int main(){
    ll n,k;
    cin>>n>>k;
    ll h[n];
    ll ans=0;
    ll sum=0;
    for(ll i=0;i<n;++i){
        cin>>h[i];
        sum+=h[i];
    }

    sort(h,h+n);

    for(ll i=0;i<k;++i){
        if(k==0){
            cout<<sum<<endl;
            break;
        }else if(k>=n){
            cout<<0<<endl;
            break;
        }else{
            sum-=h[n-i-1];
        }
    }
    if(k!=0 and k<n){
        cout<<sum<<endl;
    }else if(k==0){
        cout<<sum<<endl;
    }
}

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


int main(){
	string s;
	cin >> s;
	if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3] || s[3] == s[4])cout << "Bad" << endl;
	else cout << "Good" << endl;	
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl
#define show2(a, n, m) rep(i, n) { rep(j, m) {cout << a[i][j] << ' ';} cout << endl;} 
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef long double ld;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

typedef vector<string> vs;
typedef vector<vs> vvs;

void chmaxs(string& s, string& t) {
	if(s.size() < t.size()) s = t;
}

int main() {
//	cout << fixed << setprecision(15);
	string s, t;
	cin >> s >> t;
	int n = s.size(), m = t.size();
	vvs dp(2, vs(m+1));
	rep(i, n) rep(j, m) {
		int prev = i % 2, next = 1 - prev;
		chmaxs(dp[next][j+1], dp[prev][j+1]);
		chmaxs(dp[next][j+1], dp[next][j]);
		if(s[i] == t[j]) {
			string u = dp[prev][j] + s[i];
			chmaxs(dp[next][j+1], u);
		}
	}
	cout << dp[n % 2][m] << endl;
}


Measured memory_bytes: 8576
/*  -*- coding: utf-8 -*-
 *
 * 2831.cc: Check answers
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;

/* typedef */

/* global variables */

char s[MAX_N + 4];

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d%s", &n, s);

  char pc = s[0];
  int k = 1;
  for (; k < n; k++) {
    if (pc == 'x' && s[k] == 'x') break;
    pc = s[k];
  }

  printf("%d\n", k);
  return 0;
}



Measured memory_bytes: 3328
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

#define int long long
#define endl "\n"
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}

int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}



signed main() {
	int n, k, a, b;
	cin >> n >> k;
	a = n % k;
	b = -1 * (n % k - k);
	cout << min(a, b) << endl;
}


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

int compare_int(const void *a, const void *b) {
    return *(int*)a - *(int*)b;
}

int main() {
	int N, K;
	scanf("%d %d",&N,&K);
	int hight[N];
	for (int i = 0; i < N; i++) {
		scanf("%d",&hight[i]);
	}
	qsort(hight, N, sizeof(int), compare_int);
	int tmp = 0;
	for (tmp = 0; tmp < N; tmp++) {
		if (hight[tmp] >= K) break;
	}
	printf("%d\n",N - tmp);
	return 0;
}

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

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

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main()
{
    int n;
    cin >> n;
    vector<ll> vll(n);
    REP(i, n)
    cin >> vll[i];
    int q;
    cin >> q;
    vector<pair<ll, ll>> vq(q);
    REP(i, q)
    cin >> vq[i].first >> vq[i].second;
    ll ans = 0;
    vector<int> cnt(100001);
    REP(i, n)
    {
        ans += vll[i];
        cnt[vll[i]]++;
    }
    REP(i, q)
    {
        ans += (vq[i].second - vq[i].first) * cnt[vq[i].first];
        cnt[vq[i].second] += cnt[vq[i].first];
        cnt[vq[i].first] = 0;
        cout << ans << endl;
    }
}

Measured memory_bytes: 5892
import java.util.Scanner;

//Puzzle
public class Main{

	static boolean enable(int[] c){
		for(int i=1;i<=9;i++){
			if(c[i]>=2){
				c[i]-=2;
				if(solve(c, 1))return true;
				c[i]+=2;
			}
		}
		return false;
	}
	
	static boolean solve(int[] c, int k){
		if(k==10)return true;
		if(c[k]==0)return solve(c, k+1);
		if(c[k]>=3){
			c[k]-=3;
			if(solve(c, k))return true;
			c[k]+=3;
		}
		if(k>=8)return false;
		boolean f = true;
		for(int i=k;i<k+3;i++){
			if(c[i]==0)f = false;
		}
		if(!f)return false;
		for(int i=k;i<k+3;i++){
			c[i]--;
		}
		if(solve(c, k))return true;
		for(int i=k;i<k+3;i++){
			c[i]++;
		}
		return false;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			char[] s = sc.next().toCharArray();
			int[] count = new int[10];
			for(char ch : s)count[ch-'0']++;
			String r = "0";
			for(int i=1;i<=9;i++){
				int[] c = new int[10];
				for(int j=1;j<=9;j++)c[j]=count[j];
				c[i]++;
				if(c[i]==5){
					c[i]--;
					continue;
				}
				if(enable(c)){
					if(r.equals("0"))r = i+"";
					else r += " "+i;
				}
				c[i]--;
			}
			System.out.println(r);
		}
	}
}

Measured memory_bytes: 12000
// https://atcoder.jp/contests/abc091/tasks/abc091_a

#include <iostream>
using namespace std;

int main()
{
  /* Magic word */
  cin.tie(0);
  ios::sync_with_stdio(false);
  /* ---------- */

  int a, b, c;
  string r;

  cin >> a >> b >> c;

  r = a + b < c ? "No" : "Yes";

  cout << r << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int arr[10001] = {0};
    int m =  min(n,99);
    for(int i = 1 ; i <= m ; i++)
    {
        for(int j = 1 ; j <= m ;j++)
        {
            for(int z = 1 ; z <= m ;z++)
            {
                if(i*i+j*j+z*z+i*j+i*z+j*z <= 10000)
                    arr[i*i+j*j+z*z+i*j+i*z+j*z]++;
            }
        }
    }
    for(int  i = 1 ; i <= n ; i++)
    {
        cout<<arr[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3592
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int n,hoge;
    cin>>n>>hoge;; rep(i,n)cin.ignore();
    cout<<n-hoge-1<<endl;
}

Measured memory_bytes: 3108
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <cctype>
#include <fstream>
#include <cstring>
#include <unordered_map>

using namespace std;

#define ll long long
#define MOD 1000000007
#define INF 2000000000
#define LINF 9000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define du(x) cout<<#x<<'='<<x<<endl
#define du2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define du3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl
#define ddarr(arr,a,b) rep(i,a){rep(j,b){cout<<*(arr+i*b+j)<<' ';}cout<<endl;}
#define ddd ifstream in("Text.txt");cin.rdbuf(in.rdbuf());

vector<ll>A;
ll b[100010], c[100010];
pair<ll, ll> pa[100010];

int main() {
    int N, M;
    cin >> N >> M;
    rep(i, N) {
        ll a;
        cin >> a;
        A.push_back(a);
    }
    rep(i, M) {
        cin >> b[i] >> c[i];
        pa[i] = make_pair(c[i], b[i]);
    }
    sort(A.begin(), A.end());
    sort(pa, pa + M);
    reverse(pa, pa + M);

    int cnt = 0;
    rep(i, M) {
        rep(j, pa[i].second) {
            if (cnt == N)goto end;
            A.push_back(pa[i].first);

            cnt++;
        }
    }
end:

    sort(A.begin(), A.end());
    A.erase(A.begin(), A.begin() + cnt);
    ll ans = 0;
    rep(i, N)ans += A[i];

    cout << ans << endl;
}

Measured memory_bytes: 5492
#include <stdio.h>
#include <string.h>

int main(void) {
  int i, j, n;
  scanf("%d", &n);
  char s[n + 10], t[n + 10];
  scanf("%s%s", s, t);
  for(i = 0; i < n; ++i) {
    bool b = true;
    for(j = 0; i + j < n; ++j) if(s[i + j] != t[j]) b = false;
    if(b) {
      printf("%d", n + i);
      return 0;
    }
  }
  printf("%d", 2 * n);
  return 0;
}

Measured memory_bytes: 128
<?php

// 標準入力（STDIN）から1行読み込み（fgets）をしてinputに代入します
$input = fgets(STDIN);  // $input = "1 2 3 4 5"

// 取得した値を半角スペースで分解します（PHPのsplit的な関数） とりあえずこれで十分扱えます!
$input_array = explode(" ", $input); // $input_array = [ "1" , "2" , "3" , "4" , "5"]

$time = $input_array[1];
$time2 = $input_array[0] / $input_array[2];

if($time >= $time2) {
  echo "Yes";
} elseif($time < $time2) {
  echo "No";
}

?>

Measured memory_bytes: 16200
n,t = map(int,input().split())
dp = [[0]*(t) for i in range(n+1)]
ab = [list(map(int,input().split()))for i in range(n)]
ab.sort()
ans = 0
for i in range(n):
    a = ab[i][0]
    b = ab[i][1]
    for j in range(t):
        dp[i+1][j] = max(dp[i+1][j],dp[i][j])
        if j- a >= 0:dp[i+1][j] = max(dp[i+1][j],dp[i][j-a]+b)
    ans = max(ans,dp[i][t-1]+b)

print(ans)
        
        

Measured memory_bytes: 118492
#include <bits/stdc++.h>
#define REP(i,n)   for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(long long i=(a);((a)<(b)?i<=(b):i>=(b));((a)<(b)?++i:--i))
#define ALL(v)     (v).begin(),(v).end()
#define debug(x)   cerr<<#x<<": "<<(x)<<endl
using namespace std;
using llong = long long;
using vi    = vector<int>;
using vvi   = vector<vi >;
using vvvi  = vector<vvi >;
using pii   = pair<int,int>;
constexpr int    INF=1e9;
constexpr double EPS=1e-9;
constexpr int    MOD=1e9+7;
template<class Type>
void line(const Type &a){int cnt=0;for(const auto &elem:a){cerr<<(cnt++?' ':'>');cerr<<elem;}cerr<<endl;}

/*Binary Indexed Tree*/
template<typename Type>
struct BIT{
	int n;
	vector<Type> dat;//i:=[1,n].
	
	BIT(int n_):n(n_),dat(n_+1,0){}
	
	void init(){fill(ALL(dat),0);}
	void add(int i,Type x){//i番目の要素にxを足す.
		if(i<=0 or n<i) return;
		for(;i<=n;i+=(i&-i)) dat[i]+=x;
	}
	Type sum(int i){//[1,i]間の和を求める.
		if(i<=0 or n<i) return 0;
		Type res=0;
		for(;i>0;i-=(i&-i)) res+=dat[i];
		return res;
	}
	Type range_sum(int l,int r){return sum(r)-sum(l-1);}//[l,r]間の和を求める.
};

int main(){//Refering other editorials.
	int n,k;
	cin>>n>>k;
	
	vi p(n);
	vector<llong> c(n);
	REP(i,n){
		cin>>p[i];
		p[i]--;
	}
	REP(i,n) cin>>c[i];
	
	vvi circle;//set of circle.
	vector<llong> sum;//sum of each circle.
	bool seen[n]={};//jud which i have seen or not.
	REP(i,n){
		if(!seen[i]){
			circle.push_back(vi());
			int next=i;
			llong hoge=0LL;
			for(;!seen[next];next=p[next]){
				circle[circle.size()-1].push_back(next);
				hoge+=c[next];
				seen[next]=true;
			}
			sum.push_back(hoge);
		}
	}
	
	llong ans=-1e18; 
	REP(i,circle.size()){
		// debug(i);
		// line(circle[i]);
		// debug(sum[i]);
		
		int ccn=circle[i].size();//size of circle.
		BIT<llong> tree(ccn);
		REP(j,ccn) tree.add(j+1,c[circle[i][j]]);
		
		llong hoge=-1e18;
		FOR(j,1,ccn)FOR(l,j,ccn){
			if(l-j+1<=k){
				llong tmp=tree.range_sum(j,l);//[j,l].
				if(sum[i]>0) tmp+=sum[i]*((k-(l-j+1))/ccn);//if sum is 0 or more, must repeat.
				hoge=max(hoge,tmp);
			}
			if(0<ccn-(l-j+1) and ccn-(l-j+1)<=k){
				llong tmp=sum[i]-tree.range_sum(j,l);//[1,j-1]and[l+1,sz].
				if(sum[i]>0) tmp+=sum[i]*((k-(ccn-(l-j+1)))/ccn);
				hoge=max(hoge,tmp);
			}
		}
		
		ans=max(ans,hoge);
	}
	
	cout<<ans<<endl;
}

Measured memory_bytes: 3784
#include<iostream>
#include<vector>
#include<string>
#include <algorithm>
#include <queue>
#include <climits>
#include<cmath>
#include <sstream>
#include <iomanip>

const int64_t cc = pow( 10, 9 );

int main()
{
    int64_t a,b,c,d;
    std::cin>> a;
    std::cin>> b;
    std::cin>> c;

    if( a + b + c <= 21 )
    {
        std::cout<< "win";
    }
    else
    {
        std::cout<< "bust";
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;
#define reverse(s) reverse(s.begin(),s.end())

int main(){
    int n;
    cin >> n;
    rep(i,n+500){
        int x = i*1.08;
        if(x==n){
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
 
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int masu[2019 + 1];
int koma[100 + 1];

int main(void)
{
    int N, x;
    int M, A;
    int i;

    scanf("%d", &N);
    for (i = 1; i <= N; i++){
        scanf("%d", &koma[i]);
        masu[koma[i]] = i;
    }
    
    scanf("%d", &M);
    for (i = 1; i <= M; i++){
        scanf("%d", &A);
        if (koma[A] != 2019 && masu[koma[A] + 1] == 0){
            masu[koma[A]] = 0;
            masu[koma[A] + 1] = A;
            koma[A]++;
        }
    }
    
    for (i = 1; i <= N; i++){
        printf("%d\n", koma[i]);
    }
    
    return (0);
}



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

int main() {

	string N;
	cin >> N;

	if (N[0] == N[1] && N[1] == N[2]) {
		cout << "Yes" << endl;
	}
	else if (N[1] == N[2] && N[2] == N[3]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main() {
  int N,M,K;
  cin >> N >> M >> K;
  vector<long long> A(N+1,0),B(M+1,0);
  int i,ab;
  for(i=0;i<N;i++) {
    cin >> ab;
    A[i+1] = A[i] + ab;
  }
  for(i=0;i<M;i++) {
    cin >> ab;
    B[i+1] = B[i] + ab;
  }
  int ans = 0;
  for(i=0;i<=N;i++) {
    if(A[i] > K)break;
    int l = 0,r = M+1,m;
    while(r-l > 1) {
      m = (l+r) / 2;
      if(A[i] + B[m] > K)r = m;
      else l = m;
    }
    ans = max(ans,i+l);
  }
  cout << ans << endl;
}

Measured memory_bytes: 6368
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int K=sc.nextInt();
		int S=sc.nextInt();
		long toori=0;

		if(K<=200) {
			for(int i=0; i<=K; i++) {
				for(int j=0; j<=K; j++) {
					for(int k=0; k<=K; k++) {
						if(i+j+k==S) {
							toori++;
						}
					}
				}
			}
			System.out.println(toori);
		}
		else {
			if(S<=K) {
				System.out.println((S+2)*(S+1)/2);
			}
			else if(S>K && S<=2*K) {
				System.out.println((S+2)*(S+1)/2-3*(S-K+1)*(S-K)/2);

			}
			else if(S>2*K) {
				int tmp=3*K-S;
				System.out.println((tmp+2)*(tmp+1)/2);
			}
		}

	}
}

Measured memory_bytes: 21716
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int a = Integer.parseInt(in.next());
            int b = Integer.parseInt(in.next());
            int ans = b - a;

            // 出力
            boolean ok = false;
            if (ans % 2 == 0) ok = true;
            out.println(ok ? "Alice" : "Borys");

        }

    }
}



Measured memory_bytes: 35732
#include<stdio.h>
#define N (++m1>12?(++y1,m1-=12):0)
int U(int y)
{
	if(y%100==0)return y%400==0;
	return y%4==0;
}
int main()
{
	int D[2][13]={0,31,28,31,30,31,30,31,31,30,31,30,31},y1,y2,m1,m2,d1,d2,i,r;
	for(i=0;i<13;++i)D[1][i]=D[0][i];++D[1][2];
	while(scanf("%d%d%d%d%d%d",&y1,&m1,&d1,&y2,&m2,&d2),d1>0)
	{
		if(y1==y2&&m1==m2)r=d2-d1;
		else for(r=D[U(y1)][m1]-d1+d2,N;y1<y2||m1<m2;N)
			r+=D[U(y1)][m1];
		printf("%d\n",r);
	}
	return 0;
}

Measured memory_bytes: 0
n, m = map(int, input().split())
ab = []
for _ in range(n):
  a, b = map(int, input().split())
  ab.append([a,b])

ab = sorted(ab, key=lambda x: x[0])
yen = 0
bottle = 0
for a, b in ab:
  if bottle + b < m:
    yen += a * b
    bottle += b
  else:
    yen += a * (m - bottle)
    break
print(yen)


Measured memory_bytes: 21976
#include <iostream>
#include <vector>
#include <string>
#include <string.h>
#include <algorithm>
#include <queue>
#include <math.h>
using namespace std;
typedef long long ll;

string change(ll n) {
	string ret;
	while (--n >= 0) {
		ret.push_back('a'+ n % 26);
		n /= 26;
	}
	reverse(ret.begin(), ret.end());
	return ret;
}

int main()
{
	ll n;
	cin >> n;
	string ans = change(n);
	for (auto i : ans)
		cout << i;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <ctime>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#ifdef __APPLE__
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...)
#endif

const int N = (int)1e6 + 123;
const int MOD = (int)1e9 + 7;
const int inf = (int)5e8;
const long long infll = (long long)1e17;

void solve() {
    int n;
    cin >> n;
    cout << "ABC" << n;
}

int main() {
#ifdef __APPLE__
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t = 1;
    while (t--) {
        solve();
    }
    return 0;
}

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

using ll = long long;

bool isenough(ll t, ll A, ll B, vector<ll>& v) {
    ll sm = 0;
    for(int i = 0; i < v.size(); i++) {
        ll rd = v[i] - B * t;
        if(rd <= 0) continue;
        sm += rd / (A - B);
        if(rd % (A - B) != 0) sm += 1;
    }
    if(sm > t) return false;
    else return true;
}

int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    vector<ll> hs(N);
    for(int i = 0; i < N; i++) cin >> hs[i];
    sort(hs.begin(), hs.end());

    ll ng = 0, ok = hs[N-1] / B + 1;
    while(abs(ng - ok) > 1) {
        ll c = (ng + ok) / 2;
        if(isenough(c, A, B, hs)) ok = c;
        else ng = c;
    }

    cout << ok << endl;

    return 0;
}

Measured memory_bytes: 1024
require'prime'
n=gets.to_i
f=(1..n).reduce(:*)
q=Prime.take_while{|x|x<=n}
p [*q.permutation(3).map{|x,y,z|x**2*y**4*z**4},
*q.permutation(2).map{|x,y,z|x**4*y**14},
*q.permutation(2).map{|x,y,z|x**2*y**24},
*q.map{|x|x**74}].sort.uniq.count{|x|f%x==0}

Measured memory_bytes: 4984