akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){

    string str;
    int cnt=0;
    while(cin>>str){
        int S=str.length();
        bool flg=0;


        for(int i=0;i<=S-i-1;i++){
                //cout<<str[i]<<str[S-i-1]<<endl;
              if(str[i]!=str[S-i-1]){
                flg=1;
                break;
              }

        }
        if(flg==0)cnt++;

        str="";
    }
    cout<<cnt<<endl;


    return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
char s[100010];

int main()
{
	int i,l,ch,left=-1,right=-1;
	scanf("%s",s+1);
	l=strlen(s+1);
	for(i=1;i<l;i++)
		if(s[i]==s[i+1]){
			left=i;right=i+1;
			break;
		}
	if(left==-1)
	for(i=1;i<l-1;i++)
		if(s[i]==s[i+2]){
			left=i;right=i+2;
			break;
		}
	printf("%d %d\n",left,right);
 return 0;
}


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

ll solve() {
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
    }
    vector<ll> ca(N+1);
    for ( int i = 0; i < N; i++ ) {
        ca[i+1] = ca[i] + A[i];
    }
    vector<ll> s;
    for ( int i = 0; i < N; i++ ) {
        for ( int j = i; j < N; j++ ) {
            s.push_back(ca[j+1]-ca[i]);
        }
    }
    ll ans = 0;
    sort(s.rbegin(), s.rend());
    vector<bool> ng(s.size());
    for ( int b = 50; b >= 0; b-- ) {
        int c = 0, v = 0;
        for ( int i = 0; i < s.size(); i++ ) {
            if ( ng[i] ) continue;
            if ( (s[i] >> b) & 1 ) c++;
            if ( c >= K ) {
                v = 1;
                break;
            }
        }
        if ( v == 1 ) {
            ans |= (1LL << b);
            for ( int i = 0; i < s.size(); i++ ) {
                if ( ng[i] ) continue;
                if ( ((s[i] >> b) & 1) == 0 ) {
                    ng[i] = true;
                }
            }
        }

    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 6516
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N,M;
    cin >>N>>M;
    vector<vector<int>> m(N);
    rep(i,M){
        int x,y;
        cin>>x>>y;
        x--;
        y--;
        m[x].push_back(y);
        m[y].push_back(x);
    }
    string ans="IMPOSSIBLE";
    for(int i=0;i<m[0].size();i++){
        for(int j=0;j<m[m[0][i]].size();j++){
            if(m[m[0][i]][j]==N-1) ans="POSSIBLE";
        }
    }
    cout << ans << endl;



}


Measured memory_bytes: 12776
#include <stdio.h>

int nx, ny, mem0[101][101], mem1[101][101];
int b(int, int, int);

int b(int x, int y, int xy) {
	if (xy == 0 && mem0[x][y] != 0) return mem0[x][y];
	else if (xy == 1 && mem1[x][y] != 0) return mem1[x][y];
	if (x == nx && y == ny) return 1;
	else if (x > nx || y > ny) return 0;
	int res = 0;
	if (x == 1 && y == 1) {
		res += b(x+1,y,0) + b(x,y+1,1);
	} else if (xy == 0) {
		if (x == nx && y+1 == ny) return 1;
		res += b(x+1,y,0) + b(x,y+2,1);
	} else if (xy == 1) {
		if (x+1 == nx && y == ny) return 1;
		res += b(x+2,y,0) + b(x,y+1,1);
	} else printf("    [e]\n");
	if (xy == 0) return mem0[x][y] = res%100000;
	else if (xy == 1) return mem1[x][y] = res%100000;
}

int main() {
	int p, k;
	nx = 15, ny = 15;
	while (1) {
		scanf("%d%d", &nx, &ny);
		if (!(nx+ny)) break;
		for (p=0;p<101;p++) {
			for (k=0;k<101;k++) {
				mem0[p][k] = 0;
				mem1[p][k] = 0;
			}
		}
		printf("%d\n", b(1,1,0)%100000);
	}
	return 0;
}

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

int main(){
  int a, b;
  cin >> a >> b;
  int add = a + b;
  int sub = a - b;
  int mul = a * b;

  int max = add;
  if (max < sub) max = sub;
  if (max < mul) max = mul;
  cout << max;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=1e6+7;
int read()  {
    int x=0,f=1;char s=getchar();
    for(;s>'9'||s<'0';s=getchar()) if(s=='-') f=-1;
    for(;s>='0'&&s<='9';s=getchar()) x=x*10+s-'0';
    return x*f;
}
int n,id[N],mmp,val[N],pos[N];
struct edge {
    int id,val,type;
    bool operator < (const edge &b) const {
        return val<b.val;
    }
}a[N];
struct node {int v,nxt;}e[N<<1];
int head[N],tot;
void add(int u,int v) {
    e[++tot].v=v;
    e[tot].nxt=head[u];
    head[u]=tot;
}
int low[N],dfn[N],stak[N],top,cnt,vis[N],belong[N],scc;
void clear() {
    cnt=scc=tot=0;
    mmp=n+n;
    memset(head,0,sizeof(head));
    memset(dfn,0,sizeof(dfn));
    memset(id,0,sizeof(id));
}
void tarjan(int u) {
    low[u]=dfn[u]=++cnt;
    vis[u]=1;
    stak[++top]=u;
    for(int i=head[u];i;i=e[i].nxt) {
        int v=e[i].v;
        if(!dfn[v]) {
            tarjan(v);
            low[u]=min(low[u],low[v]);
        } else if(vis[v]) {
            low[u]=min(low[u],dfn[v]);
        }
    }
    if(low[u]==dfn[u]) {
        ++scc;
        while(stak[top]!=u) {
            vis[stak[top]]=0;
            belong[stak[top]]=scc;
            top--;
        }
        vis[stak[top]]=0;
        belong[stak[top]]=scc;
        top--;
    }
}
namespace seg {
    #define ls rt<<1
    #define rs rt<<1|1
    void build(int l,int r,int rt) {
        if(l==r) return id[rt]=pos[((a[l].id-1)^1)+1],void();
        int mid=(l+r)>>1;
        id[rt]=++mmp;
        build(l,mid,ls);
        build(mid+1,r,rs);
        add(id[rt],id[ls]),add(id[rt],id[rs]);
    }
    void update(int u,int L,int R,int l,int r,int rt) {
        if(L>R) return;
        if(L<=l&&r<=R) return add(u,id[rt]);
        int mid=(l+r)>>1;
        if(L<=mid) update(u,L,R,l,mid,ls);
        if(R>mid) update(u,L,R,mid+1,r,rs);
    }
}
bool check(int mid) {
    clear();
    seg::build(1,n+n,1);

    for(int i=1;i<=n+n;++i) {
        int l=upper_bound(val+1,val+n+n+1,val[i]-mid)-val;
        int r=lower_bound(val+1,val+n+n+1,val[i]+mid)-val-1;
        seg::update(i,max(l,1),i-1,1,n+n,1);
        seg::update(i,i+1,min(r,2*n),1,n+n,1);
        // printf("%d -> [%d,%d]\n",i,l,i-1);
        // printf("%d -> [%d,%d]\n",i,i+1,r);
     }
    for(int i=1;i<=2*n;++i)
        if(!dfn[i])
            tarjan(i);
    for(int i=1;i<=2*n;i+=2)
        if(belong[pos[i]]==belong[pos[i+1]]) return 0;
    return 1;
}
int main() {
    n=read();
    for(int i=1;i<=n;++i) {
        a[2*i-1].id=2*i-1,a[2*i-1].val=read();
        a[2*i].id=2*i,a[2*i].val=read();
    }
    sort(a+1,a+1+n+n);
    for(int i=1;i<=n+n;++i) pos[a[i].id]=i,val[i]=a[i].val;
    int l=0,r=1e9,ans=0;
    while(l<=r) {
        int mid=(l+r)>>1;
        if(check(mid)) l=mid+1,ans=mid;
        else r=mid-1;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 35584
if __name__ == "__main__":
    S = input()

    easyflg = True
    for i in range(len(S)):
        if (i+1) % 2 == 0:
            if S[i] != "L" and S[i] != "U" and S[i] != "D": 
                easyflg = False
        else:
            if S[i] != "R" and S[i] != "U" and S[i] != "D": 
                easyflg = False

    if easyflg == True:
        print("Yes")       
    else:
        print("No") 
    

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n; ll a[105];
ll sum;

struct edge
{
	ll to,cap,rev;
};
#define SZ 205
vector<edge>G[SZ];
bool used[SZ];
ll itr[SZ],level[SZ];
void add_edge(ll from,ll to,ll cap)
{
	G[from].push_back((edge){to,cap,G[to].size()});
	G[to].push_back((edge){from,0,G[from].size()-1});
}
void bfs(ll s){
	memset(level,-1,sizeof(level));
	queue<ll>q;
	level[s] = 0; q.push(s);
	while(!q.empty()){
		ll v = q.front(); q.pop();
		for(int i=0;i<G[v].size();i++){
			edge &e = G[v][i];
			if(e.cap>0 && level[e.to]<0){
				level[e.to] = level[v]+1;
				q.push(e.to);
			}
		}
	}
}
ll dfs(ll v,ll t,ll f)
{ 
	if(v==t) return f;
	for(int i=itr[v];i<G[v].size();i++)
	{
		edge &e=G[v][i];
		if(e.cap>0 && level[v] < level[e.to])
		{ 
			ll d=dfs(e.to,t,min(f,e.cap));
			if(d>0) 
			{ 
				e.cap-=d;
				G[e.to][e.rev].cap+=d;
				return d;
			}
		}
	}
	return 0;
}
ll max_flow(ll s,ll t)
{ 
	ll flow=0,f;
	while(bfs(s),level[t]>=0)
	{
		memset(itr,0,sizeof(itr));
		while( (f=dfs(s,t,1e18)) > 0){
			flow += f;
		}
	}
	return flow;
}

int main(){
	cin>>n;
	repn(i,n){
		cin>>a[i];
		if(a[i] > 0){
			add_edge(102,i,a[i]);
			add_edge(i,103,0);
			sum += a[i];
		}
		else{
			add_edge(102,i,0);
			add_edge(i,103,-a[i]);
		}
	}
	//cout<<sum<<endl;
	repn(i,n) repn(j,i-1){
		if(i%j == 0){
			add_edge(i,j,1e16);
		}
	}
	ll x = max_flow(102,103);
	cout<<sum-x<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://abc073.contest.atcoder.jp/tasks/abc073_d>
問題文============================================================
 Atcoder国には N 個の町があり、M 本の双方向に移動可能な道で結ばれています。
 
 また、 i 本目の道は町 Ai と町 Bi の間を距離 Ci で結んでいます。
 
 joisinoお姉ちゃんは、この国の R 個の町 r1,r2..rR を訪れることとなりました。
 
 最初に訪れる町までの移動と、最後に訪れる町からの移動は空路で行うが、それ以外は道を使わなければなりません。
 
 町を訪れる順番を、道での移動距離が最小となるように決めた時の移動距離を答えてください。
 
=================================================================

解説=============================================================
 
 
 dp[i][j] := 現在値が i個目の目的地 の時、 j(集合）の目的地に到達済みの時の最小距離
================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll N,M,R; cin >> N >> M >> R;
    vector<ll> r(R); for(auto &in:r){ cin >> in; in--; }
    vector<vector<ll>> G(N,vector<ll>(N,INF));
    for(int i = 0; i < N;i++) G[i][i] = 0;
    for(int i = 0; i < M;i++){
        ll A,B,C; cin >> A >> B >> C;
        A--; B--;
        G[A][B] = G[B][A] = min(G[A][B],C);
    }
    for(int i = 0; i < N;i++) for(int j = 0; j < N;j++) for(int k = 0; k < N;k++)
        G[j][k] = min(G[j][i] + G[i][k],G[j][k]);
    
    vector<vector<ll>> dp(R,vector<ll>(1<<R,LINF));
    for(int i = 0 ; i < R;i++) dp[i][1<<i] = 0;
    for(int j = 0; j < (1<<R);j++){
        for(int i = 0; i < R;i++){
            if(dp[i][j] == LINF) continue;
            for(int k = 0; k < R; k++){
                if((j>>k)&1) continue;
                dp[k][j|(1<<k)] = min(dp[k][j|(1<<k)],dp[i][j] + G[r[i]][r[k]]);
            }
        }
    }
    ll ans = LINF;
    for(int i = 0; i < R;i++) ans = min(ans,dp[i][(1<<R)-1]);
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int x = Integer.parseInt(s[0]);
        int n = Integer.parseInt(s[1]);
        if(n == 0) {
            System.out.print(x);
            return;
        }

        s = br.readLine().split(" ");
        HashSet<Integer> set = new HashSet<>();
        for(int i=0; i<n; i++)
            set.add(Integer.parseInt(s[i]));
        
        if(!set.contains(x)) {
            System.out.print(x);
            return;
        }
        int nearest = 1;
        while(true) {
            if(!set.contains(x-nearest)) {
                System.out.print(x-nearest);
                return;
            }

            if(!set.contains(x+nearest)) {
                System.out.print(x+nearest);
                return;
            }
            nearest++;
        }
    }
}

Measured memory_bytes: 32736
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int x,n;
	cin>>x>>n;
	vector<int>arr(n);
	for(int i=0; i<n; i++)
	 cin>>arr[i];
	sort(arr.begin(),arr.end());
	int num1=x;
	int num2=x;
	while(binary_search(arr.begin(),arr.end(),num1))
	{
		num1++;
	}
	while(binary_search(arr.begin(),arr.end(),num2))
	{
		num2--;
	}
	if(abs(x-num1)<abs(x-num2))
	{
		cout<<num1;
	}
	else if(abs(x-num1)>=abs(x-num2))
	 cout<<num2;
	return 0;
}

Measured memory_bytes: 3596
<?php
	fscanf( STDIN, "%d", $n );
	$i = 1;
	do {
		$x = $i;
		if( 0 == $x % 3 ) {
			print ' '.$i;
		} else {
			do {
				if( 3 == $x % 10 ) {
					print ' '.$i;
					break;
				} else {
					$x /= 10;
				} 
			} while( $x );
		}
	} while( ++$i <= $n );
	print PHP_EOL;
	
	return;

?>

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

int main() {
  int n;
  cin>>n;
  if (n == 100000) {
    cout<<90909<<endl;
  }
  else if (n >= 10000) {
    cout<<n-9090<<endl;
  }
  else if (n >= 1000) {
    cout<<909<<endl;
  }
  else if (n >= 100) {
    cout<<n-90<<endl;
  }
  else if (n >= 10) {
    cout<<9<<endl;
  }
  else {
    cout<<n<<endl;
  }
}

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

bool dfs(string &s, int p){
  if(s.size() == p)
    return true;
  
  bool r = false;
  string words[] = {"dream", "dreamer", "erase", "eraser"};
  for(int i=0; i<4; i++){
    bool ok = true;
    for(int j=0; j<words[i].size(); j++)
      if(words[i][j] != s[p+j]){
        ok = false;
        break;
      }
    if(ok)  r = r || dfs(s, p+words[i].size());
  }
  return r;
}

int main(){
  string s;  cin >> s;
  string ans = "NO";
  if(dfs(s, 0))  ans = "YES";
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7516
#![allow(unused_imports, unused_variables, dead_code)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

trait InputValue {
    fn parse(s: &str) -> Self;
}

fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

const INF: i32 = 1000000000;

fn main() {
    let (n, m, r): (usize, usize, usize) = read();
    let rr: Vec<usize> = readnc();
    let rr: Vec<usize> = rr.into_iter().map(|r| r-1).collect();

    let mut graph: Vec<Vec<i32>> = vec![vec![INF; n]; n];
    for _ in 0..m {
        let (a, b, c): (usize, usize, i32) = read();
        graph[a-1][b-1] = c;
        graph[b-1][a-1] = c;
    }

    for k in 0..n {
        for i in 0..n {
            for j in 0..n {
                graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j]);
            }
        }
    }

    let mut dp = vec![vec![INF; r]; 1<<r];
    for ri in 0..r {
        dp[1<<ri][ri] = 0;
    }

    for i in 0..1<<r {
        for now in 0..r {
            if dp[i][now] == INF {
                continue
            }
            for ri in 0..r {
                if i & (1 << ri) >= 1 {
                    continue
                }
                let ti = i | (1 << ri);
                dp[ti][ri] = min(dp[ti][ri], dp[i][now] + graph[rr[now]][rr[ri]]);
            }
        }
    }

    let mut ans = INF;
    for now in 0..r {
        ans = min(ans, dp[(1<<r)-1][now]);
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
n, m, c = list(map(int, input().split()))
B = list(map(int, input().split()))
A = (list(map(int, input().split())) for _ in range(n))
ans = 0
cnt = 0
for i, u in enumerate(A):
    for j, v in enumerate(u):
        ans += v * B[j]

    ans += c
    if ans > 0:
        cnt += 1
    ans = 0
print(cnt)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

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

	ll ans = 0;
	ll a = x / 11;
	ans += 2 * a;
	if (x % 11 > 6) ans += 2;
	else if (x % 11 == 0) ans += 0;
	else ans++;

	dunk(ans);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

int X, Y;

int main(void){
    
    scanf("%d %d", &X, &Y);
    printf("%d\n", X + Y / 2);
    
    return 0;
}


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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

vector<int> f(const vector<int>& a) {
  int n = size(a);
  vector<int> res(n + 1);
  for (int i = 0; i < n; ++i) {
    ++res[max(i - a[i], 0)];
    --res[min(i + a[i] + 1, n)];
  }
  for (int i = 0; i < n; ++i) {
    res[i + 1] += res[i];
  }
  res.pop_back();
  return res;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  k = min(k, 100);
  vector<int> a(n);
  for (auto&& e : a) cin >> e;
  while (k--) {
    a = f(a);
  }
  for (int i = 0; i < n; ++i) {
    cout << a[i] << " \n"[i == n - 1];
  }
}


Measured memory_bytes: 4792
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>

#define ll long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++);
#define _GLIBCXX_DEBAC
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/

using namespace std;

int gcd(int a, int b) {
	int c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}
map<string, int> memo;


int main() {
	//sort(a.begin(),a.end());
	int k;
	cin >> k;
	vector<long long> p;
	 p = { 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 };
	 cout << p.at(k-1);
	
	return 0;
}









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

int main() {
	int n,i,a,b,x,y;
	cin>>n>>a>>b;

	int count=0;
	for(int i=0;i<n;i++)
	 {
	 	cin>>x>>y;
	 	if(x>=a && y>=b)
	 	  {
	 	  	++count;
	 	  }
	 }
	 cout<<count<<'\n';
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto N = readln.chomp.to!int;
    auto as = readln.split.to!(long[]);

    long r;
    for (;;) {
        bool flg;
        foreach (i, ref a; as) {
            if (a >= N) {
                flg = true;
                auto n = a / N;
                r += n;
                a = a % N;
                foreach (j, ref aa; as) {
                    if (i == j) continue;
                    aa += n;
                }
            }
        }
        if (!flg) break;
    }
    writeln(r);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

int main() {
	int n;
	cin >> n;
	pair <int, int> p[n];
	int mnl = MOD, mnr = 0, mxl = MOD, mxr = 0;
	for (int i = 0; i < n; i++) {
		cin >> p[i].ff >> p[i].ss;
		if (p[i].ff > p[i].ss)
			swap(p[i].ff, p[i].ss);
		mnl = min(mnl, p[i].ff);
		mnr = max(mnr, p[i].ff);
		mxl = min(mxl, p[i].ss);
		mxr = max(mxr, p[i].ss);
	}
	ll ans = 1LL * (mnr - mnl) * (mxr - mxl);
	int val = (mxr - mnl);
	sort(p, p + n);
	int tmx = p[n - 1].ff, tmn = MOD;
	// fixing minimum
	for (int i = 0; i <= n; i++) {
		ans = min(ans, 1LL * val * (tmx - min(tmn, ((i == n) ? tmn :  p[i].ff))));
		if (i == n)
			break;
		tmx = max(tmx, p[i].ss);
		tmn = min(tmn, p[i].ss);
	}
	cout << ans;
}


Measured memory_bytes: 1792
import itertools


def main():
    N, M = map(int, input().split())
    node_lst = [x for x in range(N)]
    edge_lst = [list(map(int, input().split())) for _ in range(M)]
    ans = 0

    for route in itertools.permutations(node_lst):
        is_visited = [False] * N
        is_visited[0] = True
        if route[0] != 0:
            continue

        for i in range(N - 1):
            if [route[i] + 1, route[i + 1] + 1] in edge_lst and is_visited[route[i + 1]] == False:
                is_visited[route[i + 1]] = True
            if [route[i + 1] + 1, route[i] + 1] in edge_lst and is_visited[route[i + 1]] == False:
                is_visited[route[i + 1]] = True

        if is_visited == [True] * N:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9204
H, W = map(int, input().split())
s = [input() for i in range(H)]

l = [[0 for i in range(W)] for j in range(H)]
r = [[0 for i in range(W)] for j in range(H)]
d = [[0 for i in range(W)] for j in range(H)]
u = [[0 for i in range(W)] for j in range(H)]

# Up-Light
for i in range(H):
    for j in range(W):
        if s[i][j] == "#":
            l[i][j] = 0
            u[i][j] = 0
            continue

        if j == 0:
            l[i][j] = 1
        else:
            l[i][j] = l[i][j-1] + 1

        if i == 0:
            u[i][j] = 1
        else:
            u[i][j] = u[i-1][j] + 1

# Right-Down
for i in range(H)[::-1]:
    for j in range(W)[::-1]:
        if s[i][j] == "#":
            r[i][j] = 0
            d[i][j] = 0
            continue

        if j == W-1:
            r[i][j] = 1
        else:
            r[i][j] = r[i][j+1] + 1

        if i == H-1:
            d[i][j] = 1
        else:
            d[i][j] = d[i+1][j] + 1

max_score = 0
for i in range(H):
    for j in range(W):
        score = l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3
        if score > max_score:
            max_score = score
print(max_score)


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

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

int main(){
    int N, M;
    cin >> N >> M;
    int L = 1, R = N;
    for(int i = 0; i < M; i++){
        int l, r;
        cin >> l >> r;
        chmax(L, l);
        chmin(R, r);
    }
    
    int ans = R - L + 1;
    if(ans < 0)ans = 0;
    cout << ans << endl;
    return 0;
}

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

a = int(input())

# 文字列の入力
s = input()

a = s.split(" ")
d = []
for b in a:
    d.append(int(b))

#print(d)

ans=0

while(1):
    c=1
    flg=0
    for b in d:
        if b%2==1:
            flg=1
    if flg==0:
        ans=ans+1
    else:
        break
    for i in range(len(d)):
        d[i]=d[i]/2

print(ans)


Measured memory_bytes: 3060
// https://atcoder.jp/contests/arc069/tasks/arc069_b
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
const int MAXN = 1e5 + 4;
int n;
char s[MAXN];
int a[MAXN];

int main() {
    cin >> n;
    cin >> s;
    s[n] = s[0], s[n + 1] = s[1];
    REP(i, 4) {
        a[0] = i & 1, a[1] = (i >> 1) & 1;
        FOR(j, 2, n + 2) a[j] = (s[j - 1] == 'x') ^ a[j - 1] ^ a[j - 2];
        if (a[0] == a[n] && a[1] == a[n + 1]) {
            for (int j = 0; j < n; ++j)
                cout << (a[j] ? "W" : "S");
            cout << "\n";
            return 0;
        }
    }
    cout << "-1\n";
    return 0;
}


Measured memory_bytes: 768
#include<set> 
#include<map>
#include<cmath>    
#include<queue>    
#include<vector>    
#include<cstdio>    
#include<ctime>   
#include<cstring>    
#include<iostream>    
#include<algorithm>    
#define INF 0x3f3f3f3f
using namespace std;
long long read(){
    long long f=1,x=0;char s=getchar();   
    while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}  
    while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}
    return x*f;
}
#define MAXN 50000
int main(){
	int a=read(),b=read();
	if(a>8||b>8) printf(":(\n");
	else printf("Yay!");
	return 0;
}  

Measured memory_bytes: 256
a = int(input())
ans = 0
if a < 10:
    ans = a
    print(ans)
elif 10 <= a < 100:
    print(9)
elif 100 <= a < 1000:
    ans = 9 + (a - 99)
    print(ans)
elif 1000 <= a < 10000:
    print(909)
elif 10000 <= a < 100000:
    ans = 9 + 900 + (a - 9999)
    print(ans)
else:
    print(90909)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main() {

  int N;
  cin >> N;
  vector<long long> x(N), y(N); 
  vector<long long> h(N);
  long long cx, cy;
  long long height;
  int Flag = 1;

  for ( int i = 0; i < N; i++ ){
    cin >> x.at(i) >> y.at(i) >> h.at(i);
  }

  for ( cx = 100; cx >= 0; cx-- ){
    for ( cy = 100; cy >= 0; cy-- ){

      for ( int i = 0; i < N; i++ ){
        if ( h.at(i) != 0 ){
            height = h.at(i) + abs( x.at(i) - cx ) + abs( y.at(i) - cy );
            break;
        }
      }

      Flag = 1;
      for ( int i = 1; i < N; i++ ){
        long long s = height - abs( x.at(i) - cx ) - abs( y.at(i) - cy );
        s = max( s, 0LL );
        if ( h.at(i) != s ){
          Flag = 0; break;
        }
      }
      if ( Flag == 1 ){
        cout << cx << " " << cy << " " << height << endl;
        return 0;
      }
    }
  }
}

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

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  long long n;
  cin>>n;
  long long a[100005];
  for(long long i=0;i<n;i++){
    cin>>a[i];
    if(a[i]==0){
      cout<<0<<endl;
      return 0;
    }
  }
  long long f=1;
  for(long long i=0;i<n;i++){
      if(f<=1000000000000000000/a[i]){
        f*=a[i];
      }else{
        cout<<-1<<endl;
        return 0;
      }
  }
  cout<<f<<endl;
  


}

Measured memory_bytes: 4412
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

ll mod_pow(ll n, ll k, ll p) {
  if (k == 0) return 1;
  ll res = mod_pow(n * n % p, k / 2, p);
  if (k & 1) res = res * n % p;
  return res;
}

int main() {
  ll n, k, ans = 0;
  cin >> n >> k;
  while (true) {
    if (n < pow(k, ans)) break;
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include<stdio.h>

int A[1000000], n;

int binarySearch(int key) {
    int left = 0;
    int right = n;
    int mid;

    while ( left < right ) {
        mid = (left + right) / 2;
        if ( key == A[mid] ) return 1;
        if ( key > A[mid] ) left = mid + 1;
        else if ( key < A[mid] ) right = mid; 
    }
    return 0;
}

int main() {
    int i, q, k, sum = 0;
    scanf("%d", &n);
    for (i = 0; i < n; i++ ) {
        scanf("%d", &A[i]);
    }
        scanf("%d", &q);
        for (i = 0; i < q; i++ ) {
            scanf("%d", &k);
            if ( binarySearch( k ) ) sum++;
        }
    printf("%d\n", sum);
    return 0;
}



Measured memory_bytes: 2108
def fib(n):
    a = 1
    b = 1
    if n == 0:
        print(a)
    elif n == 1:
        print(b)
    else:
        for i in range(n-1):
            c = a + b
            a , b = b , c
        print(c)

n = int(input())
fib(n)


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e15;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);



int main() {
    int n, m, x;
    cin >> n >> m >> x;

    int left = 0, right = 0;

    rep(i, m) {
        int a;
        cin >> a;
        if (a > x) {
            right++;
        } else {
            left++;
        }
    }


    cout << min(left, right) << endl;

}


Measured memory_bytes: 256
# from line_profiler import LineProfiler
from collections import deque
from sys import stdin

def main():
    while(True):
        W, H = map(int, stdin.readline().split())
        if not W: break
        tx,ty = map(int, stdin.readline().split())
        kx,ky = map(int, stdin.readline().split())
        ma = [[False]+[bool(1-int(a)) for a in stdin.readline().split()]+[False] for i in range(H)]
        ma = [[False]*(W+2)] + ma + [[False]*(W+2)]
        que = deque([[tx,ty,kx,ky,0]])
        pas = set()
        ans = "NA"
        while(que):
            tx,ty,kx,ky,c = que.popleft()
            if tx == kx and ty == ky:
                ans = c
                break
            if c+1 > 100: continue
            for dx,dy in [[-1,0],[0,-1],[1,0],[0,1]]:
                tdx, tdy = ( dx, dy) if ma[ty+dy][tx+dx] else (0,0)
                kdx, kdy = (-dx,-dy) if ma[ky-dy][kx-dx] else (0,0)
                if (tx+tdx,ty+tdy,kx+kdx,ky+kdy) in pas: continue
                que.append([tx+tdx,ty+tdy,kx+kdx,ky+kdy,c+1])
                pas.add((tx+tdx,ty+tdy,kx+kdx,ky+kdy))
        print(ans)

if __name__ == "__main__":
    # prf = LineProfiler()
    # prf.add_function(main)
    # prf.runcall(main)
    # prf.print_stats()
    main()


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

using namespace std;

const int N = (int)1e5 + 7;

int mod = (int)1e9 + 7;

int add(int a, int b) {
	return (a + b) % mod;
}

int mul(int a, int b) {
	return (a * 1LL * b) % mod;
}

int dp[2][N];
vector < int > gr[N];

void dfs(int v, int pr) {
	if (gr[v].size() == 1 && v != pr) {
		dp[0][v] = dp[1][v] = 1;
		return ;
	}
	for (int to : gr[v]) {
		if (to == pr) continue;
		dfs(to, v);
	}
	int res = 1;
	int res1 = 1;
	for (int to : gr[v]) {
		if (to == pr) continue;
		res = mul(res, add(dp[0][to], dp[1][to]));
		res1 = mul(res1, dp[0][to]);
		
	}
	dp[0][v] = res;
	dp[1][v] = res1;
}

int n;

main() {
	scanf("%d", &n);
	if (n == 1) {
		cout << 2;
		return 0;
	}
	for (int i = 1; i < n; i++) {
		int u, v;
		scanf("%d %d", &u, &v);
		gr[u].push_back(v);
		gr[v].push_back(u);
	}
	dfs(1, 1);
	cout << add(dp[0][1], dp[1][1]);
}



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

#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pf push_front
#define pb2 pop_back
#define pf2 pop_front
#define line printf("\n")
#define pq priority_queue
#define rep(k,i,j) for(int k = (int)i;k<(int)j;k++)
#define repd(k,i,j) for(int k = (int)i;k>=(int)j;k--)
#define ll long long
#define ALL(a) a.begin(),a.end()
#define sz(a) int((a).size())
#define vi vector<int>

using namespace std;

double EPS = 1e-9;
int INF = 1e9+7;;
long long INFLL = 1e17;
double pi = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};

clock_t first_attempt = clock();
inline void cek_time(){
	clock_t cur = clock()- first_attempt;
	cerr<<"TIME : "<<(double) cur/CLOCKS_PER_SEC<<endl;
}
inline void OPEN (string s) {
  freopen ((s + ".in").c_str (), "r", stdin);
  freopen ((s + ".out").c_str (), "w", stdout);
}

//end of template

const int maxn = 105;
int n,m;
string s[maxn];

int ada[39];
int main(){
    cin>>n>>m;
    rep(k,0,n){
        cin>>s[k];
        rep(i,0,m)ada[s[k][i]-'a']++;
    }
        
    int two = 0,four=0,one = 0;
    for(int ki = 1,ka = n;ki<=ka;ki++,ka--){
        
        for(int at = 1,bw = m;at<=bw;at++,bw--){
            if(at==bw && ki==ka)one++;
            else if(at==bw || ki==ka)two++;
            else four++;
        }
    }
    
    int bisa= 0;
    rep(k,0,four){
        rep(i,0,30)if(ada[i]>=4){
            ada[i]-=4;
            bisa++;
            break;
        }
    }
    
    rep(k,0,two){
        rep(i,0,30)if(ada[i]>=2){
            ada[i]-=2;
            bisa++;
            break;
        }
    }
    
    rep(k,0,one){
        rep(i,0,30)if(ada[i]>=1){
            ada[i]-=1;
            bisa++;
            break;
        }
    }
    
    if(bisa==four + one + two)printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <sstream>
#include <algorithm>
using namespace std;
#define pb push_back
#define mp make_pair
#define ms(a, b)  memset((a), (b), sizeof(a))
//#define LOCAL
typedef long long LL;
const int inf = 0x3f3f3f3f;
const int maxn = 15+10;
const int mod = 1e9+7;
LL a[maxn];
LL cnt (LL n) {
    LL num = 0;
    while(n>0) {
        num++;
        n &=(n-1);
    }
    return num;
}
int main() {
#ifdef LOCAL
    freopen("input.txt" , "r", stdin);
#endif // LOCAL
    LL n, k, i;
    scanf("%lld%lld", &n, &k);
    for(i=0;i<n;i++)   scanf("%lld", &a[i]);
    LL ans = 1000000000000LL;
    for(i=1;i<=(1<<n);i++){
        if(cnt(i)<k)    continue;
        LL now = 0;
        LL mx = 0;
        for(LL j=0;j<n;j++){
            LL x = a[j];
			if(i&(1<<j)){
				if(x <= mx){
					now += mx+1-x;
					x = mx+1;
				}
			}
			mx = max(mx,x);
        }
        if( now < ans )      ans = now;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
using System;

class Atcoder68
{
    public static void Main()
    {
        string[] input = Console.ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int a = int.Parse(input[1]);
        int b = int.Parse(input[2]);

        int plana = n * a;

        if (plana < b)
            Console.WriteLine(plana);
        else
            Console.WriteLine(b);
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    ll x;cin>>x;
    ans+=(x/500)*1000;
    x%=500;
    ans+=(x/5)*5;
    cout<<ans<<endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if X == 500*a+100*b+50*c:
                count += 1
print(count)

Measured memory_bytes: 3060
import numpy as np

dic = {}

n = int(input())

for i in range(n):
    name = input()
    if not name in dic:
        dic[name] = 1
    else:
        dic[name] += 1

maxv = np.max(np.asarray(list((dic.values()))))

answers = [k for k, v in dic.items() if v == maxv]

sorted_answer = sorted(answers)

for i in sorted_answer:
    print(i)


Measured memory_bytes: 42208
#define onlycc ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

typedef long long ll;

int n, cnt1, cnt2, cnt3;

int main()
{
    onlycc;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        if(a == b && cnt1 == 0) cnt1 = 1;
        else if(a == b && cnt1 == 1 && cnt2 == 0) cnt2 = 1;
        else if(a == b && cnt2 == 1) cnt3 = 1;
        else
        {
            cnt1 = 0;
            cnt2 = 0;
        }
    }

    if(cnt3) cout << "Yes";
    else cout << "No";

    return 0;
}


Measured memory_bytes: 3652
import java.util.*

fun main(args:Array<String>){
    solve()
}

fun solve(){
    val d = readint()
    val c = readints()
    val s = Array(d){IntArray(26)}
    for(i in 0 until d){
        s[i] = readints().toIntArray()
    }
    val ans = IntArray(d)

    fun score() : Long{
        val t = IntArray(26)
        var sum = 0L
        for(i in 0 until d){
            sum += s[i][ans[i]]
            t[ans[i]] = i
            for(j in 0 until 26){
                sum -= c[j] * (i - t[j])
            }
        }
        return sum
    }

    for(i in 0 until d){
        var ma = 0
        var mai = 0
        for(j in 0 until 26){
            if(ma < s[i][j]){
                ma = s[i][j]
                mai = j
            }
        }
        ans[i] = mai
    }

    var ma = score()

    repeat(10){
        for(i in 0 until d){
            for(j in 0 until 26){
                val t = ans[i]
                ans[i] = j
                val m = score()
                if(m > ma){
                    ma = m
                }
                else{
                    ans[i] = t
                }
            }
        }
    }

    for(i in 0 until d){
        println(ans[i] + 1)
    }
}



fun read() = readLine()!!
fun reads() = readLine()!!.split(" ")
fun readint() = readLine()!!.toInt()
fun readints() = readLine()!!.split(" ").map{it.toInt()}
fun readlong() = readLine()!!.toLong()
fun readlongs() = readLine()!!.split(" ").map{it.toLong()}

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

int main()
{
	int n,ans=0;
	cin >> n;
	vector<string> s(n);
	vector<int> t(n);
	string x;

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

	cin >> x;

	int count = 0;

	for (int i = 0; i < n; i++) {
		count++;
		if (s[i].compare(x) == 0) {
			break;
		}
	}

		for (int i = count; i < n; i++) {
			ans += t[i];
		}
		cout << ans << endl;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#define Cout(x)        cout << #x << " " << x << endl
#define ld long double
#define ll long long
#define vll vector<ll>
#define pll pair<ll ,ll >
#define vpll vector< pll >
#define pb push_back
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define fr(i,n) for(ll (i) = 0 ; (i) < (n) ; ++(i))
#define fr1(i,n) for(ll (i) = 1 ; (i) <= (n) ; ++(i))
#define frr(i,n) for(ll (i) = (n)-1 ; (i)>=0 ; --(i))
#define frab(i,a,b,c) for(ll (i) = a ; (i) < (b) ; (i)+=(c))
#define print(v) for( auto it: v) cout<<it<<" ";
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll A[300005];
ll dp[2005][2005];
ll cal( ll pos , ll s) {
	if (s < 0) return 0;
	if (s == 0) {
		return 1;
	}
	if (dp[pos][s] != -1) return dp[pos][s];
	ll ans = 0;
	for ( int i = 3; i <= s; i++) {
		if (s - i < 0) break;
		ans += cal(pos + 1, s - i);
		ans %= MOD;
	}
	dp[pos][s] = ans % MOD;
	return ans;
}
int main()
{
	ios;
 
	ll a, b, c, d, n, m, k,   q;


	double t;
	cin >> n;
	memset(dp, -1, sizeof(dp));
	cout << cal(0, n);


}


Measured memory_bytes: 35068
#include<stdio.h>
int main(){
  int W, H, x, y, r;
  scanf ("%d %d %d %d %d", &W, &H, &x, &y, &r);

  if (x - r >= 0 && y - r >= 0 && x + r <= W && y + r <= H) {
    printf ("Yes\n");
  } else {
    printf ("No\n");
  }

  return 0;
}


Measured memory_bytes: 2112
#include <iostream>
#include <vector>
#include <algorithm>

int main(){
  int N;
  std::cin >> N;
  std::vector<int> a(N);
  for(int i = 0; i < N; i++) std::cin >> a.at(i);
  std::sort(a.begin(), a.end());
  int colorMin = 0, colorMax = 0;
  int r = -1;
  for(int i = 0; i < N; i++){
    if(a.at(i) < 3200){
      if(a.at(i) / 400 != r){
        r = a.at(i) / 400;
        colorMin++;
        colorMax++;
      }
    }else{
      colorMin = std::max(colorMin, 1);
      colorMax++;
    }
  }
  std::cout << colorMin << " " << colorMax << std::endl;
}

Measured memory_bytes: 256
"use strict";
function Main(input) {
  input = input.split(" ").map(Number);
  let cval = input[0];
  let count = 0;
  while (cval) {
    count++;
    cval = Math.floor(cval / input[1]);
  }
  console.log(count);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include<iostream>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(int argc, char *argv[])
{
  int S[31] = {0};
  for(int i = 0;i < 30;i++){
    int a;
    scanf("%d",&a);
    S[a-1] = 1;
  }
  for(int i = 0;i < 30;i++){
    if(S[i] ==0){
    cout <<i+1<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100//000000000
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
#define T tuple<int,int,int> 
using namespace std;
 
vector<vector<int> > s;
vector<ll> c;

ll score(vector<int> held,int k){
    vector<int> ld(26,0);
    ll ans=0;

    rep(i,held.size()){
        int t=held[i];
        ld[t]=i+1;
        ans+=s[i][t];
        rep(j,26){
            ans-=c[j]*(i+1-ld[j]);
        }
    }
    for(int q=held.size(); q<held.size()+k; q++){
    rep(i,26){
        ans-=c[i]*(q+1-ld[i]);
    }
    }

    return ans;
}

int main(){
    int d; cin >> d;
    vector<ll> cc(26);
    c=cc;
    rep(i,26) cin >> c[i];
    vector<vector<int> > ss(d);
    s=ss;
    rep(i,d)rep(j,26){
        int a; cin >> a;
        s[i].push_back(a);
    }
 
    //vector<int> ld(26,0);
    vector<vector<int> > ds(26);
    vector<int> ans;
    rep(p,26){
        vector<int> days(0);
        ll tmps=-INF;
    rep(i,d){
        ll now=-INF;
        int whatday;
        rep(j,26){
            vector<int> tmp=days;
            tmp.push_back(j);
            ll sc=score(tmp,p);
            if(sc>now){
                whatday=j;
                now=sc;
            }
        }
        days.push_back(whatday);
    }
    ll nows=score(days,0);
    if(tmps<nows){
        ans=days;
        tmps=nows;
    }
    }
    rep(i,d) cout << ans[i]+1 << endl;
return 0;
}

Measured memory_bytes: 3764
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
using namespace std;
typedef long long ll;

int main(){
    int n;cin>>n;
    vector<int> v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    ll ans=0;
    sort(v.begin(),v.end());
    for(int i=0;i<n;i++)for(int j=i+1;j<n;j++){
        int k=v[i]+v[j];
        auto wow=lower_bound(v.begin()+j,v.end(),k);
        if(wow==v.end()){ans+=n-j-1;continue;}
        int yay=wow-v.begin()-1-j;
      //  cout<<yay<<endl;
        ans+=yay;
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    if(a+b >= a-b && a+b >= a*b) cout << a+b << endl;
    else if(a-b >= a+b && a-b >= a*b) cout << a-b << endl;
    else if(a*b >= a+b && a*b >= a-b) cout << a*b << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

int T, n, m;
const int maxn = 1000+5;
const ll MOD = 1e9+7;

bool a[maxn][maxn];
ll dp[maxn][maxn];

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  char c;
  for(int i = 0; i < n; i++)for(int j = 0; j < m; j++) cin >> c, a[i][j] = (c =='#');
  //for(int i = 0; i < n; i++, cout<<endl)for(int j = 0; j < m; j++) cout<<a[i][j];
  dp[0][0] = 1;

  for(int i = 0; i < n; i++)for(int j = 0; j < m; j++)
  {
    if(!i&&!j)continue; //=1
    dp[i][j] = 0;
    if(a[i][j]) continue;
    if(i > 0) dp[i][j] += dp[i-1][j], dp[i][j]%=MOD;
    if(j > 0) dp[i][j] += dp[i][j-1], dp[i][j]%=MOD;
  }
  cout << dp[n-1][m-1] << endl;
  return 0;
}


Measured memory_bytes: 9088
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
  n <- getInt
  as <- getIntList
  let oddNum = length (filter (\x -> odd x) as)
  let fourNum = length (filter (\x -> x `mod` 4 == 0) as)
  let otherNum = n - oddNum - fourNum
  let ans
       | fourNum + 1 == oddNum && otherNum == 0 = "Yes"
       | fourNum + 1 == oddNum && otherNum > 0 = "No"
       | fourNum == oddNum && otherNum >= 0 = "Yes"
       | fourNum < oddNum = "No"
       | otherwise = "Yes"
  putStrLn ans


Measured memory_bytes: 13876
//It doesn't matter how slow you go, Unless you don't stop.
#include<iostream>
#include<algorithm>
#include<bitset>
 
#include<cmath>
#include<cstring>
#include<climits>
 
#include<deque>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
 
#include<fstream>
#include<chrono>
using namespace std;
 
typedef long long LL;
typedef pair<LL,LL> p64;
typedef vector<LL> v64;
typedef map<LL,LL> mp64;
 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i,s,e) for(long long i=s;i<=e;i++)
#define brep(i,s,e) for(long long i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define DANGER std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
const int mod = 1e9+7;
void solve()
{
     int n;cin>>n;
        LL dp[n+1];
     memset(dp,0,sizeof dp);
     dp[0] = 1;
     for(int i=3;i<=n;i++){
         for(int j=3;j<=n;j++){
             if(i>=j){
             dp[i] += (dp[i-j]);
             dp[i] %= mod;
             }

         }
     }
     cout<<dp[n]<<endl;
}
 
int main()
{
    DANGER;
    ofstream out("output.txt");
 
    auto start = chrono::high_resolution_clock::now();
    
    LL t = 1;
    // cin>>t;
    rep(test,1,t)
    {
        solve();
    }
    
    auto stop = chrono::high_resolution_clock::now();
    // auto duration = chrono::duration_cast<chrono::milliseconds>(stop - start); 
    // cout << "Time taken by function: " << duration.count() << " milliseconds" << endl;
}

Measured memory_bytes: 3676