akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void extended_euclid(ll x,ll y,ll *c,ll *a,ll *b){
  ll a0,a1,a2,b0,b1,b2,r0,r1,r2,q;r0=x;r1=y;a0=1;a1=0;b0=0;b1=1;
  while(r1>0){q=r0/r1;r2=r0%r1;a2=a0-q*a1;b2=b0-q*b1;r0=r1;r1=r2;a0=a1;a1=a2;b0=b1;b1=b2;}
  *c=r0;*a=a0;*b=b0;
}

ll get_inv(ll n, ll p){
  ll a,b,c;
  extended_euclid(n,p,&c,&a,&b);
  if(a<p) a+=p;
  return a%p;
}

ll fact[2000100],fact_inv[2000100];

void init() {
  fact[0]=1;
  REP(i,1,2000100) fact[i]=fact[i-1]*i%MAX;
  fact_inv[2000050]=get_inv(fact[2000050],MAX);
  rrep(i,2000050)fact_inv[i]=fact_inv[i+1]*(i+1)%MAX;
}

ll nCr(ll N,ll K){
  if(K<0||K>N)return 0;
  return fact[N]*fact_inv[K]%MAX*fact_inv[N-K]%MAX;
}

void Main() {
  init();
  ll x1,x2,y1,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  ll ans=0;
  REP(i,y1,y2+1) {
    ll x=x2-x1+1,y=y2-i+1;
    ans+=nCr(x1-1+i,i)*(nCr(x+y,x)-1+MAX);
    ans%=MAX;
  }
  REP(i,x1,x2+1) {
    ll x=x2-i+1,y=y2-y1+1;
    ans+=nCr(y1-1+i,i)*(nCr(x+y,x)-1+MAX);
    ans%=MAX;
  }
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    int x = ceil(static_cast<double>(n) / 1.08);
    if (static_cast<int>(floor(static_cast<double>(x) * 1.08)) == n)
        cout << x << endl;
    else
        cout << ":(" << endl;
    return 0;
}


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

// tourist set
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << '\n'; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
// tourist set end

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<'\n'
#define p2(s, t) cout << (s) << " " << (t) << '\n'
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << '\n'
#define p_yes() p("YES")
#define p_no() p("NO")
#define SZ(x) ((int)(x).size())
#define SORT(A) sort(ALL(A))
#define RSORT(A) sort(ALL(A), greater<ll>())

void no(){p_no(); exit(0);}
void yes(){p_yes(); exit(0);}

const ll mod = 1e9 + 7;
const ll inf = 1e18;
const double PI = acos(-1);

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

    // input
    ll a,b,h;cin>>a>>b>>h;
    
    ll ans= (a+b)*h/2;
    p(ans);
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    int a, cnt = 0;
    cin >> a ;
    //*/
    
    if(a % 10 == 1){
        cnt++;
    }
    a /= 10;
    
    if(a % 10 == 1){
        cnt++;
    }
    a /= 10;
    
    if(a % 10 == 1){
        cnt++;
    }
    a /= 10;
    
    /*
    vector<int> vec(4);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    */
    
    /*
    if( ( vec.at(0) == vec.at(1) && vec.at(1) == vec.at(2) ) || ( vec.at(3) == vec.at(2) && vec.at(1) == vec.at(2) ) ){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    */
    
    cout << cnt << endl;

    return 0; 
}


Measured memory_bytes: 3608
#include <iostream>
#include <set>

using namespace std;

int main()
{
    int N;
    cin>>N;
    multiset<int> S;
    for (int i=0; i<N; i++)
    {
        int D;
        cin>>D;
        S.insert(D);
    }
    int M;
    cin>>M;
    for (int i=0; i<M; i++)
    {
        int T;
        cin>>T;
        auto it = S.find(T);
        if (it == S.end())
        {
            cout<<"NO"<<endl;
            return 0;
        }
        S.erase(it);
    }
    cout<<"YES"<<endl;
}


Measured memory_bytes: 9600
#include <stdio.h>

int main(void){
	char buf , tr[60];
	int i , n , p;
	
	scanf("%d%*c" , &n);
	while(n--){
		for(i=0;i<60;i++) tr[i] = '\0';
		p = 30;
		while(1){
			if(tr[p]!='\n'){
				scanf("%c" , &tr[p]);
			}else{
				scanf("%*c");
			}
			scanf("%c" , &buf);
			if(buf=='\n') break;
			else if(buf=='-') p++;
			else p--;
			scanf("%*c");
		}
		for(i=0;i<60;i++) if(tr[i]!='\0') printf("%c" , tr[i]);
		printf("\n");
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <queue>
#include <algorithm>
using namespace std;
int read() {
	char c = getchar();
	int res = 0;
	while (c < '0' || c > '9') c = getchar();
	while (c >= '0' && c <= '9') res = (res << 1) + (res << 3) + (c ^ 48), c = getchar();
	return res;
}
int n, p, K, f[155][155], g[305][155][155];
void Solve1()
{
	K /= 2;
	f[0][0] = 1;
	for (int i = 1; i <= (n + 1) / 2; i++)
	{
		for (int j = 0; j <= K; j++)
			f[i][0] = (f[i][0] + f[i - 1][j]) % p;
		for (int j = 0; j < K; j++)
			f[i][j + 1] = (f[i][j + 1] + f[i - 1][j]) % p;
	}
	int ans1 = 0, ans2 = 0;
	for (int i = 0; i <= K; i++)
		ans1 = (ans1 + f[n / 2][i]) % p;
	for (int i = 0; i <= K; i++)
		ans2 = (ans2 + f[(n + 1) / 2][i]) % p;
	printf("%lld\n", 1ll * ans1 * ans2 % p);
}
void Solve2()
{
	int last = 0;
	g[0][0][0] = 1;
	for (int i = 2; i - K <= n; i += 2)
	{
		for (int j = 0; j <= n; j++)
			for (int k = 0; k <= K + 1; k++)
				g[i][0][0] = (g[i][0][0] + g[i - 2][j][k]) % p;
		if (i <= n)
		{
			for (int j = 0; j <= n; j++)
				for (int k = 0; k <= K + 1; k++)
					g[i][j + 1][0] = (g[i][j + 1][0] + g[i - 2][j][k]) % p;
		}
		if (i - K >= 1)
		{
			for (int j = 0; j <= n; j++)
			{
				for (int k = 1; k <= K; k++)
					g[i][0][k + 1] = (g[i][0][k + 1] + g[i - 2][j][k]) % p;
				g[i][0][0] = (g[i][0][0] + g[i - 2][j][0]) % p;
			}
		}
		if (i <= n && i - K >= 1)
		{
			for (int j = 0; j <= n; j++)
				for (int k = 0; max(k, j + 1) <= K; k++)
					g[i][j + 1][max(k + 1, j + 2)] = (g[i][j + 1][max(k + 1, j + 2)] + g[i - 2][j][k]) % p;
		}
		last = i;
	}
	int ans = 0;
	for (int j = 0; j <= n; j++)
		for (int k = 0; k <= K + 1; k++) ans = (ans + g[last][j][k]) % p;
	printf("%d\n", ans);
}
int main()
{
	n = read(), K = read(), p = read();
	if (!(K & 1))
		Solve1();
	else
		Solve2();
}


Measured memory_bytes: 11176
#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    int d,e;
    d=a-b;
    e=a-c;
    if(d<0) d=-d;
    if(e<0) e=-e;
    printf("%c",d<e?'A':'B');
    return 0;
}


Measured memory_bytes: 128
import sys
from collections import deque


def input():
    return sys.stdin.readline()[:-1]


H, W = map(int, input().split())

white_cnt = 0
grid = [[] for i in range(H+2)]
check = [[0] * (W+2) for i in range(H+2)]
grid[0] = ['#']*(W+2)
for i in range(1, H+1):
    w = list(input())
    white_cnt += w.count('.')
    grid[i] = ['#'] + w + ['#']
grid[-1] = ['#']*(W+2)

mv_list = [(1, 0), (-1, 0), (0, 1), (0, -1)]
que_hwc = deque([(1, 1, 1)])
check[1][1] = 1
while que_hwc:
    hwc = que_hwc.popleft()
    h = hwc[0]
    w = hwc[1]
    cnt = hwc[2]
    if h == H and w == W:
        print(white_cnt-cnt)
        exit(0)

    for mv in mv_list:
        mv_h = h + mv[0]
        mv_w = w + mv[1]
        if grid[mv_h][mv_w] == '.' and check[mv_h][mv_w] != 1:
            check[mv_h][mv_w] = 1
            que_hwc.append((mv_h, mv_w, cnt+1))
print(-1)


Measured memory_bytes: 9272
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>

using namespace std;
const int maxn = 5e5+5;
int n,m;
int far[maxn];
int Rank[maxn];
int find(int x){
	if(far[x] == x)return x;
	else return find(far[x]);
}
void unite(int x,int y){
	x = find(x);
	y = find(y);
	if(x == y) return;
	
	if(Rank[x] < Rank[y]) far[x] = y;
	else
	{
		far[y] = x;
		if(Rank[x] == Rank[y]) Rank[x]++;
	}
}
bool check(int x,int y){
	return find(x) == find(y);
}
void init(int n){
	for(int i = 0;i <= n;i++)
	{
		far[i] = i;
		//Rank[i] = 0;
	}
}

int main()
{
	while(~scanf("%d %d",&n,&m) &&(m||n))
	{
		init(n);
		int a;
		long long ans = 0;
		for(int i = 2;i <= n;i++)
		{
			scanf("%d",&far[i]);
		}
		char c[3];
		for(int i = 0;i <m;i++)
		{
			scanf("%s %d",c,&a);
			if(c[0] == 'M') far[a] = a;
			else  
			{
				ans += find(a);
			}
		}
		printf("%lld\n",ans);
	}
	
	return 0;
}


Measured memory_bytes: 3544
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <utility>
#include <set>
#include <bitset>
typedef long long ll;
typedef long double ld;
#define PI  3.14159265358979323846

#define REP(i,s,n)for(ll i=s;i<(n);++i)
#define rep(i,n) REP(i,0,n)
using namespace std;

int main() {
    ll X;
    ll year = 0;
    ll money = 100;
    cin >> X;
    while (true)
    {
        money *= 1.01;
        year++;
        if (X <= money)break;
    }
    cout << year << endl;
    return 0;
}

Measured memory_bytes: 3616
import java.io.*;
import java.util.*;

public class Main{ 

	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		SelectionSort sort = new SelectionSort(scan.nextInt());
		sort.loadSequence(scan);
		scan.close();
		sort.sort();
		System.out.println(sort);
		System.out.println(sort.swapTimes);
	}

}
class SelectionSort extends Sorting{
	public SelectionSort(int n){
		super(n);
	}
	@Override
	public void sort(){
		
		/*SelectionSort(A)
1 for i = 0 to A.length-1
2     mini = i
3     for j = i to A.length-1
4         if A[j] < A[mini]
5             mini = j
6     swap A[i] and A[mini]*/
		for(int i=0; i<seq.length-1;i++){
			int minIndex=i;
			for(int j=i; j<seq.length;j++){
				if(seq[j]<seq[minIndex])
					minIndex = j;
			}
			if(i!=minIndex)
				swap(i,minIndex);
		}
	}	
}
abstract class Sorting{
	int swapTimes;
	int[] seq;
	public Sorting(int n){
		swapTimes=0;
		seq = new int[n];
	}
	public void loadSequence(Scanner scan){
		for(int i=0; i<seq.length; i++)
			seq[i] = scan.nextInt();
	}
	@Override
	public String toString(){
		String tmp = "";
		for(int i=0; i<seq.length; i++)
			tmp = tmp + " " + seq[i];
		return tmp.trim();
	}
	void swap(int i, int j){
		swapTimes++;
		int tmp = seq[i];
		seq[i] = seq[j];
		seq[j] = tmp;
	}
	abstract public void sort();
}

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

const string YES = "Yes";
const string NO = "No";

void solve(std::string s, std::string t){
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    if(s < t) cout << YES << endl;
    else cout << NO << endl;
}

int main(){
    std::string s;
    std::cin >> s;
    std::string t;
    std::cin >> t;
    solve(s, t);
    return 0;
}


Measured memory_bytes: 256
from collections import deque
s = list(input())
q = int(input())

s = deque(s)
rev = 0

for i in range(q):
    t = list(input().split())
    if len(t) == 1:
        rev += 1
        continue
    if t[1] == '1':
        if rev % 2 == 0:
            s.appendleft(t[2])
        else:
            s.append(t[2])
    else:
        if rev % 2 == 0:
            s.append(t[2])
        else:
            s.appendleft(t[2])
if rev % 2 != 0:
    s.reverse()

print(''.join(s))


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



int dy[]={0,1,0,-1};
int dx[]={-1,0,1,0};
char dirs[]="<v>^";

char field[20][20];
int h,w;

bool in(int y,int x){
	return 0<=y&&y<h&&0<=x&&x<w;
}

int main(){
	bool first=true;
	int t;
	cin>>t;
	while(t--){
		string com;
		int ty,tx,dir;
		cin>>h>>w;
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				cin>>field[i][j];
				char *p=find(dirs,dirs+4,field[i][j]);
				if(p!=dirs+4){
					ty=i;
					tx=j;
					dir=p-dirs;
					field[i][j]='.';
				}
			}
		}
		cin>>com>>com;
		for(int i=0;i<com.size();i++){
			if(com[i]=='S'){
				int y=ty,x=tx;
				while(in(y,x)&&field[y][x]!='*'&&field[y][x]!='#'){
					y+=dy[dir];
					x+=dx[dir];
				}
				if(in(y,x)&&field[y][x]=='*'){
					field[y][x]='.';
				}
			}else{
				if(com[i]=='U')dir=3;
				else if(com[i]=='D')dir=1;
				else if(com[i]=='L')dir=0;
				else if(com[i]=='R')dir=2;
				if(in(ty+dy[dir],tx+dx[dir])&&field[ty+dy[dir]][tx+dx[dir]]=='.'){
					ty+=dy[dir];
					tx+=dx[dir];
				}
			}
		}
		field[ty][tx]=dirs[dir];
		if(!first)cout<<'\n';
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				cout<<field[i][j];
			}
			cout<<endl;
		}
		first=false;
	}
	return 0;
}

Measured memory_bytes: 1204
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>

using ll = long long;
typedef std::pair<int, int>p;

ll min(ll a, ll b) {
	if (a >= b)return b;
	else return a;
}
ll max(ll a, ll b) {
	if (a >= b)return a;
	else return b;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);

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

const ll Z = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool flag = true;
bool fl = true;
struct edge { int to, cost; };
std::vector<edge>v[100];
bool used[210];

int main() {
	ll q, h, s, d, n;
	std::cin >> q >> h >> s >> d >> n;
	if (n == 1) {
		ll ans;
		ans = min(q * 4, h * 2);
		ans = min(ans, s);
		std::cout << ans << std::endl;
	}
	else {
		ll Q = q * 4, H = h * 2, D = d / 2, ans = 0;
		if (D < Q&&D < H&&D < s) {
			ans += n / 2 * d;
			if (n % 2 == 1) {
				ll MIN;
				MIN = min(Q, H);
				MIN = min(MIN, s);
				ans += MIN;
			}
		}
		else {
			ll MIN;
			MIN = min(Q, H);
			MIN = min(MIN, s);
			ans += MIN*n;
		}
		std::cout << ans << std::endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                             \
  cerr << __LINE__ << ": " << #x << " = {";          \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) { \
    cerr << ((hoge) ? "," : "") << x[hoge];          \
  }                                                  \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  long long A[N];
  for (int i = 0; i < N; i++) cin >> A[i];
  long long ans = 0, pre = 0;
  for (int i = 0; i < N; i++) {
    if (pre > A[i]) ans += pre - A[i];
    pre = max(pre, A[i]);
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N, M, K;
    cin >> N >> M >> K;

    vec F(N*M+1, false);
    REP(i,0,N+1) {
        REP(j,0,M+1) {
            F[i*M+j*N-2*i*j] = true;
        }
    }
    if(F[K]) PR("Yes");
    else PR("No");

    return 0;
}

/*



*/

Measured memory_bytes: 11176
program main
 implicit none
 integer K,N
 integer,allocatable :: A(:)
 integer :: minA=1000000
 integer :: rouA=0
 integer i

 read *, K, N
 allocate(A(N))

 read *, A

 rouA=A(N)-A(1)
 if ( rouA < minA ) minA=rouA

 do i=2,N
  rouA=A(i-1)+K-A(i)
  if ( rouA < minA ) minA=rouA
 end do

 print '(i0)', minA

endprogram main


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

int main() {
  int K;
  string S;
  cin >> K >> S ;
  int s=S.size();
  if (s<=K){
  cout <<S << endl;
  }
  else {
    string k;
    for(int i=0;i<K;i++){
      k+=S.at(i);
    }
    
    cout<<k<<"..."<<endl;
  }
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

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

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

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

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////



int main() {

	ll a, b;
	cin >> a >> b;

	cout << (a + b + 1) / 2;

	system("PAUSE");

	

}


Measured memory_bytes: 504
# https://atcoder.jp/contests/abc129/tasks/abc129_d
from copy import deepcopy
def main():
    h, w = map(int, input().split())
    matrix = []
    for _ in range(h):
        row = list(input())
        matrix.append(row)

    left = [[0] * w for _ in range(h)] # 左から右
    right = [[0] * w for _ in range(h)] # 右から左
    up = [[0] * w for _ in range(h)] # 上から下
    down = [[0] * w for _ in range(h)] # 下から上

    for i in range(h):
        c = 0
        for j in range(w):
            if matrix[i][j] == '.':
                c += 1
            else:
                c = 0
            left[i][j] = c
    for i in range(h):
        c = 0
        for j in range(w)[::-1]:
            if matrix[i][j] == '.':
                c += 1
            else:
                c = 0
            right[i][j] = c
    for j in range(w):
        c = 0
        for i in range(h):
            if matrix[i][j] == '.':
                c += 1
            else:
                c = 0
            up[i][j] = c
    for j in range(w):
        c = 0
        for i in range(h)[::-1]:
            if matrix[i][j] == '.':
                c += 1
            else:
                c = 0
            down[i][j] = c
    ans = 1
    for i in range(h):
        for j in range(w):
            t = left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3
            ans = max(ans, t)
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 310408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
int main(){
    string s;cin >> s;
    if(s[2]==s[3]&&s[4]==s[5]){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main(){
    int n, pre=0, mx=0;
    cin >> n;
    int c[2][n], d[n];

    for(int i=0; i<2; i++){
        for(int j=0; j<n; j++){
            cin >> c[i][j];
        }
    }

    d[0] = c[0][0];

    for(int i=1; i<n; i++) {
        d[i] = d[i-1] + c[0][i];
    }

    for(int i=0; i<n; i++){
        pre = d[i];
        pre += c[1][i];
        for(int k=i+1; k<n; k++){
            pre += c[1][k];
        }
        mx = max(pre, mx);
    }
    cout << mx << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;

bool dfs(int i, vector<vector<pint>>& L, vector<vector<pint>>& R, vector<bool>& visited , vector<int>& X) {
    bool ans = true;
    for (pint r : L[i]) {
        int j = r.first;
        int d = r.second;
        if (visited[j]) {
            visited[j] = false;
            X[j] = X[i] + d;
            ans = (ans && dfs(j,L,R,visited,X));
        }
        else {
            if (X[j] - X[i] != d) {
                ans = false; break;
            }
        }
    }
    
    for (pint l : R[i]) {
        int j = l.first;
        int d = l.second;
        if (visited[j]) {
            visited[j] = false;
            X[j] = X[i] - d;
            ans = (ans && dfs(j,L,R,visited,X));
        }
        else {
            if (X[i] - X[j] != d) {
                ans = false; break;
            }
        }
    }
    return ans;
}

int main() {
    int n,m; cin >> n >> m;
    vector<vector<pint>> L(n);
    vector<vector<pint>> R(n);

    for (int i = 0; i < m; i ++ ) {
        int l,r,d;
        cin >> l >> r >> d;
        l --; r --;
        L[l].push_back({r,d});
        R[r].push_back({l,d});
    }

    vector<bool> visited(n,true);
    vector<int> X(n,0);
    
    bool ans = true;
    for (int i = 0; i < n; i ++) {
        if (visited[i]) {
            visited[i] = false;
            ans = (ans&&dfs(i,L,R,visited,X));
        }
    }

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

Measured memory_bytes: 20608
# include <bits/stdc++.h>
# define fi first
# define se second
# define mk make_pair
using namespace std;
typedef long long LL;
const int MAXN = 1e2 + 5;
const int MAXM = 5e3 + 5;
const int MOD = 1e9 + 7;
const LL INF = 1e18;
typedef long long LL;
typedef pair<double, int> PDI;


int main(){
    double L;
    scanf("%lf", &L);
    printf("%.8f\n", pow(L/3.0, 3));
    return 0;
}
/*
几何平均数 <= 算术平均数
pow(x1 * x2 * ... * xn, 1/n) <= (x1 + x2 + ... + xn) / n
 */

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

int main(void)
{
        char cup1[2]={'0','0'};
        char cup2[2]={'0','0'};
        int a = 1;
        int b = 0;
        int c = 0;
        int m = 0;


        while(scanf("%c,%c", cup1, cup2) != EOF)
        {
                if(cup1[0] == 'A' && cup2[0] =='B')
                {
                        m = a;
                        a = b;
                        b = m;
                }
                else if(cup1[0] == 'A' && cup2[0] == 'C')
                {
                        m = a;
                        a = c;
                        c = m;
                }
                else if(cup1[0] == 'B'  && cup2[0] == 'C')
                {
                        m = b;
                        b = c;
                        c = m;
                }
                else if(cup1[0] == 'B'  && cup2[0] == 'A')
                {
                        m = b;
                        b = a;
                        a = m;
                }
                else if(cup1[0] == 'C'  && cup2[0] == 'A')
                {
                        m = c;
                        c = a;
                        a = m;
                }
                else if(cup1[0] == 'C'  && cup2[0] == 'B')
                {
                        m = c;
                        c = b;
                        b = m;
                }
        }
        if(a == 1)
        {
                printf("A\n");
        }
        else if(b == 1)
        {
                printf("B\n");
        }
        else if(c == 1)
        {
                printf("C\n");
        }

        return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N; cin>>N;
    string S; cin>>S;

    int sum=0,val=0,minV=0;
    for(auto c:S){
        if(c=='('){
            val++;
            sum++;
        }else{
            val=max(0,val-1);
            sum--;
        }
        minV=min(minV,sum);
    }

    rep(i,0,-minV) S='('+S;
    rep(i,0,val) S+=')';

    cout<<S<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;
const int INF = 1e9;



signed main()
{
    int a;
    
    set<int> s;
    REP(i,3) {
        cin >> a;
        s.insert(a);
    }
    
    cout << s.size() << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int r;
	scan(r);
	prin(r*r);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INS(x) x.begin(),x.end()
int a[25];
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    for (int i=0;i<n;i++)
        cin>>a[i];
    vector<int> b;
    int ans=0;
    for (int i=0;i<n-2;i++)
    {
        b.clear();
        for (int j=0;j<3;j++)
            b.push_back(a[i+j]);
        sort(INS(b));
        if (a[i]!=a[i+1]&&a[i+1]!=a[i+2]&&a[i+1]==b[1]) ans++;
    }
    cout<<ans<<'\n'; 
    return 0;
}

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

int main() {
  int N, A, B;
  A = 1;
  B = 0;
  cin >> N;
  for (int i = 0; i < 9; i++){
    B += (N-N%A)/A%10;
    A *= 10;
  }
  if (N%B == 0){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int n;cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	cin>>a[i];
	
	int c=1,m=a[0];
	for(int i=1;i<n;i++)
	{
		if(a[i]<m)
		{
			m=a[i];c++;
		}
	}
	cout<<c;
	return 0;
}

Measured memory_bytes: 1024
N,M,K = gets.chomp.split.map(&:to_i)
A = gets.chomp.split.map(&:to_i)
B = gets.chomp.split.map(&:to_i)
a = [0]
b = [0]

(0..N-1).each do |x|
  a << a[x]+A[x]
end

(0..M-1).each do |y|
  b << b[y]+B[y]
end

n = 0
m = M
ans = 0
while(a[n]<= K) do
  while(a[n] + b[m] > K) do
    break if m == 0
    m -= 1
  end
break if a[n] + b[m] > K
ans = [ans, n+m].max
n += 1
break if n == N+1
end

puts ans

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

int main()
{
    int n,i,j,total=0;
    vector<int>a;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&j);
        a.push_back(j);
    }
    for(i=1;i<n;i++)
    {
        if(a[i]==a[i-1])
        {
            a[i]=-1;
            total++;
        }
    }
    cout<<total<<endl;

}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize(4)
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pi acos(-1.0)
#define LL unsigned long long
//#define mp make_pair
#define pb push_back
#define ls rt<<1, l, m
#define rs rt<<1|1, m+1, r
#define ULL unsigned LL
#define pll pair<LL, LL>
#define pii pair<int, int>
#define piii pair<pii, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stout);
//head

const int N = 2e5 + 10;
const int MOD = 1e9 + 7;
int fac[N], inv[N];
int cnt[N];
LL q_pow(LL n, LL k) {
	LL ans = 1;
	while(k) {
		if(k&1) ans = (ans * n) % MOD;
		n = (n * n) % MOD;
		k >>= 1;
	}
	return ans;
}
void init() {
	fac[0] = 1;
	for (int i = 1; i < N; i++) {
		fac[i] = (1LL * fac[i-1] * i) % MOD; 
	}
	inv[N-1] = q_pow(fac[N-1], MOD-2) % MOD;
	for (int i = N-2; i >= 0; i--) inv[i] = (1LL * inv[i+1] * (i+1)) % MOD;
}
LL C(int n, int m) {
	return ((1LL * fac[n] * inv[m]) % MOD * inv[n-m]) % MOD;
}
int main() {
	int n, m, up = 0;
	init();
	scanf("%d %d", &n, &m);
	for (int i = 2; i*i <= m; i++) {
		if(m % i == 0) {
			int tmp = 0;
			while(m % i == 0) m /= i, tmp++;
			cnt[++up] = tmp;
		}
	}
	if(m > 1) cnt[++up] = 1;
	LL ans = 1;
	for (int i = 1; i <= up; i++) ans = (ans * C(cnt[i]+n-1, n-1)) % MOD;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int mod(int n, int k){
    if(n%k < 0)
        return n-(n/k+1)*k;
    else
        return n%k;
}
int main()
{
    int n;int flag = 0;
    cin>>n;
    if(n==0){
        cout<<"0"<<endl;
        return 0;
    }
    string ans = "";
    int k = -2 ;
    while(n)
    {
        char a = mod(n,k) + '0';
        ans = ans + a;
        if(n%k < 0)
            n = n/k+1;
        else
            n /= k;
    }
    reverse(ans.begin(), ans.end());
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <utility>
using namespace std;
int int_sort(const void*a,const void *b) {
    return *(  int *) b - *(int *) a;
    //qsort(b, a, sizeof(long long int), int_sort);
}
int main() {
     int n;
     int out[100000];
     cin >> n ;
    //for (int i = 0; i < m; i++) {
    // cin >> p >> y;
    if(n==3 ||n==5 ||n==7)
        cout<<"YES";
    else
        cout<<"NO";
    return 0;


}

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

int main() {
  int N;
  vector<int> a;
  cin >> N;
  for(int i=0;i<N;i++){
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  sort(a.begin(), a.end());
  reverse(a.begin(),a.end());
  int alice = 0, bob = 0;
  for(int i=0;i<N;i++){
    if(i&1){
      bob += a.at(i);
    }else{
      alice += a.at(i);
    }
  }
  cout << alice - bob << endl;
  return 0;
}

Measured memory_bytes: 256
/*
		@Author :- Gaurav Bharti
		National Institute of Technology, Jamshedpur.
*/
 
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define empb emplace_back
#define mp make_pair
#define F first
#define S second
#define endl "\n"
#define vii vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define mapii map<int,int> 
#define mapll map<ll,ll>
#define all(a) a.begin(),a.end()
#define test ll t; cin>>t; while(t--)
#define prec(n) fixed<<setprecision(n)
#define jaldibazi ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007
 
void solve(){
	vector < pair < string, int > > v(4);

	for(int i=0;i<4;++i){
		v[0].F = "AC";
		v[0].S = 0;
		v[1].F = "WA";
		v[1].S = 0;
		v[2].F = "TLE";
		v[2].S = 0;	
		v[3].F = "RE";
		v[3].S = 0;
	}

	int n;cin >> n;
	for(int i = 0; i< n; ++i){
		string s; cin >> s;
		if( s == v[0].F ) v[0].S++;
		if( s == v[1].F ) v[1].S++;
		if( s == v[2].F ) v[2].S++;
		if( s == v[3].F ) v[3].S++;
	}

	for(int i=0;i< 4; ++i){
		cout << v[i].F <<" x "<< v[i].S << endl;
	}
} 
 
int main(){
	jaldibazi;
 
	solve();
}

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

using namespace std ; 

const int N = 2e5 + 7 ; 

long long n , m  ; 
int a[N] ; 
int vis[N] ;

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

  	cin>>n>>m ; 
    for(int i =1 ; i<= n ;i++){
        cin>>a[i] ; 
    }

    vector<int> nodes  ; 
    int cycle = 0 ; 
    int st = 0 ;
    int cur = 1 ; 
    while(1){
        if(vis[cur]){
            for(int j = 0 ; j < nodes.size() ; j++){
                if(nodes[j] == cur){
                    cycle = nodes.size() - j  ; 
                    st = j +1;
                    break ; 
                }
            }
            break ; 
        }
        vis[cur] =1 ; 
        nodes.push_back(cur) ; 
        cur = a[cur] ; 
    }

    if(m <= st){
        cout<< nodes[m] ; 
        return 0 ; 
    }     

    m-=st -1 ; 
    m%= cycle ;
    cout<< nodes[st -1 + m ] ; 
    return 0 ;

    cout<<cur ; 
    return 0 ; 
}



Measured memory_bytes: 5784
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
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; }
ll mod= 1e9 + 7;



int main(){
  int h,m;
  cin >>h >>m;
  int L[h][m]={},R[h][m]={},U[h][m]={},D[h][m]={};
  char a[h][m];
  rep(i,h){
    rep(ii,m)cin >> a[i][ii];
  }
  rep(i,h){
    rep(ii,m){
      if(a[i][ii]=='#'){
        R[i][ii]=0;
      }else{
        if(ii>0){R[i][ii]=R[i][ii-1]+1;}else{R[i][ii]=1;}
      }

      if(a[i][m-ii-1]=='#'){
        L[i][m-ii-1]=0;
      }else{
        if(m-ii<m){L[i][m-ii-1]=L[i][m-ii]+1;}else{L[i][m-ii-1]=1;}
      }
    }
  }
  rep(ii,m){
    rep(i,h){
      if(a[i][ii]=='#'){
        D[i][ii]=0;
      }else{
        if(i>0){D[i][ii]=D[i-1][ii]+1;}else{D[i][ii]=1;}
      }

      if(a[h-i-1][ii]=='#'){
        U[h-i-1][ii]=0;
      }else{
        if(h-i<h){U[h-i-1][ii]=U[h-i][ii]+1;}else{U[h-i-1][ii]=1;}
      }
    }
  }
  int ans=0;
  rep(i,h){
    rep(ii,m){
      int g=L[i][ii]+R[i][ii]+U[i][ii]+D[i][ii]-3;
      chmax(ans,g);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 69952
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <cstring>
using namespace std;

int main() {
  int n,x;
  bool b = false;
//  int b = 0;
//  long long int x,y;
  cin >> n;
  char s[n];
  for(int i = 0;i < n;i++)
    cin >> s[i];
  for(int i = 0;i < n;i++)
    if(s[i] == 'Y'){
      b = true;
    }
  if(b == true)
    cout << "Four" <<'\n';
  else
    cout << "Three";
  return 0;
}

Measured memory_bytes: 256
#include <bits//stdc++.h>
using namespace std;
#define rep(i,n,k) for(int i=n;i<k;i++)
#define int long long 
signed main(void){
    int n,m,ans,p,q;
    ans=0;
    string s;
    cin>>n;
    cin>>s;
    if(n%2)
    cout<<"No"<<endl;
    else{
        m=1;
        rep(i,0,n/2){
            if(s[i]!=s[n/2+i])
            m=0;
        }
        if(m)
        cout<<"Yes"<<endl;
        else
        cout<<"No"<<endl;
    }
   
    
}


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

typedef long long ll;

int main(){
    ll N,x;
    cin >> N >> x;
    ll a[N];
    ll sum=0;
    for(int i=0;i<N;i++){
        cin >> a[i];
        sum+=a[i];
    }
    sort(a,a+N);
    if(sum==x){
        cout << N << endl;
        return 0;
    }
    ll ans=0;
    ll tmp=x;
    for(int i=0;i<N;i++){
        if(tmp-a[i]>=0){
            tmp-=a[i];
            ans++;
        }
    }
    if(ans==N) cout << N-1 << endl;
    else cout << ans << endl;
    
}

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

static const int N = 8;
bool mat[N][N];
int n;

int dfs(int s){
    int cnt = 0;
    bool visited[N];
    rep(i, n) visited[i] = false;

    function<void(int, int)> dfs_rec = [&](int u, int d){
        visited[u] = true;
        if(d == n) cnt++;
        rep(i, n)
            if(mat[u][i] && !visited[i]){
                dfs_rec(i, d + 1);
                visited[i] = false;
            }
        return;
    };
    dfs_rec(s, 1);
    return cnt;
}

int main(){
    int m, a, b;
    cin >> n >> m;
    rep(i, n){
        rep(j, n) mat[i][j] = false;
        mat[i][i] = true;
    }
    rep(i, m){
        cin >> a >> b;
        a--, b--;
        mat[a][b] = true;
        mat[b][a] = true;
    }

    cout << dfs(0) << endl;
    return 0;
}

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


def process(x, judge):
    """Process for given x."""
    for i in range(len(x)):
        if x[i] % 2 == 0:
            x[i] = x[i] / 2
        else:
            judge = 1
    return x, judge


if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))

    counter, judge = -1, 0
    while judge == 0:
        a, judge = process(a, judge)
        counter += 1
    print(counter)


Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define YESNO(cond, yes, no) \
    { cout << ((cond) ? (yes) : (no)) << endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(), (list).rend())
#define ASSERT(cond, mes) assert(cond&& mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())
    is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a) n = a;
    if (n > b) n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

template <class T>
std::vector<T> enum_div(T n) {
    std::vector<T> ret;
    for (T i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) { ret.push_back(n / i); }
        }
    }
    return ret;
}

bool isPrime(ll num) {
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false;

    for (ll i = 3; i * i <= num; i += 2) {
        if (num % i == 0) { return false; }
    }

    return true;
};

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

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

template <class T>
bool is_integer(T x) {
    return std::floor(x) == x;
}

struct ToUpper {
    char operator()(char c) {
        return toupper(c);
    }
};

struct ToLower {
    char operator()(char c) {
        return tolower(c);
    }
};

vector<ll> memo(100010, -1);
ll fanctional(int n) {
    if (n == 0) return 1;
    if (memo[n] != -1) return memo[n];
    return memo[n] = (n * fanctional(n - 1)) % MOD;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll A, B;
    cin >> A >> B;
    cout << LCM(A, B) << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
long long a[2]={101,103};
long long M[2]={1e9+7,1e9+9};
long long d[2][300010],k[2][300010];
long long R=1,C=1,H[2000010],N[2000010],h[300010];
//評価関数（いまはMIN）
int hyouka(int a,int b){
  if(C<b)return 1;
  if(C<a||b==0)return 0;
  return N[H[a]]<N[H[b]]||N[H[a]]==N[H[b]]&&h[H[a]]<h[H[b]]?1:0;
}
//挿入関数
void hin(long long a){
  int i=C++;
  for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
  H[i]=R++;
}
//取り出す関数
int hout(){
  int rt=H[1],i,j=2,k=H[--C];
  for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
  H[j/2]=k;
  return rt;
}
void init(char *s){
  int i,j;
  for(i=0;i<2;i++){
    k[i][0]=1;
    d[i][0]=0;
    for(j=0;s[j];j++){
      d[i][j+1]=(d[i][j]*a[i]+(s[j]-'a'+1))%M[i];
      k[i][j+1]=(k[i][j]*a[i])%M[i];
    }
  }
}
long long getlr(int l,int r,int i){
  return (d[i][r]-(d[i][l]*k[i][r-l])+M[i]*M[i])%M[i];
}
void gets(char *s,int *h){
  int i,j;
  for(i=0;i<2;i++){
    h[i]=0;
    for(j=0;s[j];j++)h[i]+=k[i][j]*(s[j]-'0');
  }
}
int match(int l,int r,int *h){
  int i;
  for(i=0;i<2;i++){
    if(getlr(l,r,i)-h[i])return 0;
  }
  return 1;
}
int main(){
  int n=0,m,a,b,i,j,l=0,r=1;
  char s[300010],q[5];
  scanf("%*d %d %s",&m,s);
  init(s);//printf("%s\n",s);
  //for(i=0;s[i];i++)printf("%lld ",k[0][i+1]);printf("\n");
  //printf("%lld %lld %lld\n",d[0][3],d[0][4],k[0][2]);return 0;
  //printf("%lld %lld\n",getlr(0,2,0),getlr(2,4,0));return 0;
  for(i=0;i<m;i++){
    scanf("%s",q);
    if(q[0]=='L')l+=q[1]-'-'?1:-1;
    else         r+=q[1]-'-'?1:-1;//printf("%d %d!",l,r);
    h[R]=getlr(l,r,0);
    hin(getlr(l,r,1));//printf("%lld %lld\n",h[R-1],N[R-1]);
  }
  a=hout();
  for(i=1;i<m;i++){
    b=hout();//printf("%lld %lld %lld %lld\n",N[a],N[b],h[a],h[b]);
    if(N[b]==N[a]&&h[b]==h[a])n++;
    a=b;
  }
  printf("%d\n",m-n);
  return 0;
}



Measured memory_bytes: 18556
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] data = new int[n+1];
    for(int i = 0;i<n;i++){
      data[sc.nextInt()] = i+1;
    }
    for(int i = 0;i<n;i++){
      System.out.print(data[i+1]+" ");
    }
  }
}


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

int main() {
  string s;
  cin >> s;
  for(int i=0;i<s.length();i++){
    if(s[i]==s[i-1]){
      cout << i << ' ' << i+1;
      break;
    }
    else if(s[i]==s[i-2]){
      cout << i-1 << ' ' << i+1;
      break;
    }
    else if(i==s.length()-1)
      cout << -1 << ' ' << -1;
  }
}


Measured memory_bytes: 512
#include<stdio.h>
long long a, b, c, t;
void solve() {
	scanf("%lld%lld%lld", &a, &b, &c);
	a = a - c;
	if (a < 0) {
		c = -a;
		b = b - c;
		if (b <= 0) {
			printf("0 0\n", a, b);
		}
		else {
			printf("0 %lld\n", b);
		}
	}
	else {
		printf("%lld %lld\n", a, b);
	}
}
int main() {
	solve();

	return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W = lr()
A = np.array([lr() for _ in range(H)])
B = np.array([lr() for _ in range(H)])
diff = np.abs(A - B).tolist()

X = (H+W) * 80
L = X + X + 1 #真ん中を0とする、最後に-X
dp = [[np.zeros(L, np.bool)] * W for _ in range(H)]
dp[0][0] = np.zeros(L, np.bool)
di = diff[0][0]
dp[0][0][X+di] = 1; dp[0][0][X-di] = 1
for h in range(H):
    for w in range(W):
        if h == 0 and w == 0:
            continue
        di = diff[h][w]
        x = np.zeros(L, np.bool)
        if h > 0:
            prev = dp[h-1][w]
            x[di:] |= prev[:L-di]
            x[:L-di] |= prev[di:]
        if w > 0:
            prev = dp[h][w-1]
            x[di:] |= prev[:L-di]
            x[:L-di] |= prev[di:]
        dp[h][w] = x

dp = dp[-1][-1][X:]
possible = np.nonzero(dp)[0]
answer = possible.min()
print(answer)


Measured memory_bytes: 184940
#include<iostream>
using namespace std;
int main()
{
    int i,x,n;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        x=i;
        if(x%3==0)
        {
            cout<<" "<<i;
        }
        else
        {
            while(x>0)
            {
                if(x%10==3)
                {
                    cout<<" "<<i;
                    break;
                }
                x/=10;
            }
        }

    }
    cout<<endl;
    return 0;

}


Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<ll> vint;
int main() {
  ll N,K;
  cin >> N >> K;
  vint l(N);
  for (ll i=0;i<N;i++) cin >> l.at(i);
  
  sort(l.begin(),l.end());
  reverse(l.begin(),l.end());
  
  
  ll sum=0;
  for (ll i=0;i<K;i++) {
    sum += l.at(i);
  }
  
  cout << sum;
}

Measured memory_bytes: 256
str = gets.chomp

if str =~ /\Akeyence\Z/
    puts :YES
elsif str =~ /\A.+keyence\Z/
    puts :YES
elsif str =~ /\Ak.+eyence\Z/
    puts :YES
elsif str =~ /\Ake.+yence\Z/
    puts :YES
elsif str =~ /\Akey.+ence\Z/
    puts :YES
elsif str =~ /\Akeye.+nce\Z/
    puts :YES
elsif str =~ /\Akeyen.+ce\Z/
    puts :YES
elsif str =~ /\Akeyenc.+e\Z/
    puts :YES
elsif str =~ /\Akeyence.+\Z/
    puts :YES
else
    puts :NO
end


Measured memory_bytes: 1788