akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}


signed main(){
  int n;

  string  a, b;
  cin >> a >> b;
  a+=b;
  int i = 0;
  int x = 0;
  while(a[i]!=0){
    x*=10;
    x+=a[i]-'0';
    i++;
  }
  double m;
  n = m = sqrt(x);
  if(n==m) cout <<"Yes\n";
  else cout <<"No\n";
  
  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;
#include <queue>
#include <stack>


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

int main(){

    ll x,y;
    cin >> x >> y;
    ll cnt = 0LL;
    for(ll i = x;i <= y;i *= 2){
        cnt++;

    }

    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 256
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    dead_code
)]
//use permutohedron::LexicalPermutation as _;
use proconio::input;
//use proconio::marker::Chars;
//use proconio::marker::Usize1;
//use std::collections::HashSet;
//use std::collections::HashMap;
//use std::collections::BTreeMap;
use std::cmp::*;
//use std::num;

fn main() {
    input! {
       K:i32,N:usize,
       A:[i32;N]
    }
    //    let mut  d:Vec<i32> = vec![0;N];
    //    d[0] = A[0]+k-A[N-1];
    let mut m = A[0] + K - A[N - 1];
    for i in 1..N {
        //        d[i] = A[i]-A[i-1];
        m = max(m, A[i] - A[i - 1]);
    }
    println!("{}", K - m);
}


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

#define FOR(i,a,b)  for(ll (i)=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll (i)=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define ALL(v)      (v).begin(),(v).end()
#define BIT(n)      (1LL<<(n))
#define IN(x,l,r)   ((l)<=(x)&&(x)<=(r))
#define LEN(s)      (string(s)).length()
#define NPOS        string::npos
#define SHOW(x)     cout<<#x<<" = "<<x<<endl
#define SORT(v)     sort(ALL(v))
#define SZ(v)       (ll)(v).size()
#define UNIQ(v)     SORT(v);(v).erase(unique(ALL(v)),(v).end())
#define PERM(v)     for(bool p=1;p;p=next_permutation(ALL(v)))
#define PQ(T)       priority_queue<T,vector<T>,greater<T>>

template<class T>string join(const vector<T>& v,string d=" ")
{stringstream s;REP(i,SZ(v))s<<d<<v[i];return s.str().substr(LEN(d));}

template<class T>ostream& operator<<(ostream& s,const vector<T>& v)
{s<<"{";if(SZ(v))s<<join(v,", ");s<<"}";return s;}

template<class T>bool contain(const string& s,const T& v)
{return s.find(v)!=NPOS;}

template<class T,class U>string& replace(string& s,const T& f,const U& t)
{for(auto p=s.find(f);p!=NPOS;p=s.find(f,p+LEN(t)))s.replace(p,LEN(f),t);}

const ll INF = 1e15;
const ll MOD = 1e9+7;
const double EPS = 1e-10;

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

int main() {
    vector<string> v(3); REP(i, 3) cin >> v[i];
    cout << "A" + v[1].substr(0,1) + "C" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
bool UDid(char a) {
    if ((a >= 'a') && (a <= 'z')) {
        return true;
    }
    else if ((a >= 'A') && (a <= 'Z')) {
        return false;
    }
}
int main() {
    char a;
    cin >> a;
    if (UDid(a)) {
        cout << 'a' << endl;
    }
    else {
        cout << 'A' << endl;
    }

}

Measured memory_bytes: 3060
#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>
#include<bitset>
#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;
ll D,A;
int main(){
	int N;

	vpll XH;
	scan(N>>D>>A);
	rep(i,N){
		ll x,h;
		scan(x>>h);
		XH.push_back({x,h});
	}
	sort(ALL(XH));
	ll ans=0;
	priority_queue<pll, vector<pll>, greater<pll> > Q;//座標,ダメージ
	ll geta=0;
	rep(i,N){
		while(1){
			if(Q.size()&&XH[i].first>Q.top().first){
				geta-=Q.top().second;
				Q.pop();

			}
			else break;
		}
		//printf("i:%d X:%lld ans:%lld geta:%lld\n",i,XH[i].first,ans,geta);
		if(XH[i].second-geta<=0) continue;
		ll kai=(XH[i].second-geta)/A+((XH[i].second-geta)%A!=0);
		ans+=kai;
		//printf("i:%d X:%lld kai:%lld ans:%lld geta:%lld\n",i,XH[i].first,kai,ans,geta);
		Q.push({XH[i].first+2*D,kai*A});
		geta+=kai*A;
	}
	prin(ans);
	return 0;
}


Measured memory_bytes: 7788
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
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;
}
const int INF=1e18;
const int MOD=1e9+7;

void add(int &x,int y){
    x+=y;
    x%=MOD;
    return;
}

signed main(){
    string k;int d;cin>>k>>d;
    int dp[SZ(k)+1][d][2];
    REP(i,SZ(k)+1)REP(j,d)REP(s,2) dp[i][j][s] = 0;
    dp[0][0][0] = 1;
    REP(i,SZ(k)){
        int z = k[i] - '0';
        REP(j,z) REP(s,d) add(dp[i+1][(s+j)%d][1],dp[i][s][0]);
      	REP(j,10) REP(s,d) add(dp[i+1][(s+j)%d][1],dp[i][s][1]);
        REP(s,d) dp[i+1][(s+z)%d][0] = dp[i][s][0];
    }
    int ans = (dp[SZ(k)][0][0]+dp[SZ(k)][0][1]-1)%MOD;
    if(ans < 0) ans += MOD;
    cout<<ans<<endl;
}


Measured memory_bytes: 15872
S=input()
flag=False
for i in range(len(S)):
  if i%2==0:
    if S[i]!='R' and S[i]!='U' and S[i]!='D':
      flag=True
  else:
    if S[i]!='L' and S[i]!='U' and S[i]!='D':
      flag=True
if flag==True:
  print('No')
else:
  print('Yes')

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

int main(){
	int past[1001],current[1001],tmp_code,tmp_date;
	char buf[30];

	for(int i=0; i < 1001; i++){
		past[i] = current[i] = 0;
	}

	while(true)
	{
		fgets(buf,30,stdin);
		if(buf[0] == '\n'){
			break;
		}
		tmp_code = 0;
		for(int i=0;buf[i] != ',';i++){
			tmp_code = 10*tmp_code + (buf[i] - '0');
		}
		past[tmp_code]++;
	}

	while(scanf("%d,%d",&tmp_code,&tmp_date)!=EOF){
		current[tmp_code]++;
	}

	for(int i = 0; i < 1001; i++){
		if(past[i] > 0 && current[i] > 0){
			printf("%d %d\n",i,past[i]+current[i]);
		}
	}

	return 0;
}

Measured memory_bytes: 2604
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>

ll lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}
ll INF = 10010001010;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int L = A + B, R = C + D;
    if(L > R){
        cout << "Left" << endl;
    }
    else if(L < R){
        cout << "Right" << endl;
    }
    else{
        cout << "Balanced" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>

#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const int INF = INT32_MAX / 3;
const ll MOD = 1e9 + 7;

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


/******************************************************************************************/





int main() {

	int q;
	cin >> q;

	vector<int> a;
	for (int i = 0; i < q; i++)
	{
		int c, d;
		cin >> c;
		if (c == 2) {
			a.pop_back();
		}
		else
		{
			cin >> d;
			if (c == 0) {
				a.push_back(d);
			}
			else
			{
				cout << a[d] << endl;
			}
		}
	}




	return 0;
}


Measured memory_bytes: 3848
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        int n = stdin.nextInt();
        int k = stdin.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = stdin.nextInt();
        }

        Arrays.sort(a);

        int lo = -1;
        int hi = n;
        while (Math.abs(hi - lo) > 1) {
            int mi = (lo + hi) / 2;
            if (ok(n, k, a, mi)) {
                hi = mi;
            } else {
                lo = mi;
            }
        }
        System.out.println(hi);
    }

    private static boolean ok(int n, int k, int[] a, int x) {
        boolean[][] dp = new boolean[n + 1][k];
        dp[0][0] = true;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < k; j++) {
                dp[i + 1][j] = dp[i + 1][j] || dp[i][j];
                if (i != x && j + a[i] < k) {
                    dp[i + 1][j + a[i]] = dp[i + 1][j + a[i]] || dp[i][j];
                }
            }
        }
        return IntStream.range(Math.max(0, k - a[x]), k).anyMatch(i -> dp[n][i]);
    }
}


Measured memory_bytes: 202584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define all(v) v.begin(),v.end()

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }

const int INF = 1 << 28;

class Solver {
  public:
    int N, M, C, Start, Goal;
    vector<int> P;
    vector<vector<int>> Q, R;
    vector<vector<vector<int>>> G;

    int calc_cost(int c, int dist) {
        int res = 0, i = 0, pre = 0;
        for(; i < Q[c].size() and Q[c][i] <= dist; i++) {
            res += R[c][i] * (Q[c][i] - pre); // Q[c][i] <= dist ????????§
            pre = Q[c][i];
        }
        assert(pre <= dist);
        res += R[c][i] * (dist - pre);
        return res;
    }


    void warshall_floyd(vector<vector<int>> &G) {
        rep(k, N) rep(i, N) rep(j, N) set_min(G[i][j], G[i][k] + G[k][j]);
    }

    bool solve() {
        cin >> N >> M >> C >> Start >> Goal;
        if(N == 0) return false;
        Start--; Goal--;
        G.resize(C, vector<vector<int>>(N, vector<int>(N, INF)));
        rep(i, M) {
            int x, y, d, c; cin >> x >> y >> d >> c;
            x--; y--; c--;
            set_min(G[c][x][y], d);
            set_min(G[c][y][x], d);
        }        
        P.resize(C); cin >> P;
        Q.resize(C);
        R.resize(C);
        rep(i, C) {
            Q[i].resize(P[i] - 1); cin >> Q[i];
            R[i].resize(P[i]); cin >> R[i];
        }
        
        rep(c, C) warshall_floyd(G[c]);
        
        vector<vector<int>> G_cost(N, vector<int>(N, INF));
        rep(c, C) rep(i, N) rep(j, N) {
            if(G[c][i][j] < INF) {
                set_min(G_cost[i][j], calc_cost(c, G[c][i][j]));
            }
        }

        warshall_floyd(G_cost);
        
        int ans = G_cost[Start][Goal];
        cout << (ans >= INF ? -1 : ans) << endl;
        
        return true;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(1) {
        if(not Solver().solve()) break;
    }
    return 0;
}

Measured memory_bytes: 3940
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<algorithm>
 
#define maxn 1005
 
using namespace std;
 
inline int getint()
{
    int num=0,flag=1;char c;
    while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;
    while(c>='0'&&c<='9')num=num*10+c-48,c=getchar();
    return num*flag;
}
 
struct node{
	long long x,y,r;
}p[maxn];

queue<int>Q;

double l[maxn][maxn];
double dis[maxn];
bool vis[maxn];
int n;

inline double dist(int i,int j)
{
	double ans=sqrt((p[i].x-p[j].x)*(p[i].x-p[j].x)+(p[i].y-p[j].y)*(p[i].y-p[j].y));
	ans-=p[i].r+p[j].r;
	return ans>0?ans:0;
}

void spfa()
{
	Q.push(1);vis[1]=1;
	while(!Q.empty())
	{
		int u=Q.front();Q.pop();vis[u]=0;
		for(int i=1;i<=n;i++)
			if(i!=u)
				if(dis[u]+l[u][i]<dis[i])
				{
					dis[i]=dis[u]+l[u][i];
					if(!vis[i])
						Q.push(i),vis[i]=1;
				}
	}
}

int main()
{
	memset(dis,0x7f,sizeof dis);dis[1]=0;
	p[1].x=getint(),p[1].y=getint(),p[2].x=getint(),p[2].y=getint();
	n=getint()+2;
	for(int i=3;i<=n;i++)
		p[i].x=getint(),p[i].y=getint(),p[i].r=getint();
	for(int i=1;i<=n;i++)for(int j=i+1;j<=n;j++)
		l[i][j]=l[j][i]=dist(i,j);
	spfa();
	printf("%.10lf\n",dis[2]);
}

Measured memory_bytes: 8192
def C_Together(N, a):
    lst = [0] * (max(a) + 1 + 2)  # 配列0スタートを考慮+1、リスト長が3以上になるように+2
    for i in a:
        lst[i] += 1

    ans = 0
    for i in range(1, len(lst) - 1):
        tmp = lst[i - 1] + lst[i] + lst[i + 1]
        ans = max(ans, tmp)
    return ans

N = int(input())
a = [int(i) for i in input().split()]
print(C_Together(N, a))

Measured memory_bytes: 13964
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

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

    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N) cin >> a[i];

    const int MAX = 21;
    vector<vector<int>> dp(N, vector<int>(MAX, 0));
    dp[0][a[0]] = 1;
    rep2(i, 1, N - 1) {
        rep(j, MAX) {
            if (j + a[i] < MAX) {
                dp[i][j + a[i]] += dp[i - 1][j];
            }
            if (j - a[i] >= 0) {
                dp[i][j - a[i]] += dp[i - 1][j];
            }
        }
    }

    cout << dp[N - 2][a[N - 1]] << endl;

}

Measured memory_bytes: 3216
from math import factorial as f

N = int(input())
ans = 0

def solve(S):
    #print(S)
    if len(S)>2 and N<int(S):
        return 0
    cnt = 0
    if '3' in S and '5' in S and '7' in S:
        #print('*')
        cnt += 1
    cnt += solve('3' + S)
    cnt += solve('5' + S)
    cnt += solve('7' + S)
    return cnt

ans = solve('')
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#define N 100

int n,a[N][N];
int x=0,y=1,z=2;
int b[N],c[N],d[N],time;

void visit(int u){
  int v;
  b[u]=y;
  time++;
  c[u]=time;
  for(v=0;v<n;v++){
    if(a[u][v]==0) continue;
    if(b[v]==x){
      visit(v);
    }
  }
  b[u]=z;
  d[u]=++time;
}

void dfs(){
  int i,u;
  for(i=0;i<n;i++){
    b[i]=x;
  }
    time=0;
    for(u=0;u<n;u++){
      if(b[u]==x){
	visit(u);
      }
    }
    for(i=0;i<n;i++){
      printf("%d %d %d\n",i+1,c[i],d[i]);
    }
}

int main(){
  int i,j,u,k,v;
    scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      a[i][j]=0;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      a[u][v]=1;
    }
  }
  dfs();
  return 0;
}



Measured memory_bytes: 2108
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>

using namespace std;


/** 累乗

   O(log n)
 */
template<typename T, T M>
T power(T x, T y)
{
    T ret = 1;
    for (; y != 0; y /= 2) {
        if (y % 2 != 0) {
            ret = (ret * x) % M;
        }
        x = (x * x) % M;
    }
    return ret;
}

// P を法とする逆元
template<typename T, T P>
T mod_inv(T x) {
    return power<T, P>(x, P-2);
}

/** Pを法とする  static なメモ付きべき乗
 */
template<typename T, T P>
std::pair<T, T> memo_flactional(T val)
{
    static std::vector<T> memo{1};
    static std::vector<T> inv_memo{1};

    if (memo.size() <= val) {
        memo.reserve(val+1);
        inv_memo.reserve(val+1);
        for (T i = memo.size(); i <= val; ++i) {
            memo.push_back((memo[i-1] * i) % P);
            inv_memo.push_back((inv_memo[i-1] * mod_inv<T, P>(i)) % P);
        }
    }

    return std::make_pair(memo[val], inv_memo[val]);
}

// http://hos.ac/slides/20130319_enumeration.pdf

/** P を法とする組み合わせ
 */
template<typename T, T P = 1000000007ULL>
T choose(T n, T r)
{
    T ret = memo_flactional<T, P>(n).first;
    ret *= memo_flactional<T, P>(r).second;
    ret %= P;
    ret *= memo_flactional<T, P>(n - r).second;
    ret %= P;

    return ret;
}


int main()
{
    uint64_t H, W, A, B;
    std::cin >> H >> W >> A >> B;

    constexpr uint64_t P = 1000000007ULL;

    // 最大パターン計算してメモっておく
    memo_flactional<uint64_t, P>(H+W);

    uint64_t path = 0;
    for (uint64_t i = B; i <= W - 1; ++i) {
        path +=
            choose<uint64_t, P>((H - A - 1) + i,                    i) *
            choose<uint64_t, P>((A - 1)     + (W - 1 - i), (W - 1 - i));
        path %= P;
    }

    std::cout << path << std::endl;

    return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007ll
#define mod1 998244353ll
#define endl "\n"
using namespace std::chrono;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s,t;
    cin>>s>>t;
    cout<<t<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N = 0, A = 0, B = 0;
  
  cin >> N >> A >> B;
  
  int def = (N * A) - B;
  
  if (def >= 0){
  cout << B << endl;
  }
  else{
  cout << N * A << endl;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
const int INF = 1e6;
const int dd[4] = { 0, 1, 0, -1 };

int main() {
    while (1) {
        int w, h;
        cin >> w >> h;
        if (!w) return 0;

        vector<string> s(h);
        vector<P> ps;
        for (int i = 0; i < h; ++i) {
            cin >> s[i];
            for (int j = 0; j < w; ++j)
                if (s[i][j] == 'o')
                    ps.push_back(P(i, j));
        }
        for (int i = 0; i < h; ++i)
            for (int j = 0; j < w; ++j)
                if (s[i][j] == '*')
                    ps.push_back(P(i, j));

        int n = ps.size();
        vector<vector<vector<int>>> dist(n, vector<vector<int>>(h, vector<int>(w, INF)));
        for (int i = 0; i < n; ++i) {
            queue<P> q;
            q.push(ps[i]);
            dist[i][ps[i].first][ps[i].second] = 0;
            while (!q.empty()) {
                P p = q.front();
                q.pop();
                for (int j = 0; j < 4; ++j) {
                    int ti = p.first + dd[j], tj = p.second + dd[j ^ 1];
                    if (0 <= ti && ti < h && 0 <= tj && tj < w && s[ti][tj] != 'x' && dist[i][ti][tj] > dist[i][p.first][p.second] + 1) {
                        dist[i][ti][tj] = dist[i][p.first][p.second] + 1;
                        q.push(P(ti, tj));
                    }
                }
            }
        }
        vector<int> v(n);
        for (int i = 0; i < n; ++i) v[i] = i;

        int ans = INF;
        do {
            if (v[0] != 0) continue;

            int sum = 0;
            for (int i = 0; i < n - 1; ++i)
                sum += dist[v[i]][ps[v[i + 1]].first][ps[v[i + 1]].second];

            ans = min(ans, sum);
        } while (next_permutation(v.begin(), v.end()));

        cout << (ans == INF ? -1 : ans) << "\n";
    }
}



Measured memory_bytes: 3244
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("O3")
#include <stdio.h>

constexpr unsigned int MAX_INPUT = 5e5;
char Input[MAX_INPUT];
char* input = Input;

template <class Integer = long long int>
inline Integer get(void){
    Integer res = 0;
    if(*input == '-'){
        while(*(++input) >= '0'){ res = 10 * res + *input - '0'; }
        return -res;
    }
    do{ res = 10 * res + *(input++) - '0'; } while(*input >= '0');
    return res;
}

struct circle{
    long long int x, y;
    int radius;
    circle(void):x(),y(),radius(){}
    static double distance(const long long int dx, const long long int dy){
        return __builtin_sqrt(dx * dx + dy * dy);
    }
    inline void in0(void){x = get(); input++; y = get(); input++;}
    inline void in(void){ x = get(); input++; y = get(); input++; radius = get<int>(); input++;}
    inline double distance(const circle& other){
        double d = distance(x - other.x, y - other.y) - (radius + other.radius);
        return (d < 0) ? 0 : d;
    }
};

inline void chmin(double& v, const double val){ if(v > val) v = val; }

using uint = unsigned int;
constexpr uint MAX_N = 1000;
constexpr double inf = 3e18 + 3e17 + 4e16;
circle Point[MAX_N + 2];
bool visited[MAX_N + 2];
double dist[MAX_N + 2];

int main(void){
    fread(Input, sizeof(char), MAX_INPUT, stdin);

    Point[0].in0(); Point[1].in0();

    uint n = get(); input++;
    Point[++n] = Point[1]; dist[n] = inf;

    for(uint i = 1; i < n; ++i) { Point[i].in(); dist[i] = inf;}

    for(uint _ = 0, s = 0; _ < n; ++_){
        double min = inf; uint nearest = 0; visited[s] = true;
        for(uint v = 1; v <= n; ++v) if(not visited[v]){
            const double d = Point[s].distance(Point[v]);
            chmin(dist[v], dist[s] + d);
            if(min > dist[v]){ min = dist[v]; nearest = v; }
        }
        s = nearest;
        if(s == n) break;
    }
    printf("%.16lf\n", dist[n]);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    ll N,M,sum=0;
    cin >> N >> M;

    vector<ll> X(M),sa(M-1);

    for(ll i = 0;i < M;i++)
        cin >> X.at(i);

    sort(X.begin(),X.end());

    for(ll i = 0;i < M - 1;i++)
        sa.at(i) = abs(X.at(i) - X.at(i+1));

    sort(sa.begin(),sa.end());

    if(M> N)
        for(ll i = 0;i < M - N;i++)
            sum += sa.at(i);

    cout << sum << endl;




    
    
}

Measured memory_bytes: 4708
import java.util.*;
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int x = sc.nextInt();
        int a = 0;
        int b = 0;
        for(int i=0; i<m; i++){
            int s = sc.nextInt();
            if(s>x){
                a++;
            }else{
                b++;
            }
        }
        System.out.println(Math.min(a,b));
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define ba 47
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int64 f[25000005],N;
int g[5][5];
void Solve() {
    read(N);
    for(int i = 0 ; i < 2 ; ++i) {
	for(int j = 0 ; j < 3 ; ++j) {
	    read(g[i][j]);
	}
    }
    for(int i = 1 ; i <= N ; ++i) f[i] = i;
    for(int i = 0 ; i < 3 ; ++i) {
	for(int s = g[0][i] ; s <= N ; ++s) {
	    f[s] = max(f[s],f[s - g[0][i]] + g[1][i]);
	}
    }
    int all = f[N];
    for(int i = 1 ; i <= all ; ++i) f[i] = i;
    for(int i = 0 ; i < 3 ; ++i) {
	for(int s = g[1][i] ; s <= all ; ++s) {
	    f[s] = max(f[s],f[s - g[1][i]] + g[0][i]);
	}
    }
    out(f[all]);enter;
}
int main(){
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}


Measured memory_bytes: 195584
#include "bits/stdc++.h"
using namespace std;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	/*int n; cin >> n;
	int a; cin >> a;
	
	n = n % 500;
	
	cout << ((a <= n) ? "yes" : "no") << endl;*/
	
	int x, a, b; cin >> x >> a >> b;
	
	x -= a;
	
	x = x % b;
	
	cout << x;
}


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

int main()
{
  int n, k;
  cin >> n >> k;
  int a[n], dp[n]={};
  for(int i=0; i<n; i++) cin >> a[i];
  for(int i=1; i<n; i++)
  {
    dp[i] = 1e9;
    for(int j=i-1; j>= max(i-k, 0); j--) dp[i] = min(dp[i], dp[j] + abs(a[i]-a[j]));
  }
  cout << dp[n-1];
  return 0;
}
   	

Measured memory_bytes: 1024
lst = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

K = int(input())
print(lst[K-1])


Measured memory_bytes: 2940
m, k = [int(item) for item in input().split()]

if m == 0:
    if k == 0:
        print("0 0")
    else:
        print(-1)
        exit()
elif m == 1:
    if k == 0:
        print("0 0 1 1")
    else:
        print(-1)
        exit()
else:
    if k >= 2**m:
        print(-1)
        exit()
    for i in range(2**m):
        if i == k:
            continue
        print(i, end=" ")
    print(k, end=" ")
    for i in range(2**m-1, -1, -1):
        if i == k:
            continue
        print(i, end=" ")
    print(k)

Measured memory_bytes: 4944
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll n,m;
  cin >> n >> m;
  vector<ll> a(m),b(m-1);
  rep(i,m){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  ll ans=0;
  rep(i,m-1){
    b.at(i)=abs(a.at(i)-a.at(i+1));
  }
  sort(b.begin(),b.end());
  for(ll i=0;i<m-n;i++){
    ans+=b.at(i);
  }
  cout << ans;
}


Measured memory_bytes: 4712
def resolve():
    '''
    code here
    '''
    S = input()
    is_flag = True
    while is_flag:
        # print(S, len(S))
        if len(S)>=5:
            temp = S[:5]
            # print(temp)
            if temp == 'dream':
                S = S[5:]
                if len(S) != 0:
                    if S[:5] == 'erase':
                        pass
                    elif S[:2] == 'er':
                        S = S[2:]
                
            elif temp == 'erase':
                S = S[5:]
                if len(S) != 0:
                    if S[0] == 'r':
                        S = S[1:]

            else:
                print('NO')
                is_flag = False
        elif len(S) == 0:
            print('YES')
            is_flag = False
        else:
            print('NO')
            is_flag = False


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9208
#include <iostream>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <cstdio>
#include <new>
#include <vector>
#include <cstdlib>
#include <string>
#include <set>
#include <tuple>
#include<map>

using namespace std;
int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;

	int ans1 = A * B, ans2 = C * D;

	if (ans1 >= ans2) cout << ans1 << endl;
	else cout << ans2 << endl;
	
}

Measured memory_bytes: 3632
import sys
s = input()
a = ''
n = len(s)
if (n%2) != 0:
    print('No')
    sys.exit()

i = 0
while (n-i) > 0:
    if s[i:i+2] == ('hi'):
        i += 2
    else:
        print('No')
        sys.exit()
print('Yes')

Measured memory_bytes: 3060
/*{{{*/
#include<bits/stdc++.h>

typedef long long ll;

#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define FORR(i,a,b) for(ll i=b-1;i>=a;i--)

#define vl vector<ll>
#define pll pair<ll,ll>

#define DEBUG(x) cout<<#x<<": "<<x<<endl

using namespace std;
/*}}}*/

int main() {
  ll n;
  cin >> n;
  vl a(n),b(n);
  REP(i,n) cin >> a[i] >> b[i];
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  ll ans;
  if(n%2==1){
    ans = b[n/2]-a[n/2]+1;
  }else{
    ll lw = b[n/2]+b[n/2-1];
    ll up = a[n/2]+a[n/2-1];
    ans = lw-up+1;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
int N,Q;
string S;
cin >>N >>Q >>S;
int l[Q],r[Q],c[N-1],ans[Q],a,b;
for (int i=0;i<Q;i++){
cin >>a >>b;
a--;b--;
l[i]=a;r[i]=b;
}
fill(c,c+N,0);
for (int i=0;i<N-1;i++){
if(S[i]=='A' && S[i+1]=='C')c[i]=1;
}
for(int i=1;i<N-1;i++){
c[i]+=c[i-1];
} 
for(int i=0;i<Q;i++){
if(l[i]==0)
ans[i]=c[r[i]-1];
else ans[i]=c[r[i]-1]-c[l[i]-1];
}
for(int i=0;i<Q;i++)cout<<ans[i]<<endl;

}

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

int main() {
  int n,x1,y1,z1,x2,y2,z2;
  cin >> n >> x1 >> y1 >> z1 >> x2 >> y2 >> z2;
  int ans=1<<29;
  for(int i=0; i<4; i++) {
    for(int j=0; j<4; j++) {
      for(int k=0; k<4; k++) {
        int a[3]={0,1,2};
        do {
          int x=x1,y=y1,z=z1,d=0;
          for(int l=0; l<3; l++) {
            if(a[l]==0) {
              if(i&&x==x2) d+=2;
              for(int h=0; h<i; h++) {swap(y,z);z=n-z-1;}
            } else if(a[l]==1) {
              if(j&&y==y2) d+=2;
              for(int h=0; h<j; h++) {swap(z,x);x=n-x-1;}
            } else {
              if(k&&z==z2) d+=2;
              for(int h=0; h<k; h++) {swap(x,y);y=n-y-1;}
            }
          }
          d+=abs(x-x2)+abs(y-y2)+abs(z-z2)+(i<3?i:1)+(j<3?j:1)+(k<3?k:1);
          ans=min(ans,d);
        } while(next_permutation(a,a+3));
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

#define ll long long

using namespace std;

int main(){
    set<int> v;
    int ele;
    for(int i=0; i<3; i++){
        cin>>ele;
        v.insert(ele);
    }
    cout<<(v.size()==2?"Yes":"No");
    cout<<"\n";   
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:


// P(A,x)=P(x|A)*y
// P(B,x)=P(x|B)*(1.0-y)


R p[6],q[6],x[6];

R calc(R y){
	R ret=0.0;
	rep(i,6) ret+=max(y*p[i],(1.0-y)*q[i]);
	return ret;	
}


int main(void){
	rep(i,6) cin >> p[i],p[i]/=100.0;
	rep(i,6) cin >> q[i],q[i]/=100.0;


	R l=0.0,r=1.0;

	rep(loop,200){
		const R lm=(2*l+r)/3,rm=(l+2*r)/3;
		if(calc(lm)<calc(rm))
			r=rm;
		else
			l=lm;
	}
	
	cout.precision(20);
	cout << fixed << calc(l) << endl;

	return 0;
}

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

int main() {
    int n;
    cin >> n;

    vector<int> x(n);
    for (int i = 0; i < n; i++) cin >> x.at(i);

    sort(x.begin(), x.end());
    int sum = 0, tmp;
    for (int i = x.at(0); i < x.at(n-1); i++) {
        tmp = 0;
        for (int j = 0; j < n; j++) {
            tmp += (x.at(j) - i) * (x.at(j) - i);
        }
        if (tmp < sum || sum == 0) sum = tmp;
    }
            
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3588
/*********************
*  Author: xuziyuan  * 
*********************/

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int n,k,a[110],dp[100010];

int dfs(int lft)
{
  if(dp[lft]!=-1) return dp[lft];
  rep(i,n) if(lft-a[i]>=0&&dfs(lft-a[i])==0) return dp[lft]=1;
  return dp[lft]=0;
}

int main()
{
  cin>>n>>k;
  rep(i,n) cin>>a[i];
  rep(i,100005) dp[i]=-1;
  if(dfs(k)==1) puts("First");
  else puts("Second");
  return 0;
}

Measured memory_bytes: 3712
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,L;
    cin >> N >> L;
    vl a(N);
    rep(i,N){
        cin >> a[i];
    }
    rep(i,N-1){
        if(a[i]+a[i+1]>=L){
            cout << "Possible" << endl;
            rep(j,i){
                cout << j+1 << endl;
            }
            ROF(j,N-2,i+1){
                cout << j+1 << endl;
            }
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << "Impossible" << endl;
}

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

int main() {
	long long n, ans = 0;
	cin >> n;
	for (int a = 1; a*a <= n; a++) {
		ans += a*a + a * (n/a-a) * (a+1+n/a);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) v.begin(), v.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main() 
{
  int a, b; cin >> a >> b;
  if(a == b) cout << "Draw" << endl;
  else if(a == 1 || b == 1){
    if(a == 1) cout << "Alice" << endl;
    else cout << "Bob" << endl;
  }
  else{
    if(a > b) cout << "Alice" << endl;
    else cout << "Bob" << endl;
  }
  system("pause");
}

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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  string s;cin>>s;
  for(int i=0;i<s.size();i++){
    if(count(s.begin(), s.end(), s[i])>1){
      cout<<"no"<<endl;
      return 0;
    }
  }
  cout<<"yes"<<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++)
#define REP(i,k,n) for(int i = k; i < n; i++)
//#define sum(start, end) accumulate(start, end, 0)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef string str;

using namespace std;
template <class T = ll> T in() { T _in; cin >> _in; return (_in); }


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

    string s = in<string>();
    int res=0;
    rep(i, 3)
        if(s[i] == '1')
            res++;

    cout << res << endl;

    return 0;
}


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

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

int main() {
  ll a, b;
  cin >> a >> b;
  ll ans = lcm(a, b);
  cout << ans << endl;
  return 0;
}

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

using namespace std;

typedef long double ld;
typedef long long ll;

#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define f first
#define s second

template<typename T, typename U> bool ckmin(T &a, U b){ return b < a ? a = b, true : false; }
template<typename T, typename U> bool ckmax(T &a, U b){ return b > a ? a = b, true : false; }

string types[] = {"AC", "WA", "TLE", "RE"};
int n;
vector<string> v;
vector<int> res;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    res.assign(4, 0);
    v.assign(n, "");
    for(int i = 0; i < n; ++i) cin >> v[i];
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < 4; ++j){
            if(v[i] == types[j]) res[j]++;
        }
    }
    for(int i = 0; i < 4; ++i){
        cout << types[i] << " x " << res[i] << "\n";
    }
    return 0;
}

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

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

	long long ans = n / 11 * 2;
	n %= 11;

	cout << ans + (n == 0 ? 0 : (n > 6 ? 2 : 1)) << endl;
}



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

#define MOD 1e9+7;
#define INF 1e17+9;
#define PI acos(-1);

using namespace std;

int main(){
	string s;
	cin >> s;
	
	int cnt_10=0;
	for(int i=0;i<s.size();i++){
		if(i%2==0){
			if(s[i]!='1')cnt_10++;
		}else{
			if(s[i]!='0')cnt_10++;
		}
	}
	
	int cnt_01=0;
	for(int i=0;i<s.size();i++){
		if(i%2==0){
			if(s[i]!='0')cnt_01++;
		}else{
			if(s[i]!='1')cnt_01++;
		}
	}
	
	int ans=min(cnt_10,cnt_01);
	
	cout << ans << endl;
	
	return 0;
}


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

int main(){
    string s;
    cin>>s;
    ll i,j;
    for(i=0;i<s.size();i++) if(s[i]=='A') break;
    for(j=s.size()-1;j>=0;j--) if(s[j]=='Z') break;
    cout<<j-i+1<<endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>

using namespace std;

typedef long long ll;

struct seg
{
	ll l, r, s;
	inline int operator<(const seg &a) const {return s > a.s;}
} s[5010];

const ll inf = (1ll<<62) - 1;
int n, m;
ll f[5010][2], g[5010][2];

int main()
{
	ios::sync_with_stdio(0);
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
    	cin >> s[i].l >> s[i].r;
    	s[i].s = s[i].l + s[i].r;
    }
    sort(s+1, s+n+1);
	
    for (int i = 1; i <= n; ++i)
    	f[i][0] = f[i][1] = g[i][0] = g[i][1] = inf;
    f[0][0] = 0;
    
    int x = 1, y = 0;
    m = n / 2;
    for (int i = 1; i <= n; ++i)
	{
		for (int j = 0; j <= n; ++j)
			f[j][x] = g[j][x] = inf;
		for (int j = 0; j < i; ++j)
		{
		    int k = i-j-1;
		    if (j <= m)
			{
				f[j+1][x] = min(f[j+1][x], f[j][y] + s[i].r + s[i].s * j);
				g[j+1][x] = min(g[j+1][x], g[j][y] + s[i].r + s[i].s * j);
		    }
		    if (k <= m)
			{
				f[j][x] = min(f[j][x], f[j][y] + s[i].l + s[i].s * k);
				g[j][x] = min(g[j][x], g[j][y] + s[i].l + s[i].s * k);
		    }
		    g[j][x] = min(g[j][x], f[j][y] + (n-1)/2 * s[i].s);
		}
		swap(x, y);
    }
	
    cout << (n&1 ? g[m][y] : f[m][y]) << endl;
    
    return 0;
}

Measured memory_bytes: 512
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = scanner.nextInt();
        }
        int q = scanner.nextInt();
        int[] m = new int[q];
        for(int i = 0; i < q; i++){
            m[i] = scanner.nextInt();
        }
        List<Integer> list = new ArrayList<>();
        for(int i = 0; i < Math.pow(2,n); i++){
            int ans = 0;
            for(int j = 0; j < n; j++){
                if ((1&i>>j) == 1) {ans += a[j];}
            }
            list.add(ans);
        }
        for(int i = 0; i < q; i++){
            if(list.contains(m[i])){System.out.println("yes");}
            else{System.out.println("no");}
        }
    }
}




Measured memory_bytes: 79524
#include <stdio.h>
int main()
{
  int l, a, b, c, d, co = 1;
  scanf("%d %d %d %d %d", &l, &a, &b, &c, &d);
  while(a > 0 || b > 0){
    a -= c;
    b -= d; 
    if(a > 0 || b > 0){ 
      co++;
    }
  }
  l -=co;
  printf("%d\n", l);
  return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<math.h>
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>(b);i--)
using namespace std;

int main(void) {
	int n;
	int* p;
	int count = 0;
	int point = 0;
	bool* check;

	cin >> n;
	p = new int[n + 1];
	check = new bool[n + 1];
	FOR(i, 1, n + 1) {
		cin >> p[i];
	}
	FOR(i, 1, n+1) {
		if (p[i] == i) {
			check[i] = 1;
		}
	}
	FOR(i, 1, n + 1) {
		if (check[i]==1) {
			point++;
		}
		else {
			if (point > 0) {
				if (point % 2 == 0) {
					point /= 2;
				}
				else {
					point = (point / 2) + 1;
				}
			}
			count = count + point;
			point = 0;
		}
		if ((point > 0) && (i == n)) {
			if (point % 2 == 0) {
				point /= 2;
			}
			else {
				point = (point / 2) + 1;
			}
			count = count + point;
		}
	}
	cout << count << endl;
	delete[] p;
	delete[] check;
	return 0;
}

Measured memory_bytes: 768
p,h,l,s,w,b,r=print,80,40,list,'.','#',range
W,B=map(int,input().split())
m=s(map(s,zip(*[iter(w*h*l+b*h*l)]*h)))
for i in r(B-1):m[i//l*2][i%l*2]=b
for i in r(W-1):m[79-i//l*2][79-i%l*2]=w
p(h,h)
[p(''.join(l)) for l in m]

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

using namespace std;

int main()
{
    long long n,s=0,i;
    cin>>n;
    for(i=1;i<=n;i++)
    {
          if(i%3==0 || i%5==0 || i%15==0)
    {
        s=s;
    }
    else

    {
        s=s+i;
    }
    }

    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<cmath>
using namespace std;

int main()
{
    int a, b, c, x, y;
    int mini, dis, ans;
    
    cin >> a >> b >> c >> x >> y;
    
    mini = min(x, y);
    dis = max(x, y) - mini;
    
    if((a + b) < 2 * c) {
        ans = (a + b) * mini;
    } else {
        ans = mini * 2 * c;
    }
    
    if(x > y) {
        if(a > 2 * c) { ans += 2 * c * dis; }
        else { ans += a * dis; }
    } else if(x < y) {
        if(b > 2 * c) { ans += 2 * c * dis; }
        else { ans += b * dis; }
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
n,x = map(int,input().split())
a = list(map(int,input().split()))
l = [float("INF")]*n
ans = float("INF")
for i in range(n):
    count = x*i
    for j in range(n):
        l[j] = min(l[j],a[(j-i)%n])
        count += l[j]
    ans = min(ans,count)
print(ans)

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

int main(){
  int l,r;
  cin>>l>>r;
  int min=2018;
  if(r-l<2018){
    for(int i=l;i<=r;i++){
      for(int j=l;j<=r;j++){
        int a=i%2019;
        int b=j%2019;
        int n=a*b;
        if(i<j&&min>n%2019){
          min=n%2019;
        }
      }
    }
    cout<<min<<endl;
  }
  if(r-l>=2018) cout<<0<<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

x = int(input())

kyu = 1

if x >= 1800:
    kyu = 1
elif x >= 1600:
    kyu = 2
elif x >= 1400:
    kyu = 3
elif x >= 1200:
    kyu = 4
elif x >= 1000:
    kyu = 5
elif x >= 800:
    kyu = 6
elif x >= 600:
    kyu = 7
elif x >= 400:
    kyu = 8

print(kyu)


Measured memory_bytes: 9176