akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main(void){
    long N,a[5],p;
    cin >> N;
    for(int i=0;i<5;i++){
        cin >> a[i];
        if(i==0){
            p=a[0];
        }else{
            if(p>a[i]){
                p=a[i];
            }
        }
    }
    
    long dam,time;
    if(N%p==0){
        dam = N / p;
    }else{
        dam = N / p + 1;
    }
    
    time = 4 + dam;
    
    
    
    cout << time << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>

using namespace std;

#define ll long long
#define vec vector
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

int main()
{
	ll n;
	string s;
	bool flag = false;

	cin >> n;

	forll(i, 0, 10)
	{
		forll(j, 0, 10)
		{
			if (i*j == n)
			{
				flag = true;
				break;
			}
		}
	}

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

}

Measured memory_bytes: 256
//#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    ll  a, b, c, d;
    cin >> a >> b >> c >> d;

    print(max(a * c, max(a * d, max(b * c, b * d))));
    
}


Measured memory_bytes: 3652
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(str, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]


def sosu(x):
    for i in range(2, int(sqrt(x)+1)):
        if x % i == 0:
            return False
    return True


mod = 1000000007
inf = float('INF')


def A():
    S, W = LI()
    if S>W:
        print('safe')
    else:
        print('unsafe')

    
    return

# B


def B():
    A,B,C,D=LI()
    while(1):
        C=C-B
        if C<=0:
            print('Yes')
            break
        A=A-D
        if A<=0:
            print('No')
            break



    return

# C


def C():
    N=II()
    S=['i']*N
    for i in range(N):
        S[i]=input().rstrip()
    print(len(set(S)))

    return


def D():
    N,K=LI()
    P=LI()
    tmp=sum(P[:K])
    s=0
    pp=sorted(P, reverse=True)
    tmpmax=sum(pp[:K])
    for i in range(K,N+1):
        if (P[i-1]>P[s-1] and s!=0):
            tmp2=sum(P[s:i])
            if (tmp2==tmpmax):
                tmp=tmp2
                break
            tmp=max(tmp,tmp2)
        s+=1
        

    print((tmp+K)/2)
    return

# E


def E():
    N, K = LI()
    A = LI()
    F = LI()
    A.sort(reverse=True)
    F.sort()
    cost = []
    for i in range(len(N)):
        cost.append(A[i]*F[i])

    a = F[cost.index(max(cost))]

    return

# F


def F():
    N, M = LI()

    value = [0] * M
    power = [0] * M
    for i in range(M):
        a, b = LI()
        value[i] = a
        c = LI()
        L = ['0'] * N
        for k in c:
            L[k - 1] = '1'
        bint = ''.join(L)
        power[i] = int(bint, 2)
    bint = ''.join(list(['1'] * N))
    dp = [inf] * (int(bint, 2)+1)
    t = 0
    cost = 0

    dp[0] = 0
    for s in range(int(bint, 2) + 1):
        for i in range(M):
            t = s | power[i]
            cost = dp[s] + value[i]
            dp[t] = min(dp[t], cost)
    print(-1) if(dp[-1] == inf) else print(dp[-1])

    return

    # you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")


def solution(S):
    # write your code in Python 3.6
    N = len(S)

    pass


# Solve
if __name__ == '__main__':

    C()


Measured memory_bytes: 103576
/**
*    author:  Dooloper
*    created: 11.07.2020 20:58:45
**/

#include <bits/stdc++.h>

#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int,int>;
using ll = long long;

const int mod = 1000000007;
class mint {
    long long x;
public:
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int l,r,d;
  cin >> l >> r >> d;
  int ans = 0;
  for(int i = l; i <= r; i++){
    if(i%d == 0) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const int nmax=1000010;
ll fac[nmax],finv[nmax],inv[nmax];
 
void COMinit(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<nmax;i++){
    fac[i]=fac[i-1]*i%mod;
    inv[i]=mod-inv[mod%i]*(mod/i)%mod;
    finv[i]=finv[i-1]*inv[i]%mod;
  }
}
ll com(int n,int k){
  if(n<k||n<0||k<0){
    return 0;
  }
  return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}
int main(){
  COMinit();
  int n;cin >> n;
  vector<int> a(n+1);
  map<int,int> mp;
  for(int i=0;i<n+1;i++){
    cin >> a[i];
    mp[a[i]]++;
  }
  int l=-1,r;
  for(int i=0;i<n+1;i++){
    if(mp[a[i]]==2){
      if(l==-1){
        l=i;
      }
      else{
        r=i;
      }
    }
  }
  for(int i=1;i<=n+1;i++){
    cout << (com(n+1,i)+10*mod-com(l+n-r,i-1))%mod << endl;
  }
}

Measured memory_bytes: 29696
#include <iostream>
#include <cmath>
#include <cstdio>

int main(){
	double q, x;
	while(std::cin >> q, q != -1){
		x = q/2;
		while(fabs(x*x*x-q) >= 0.00001*q){
			x = x - (x*x*x-q) / (3*x*x);
		}
		printf("%.6lf\n", x);
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    string s;
    cin >> s;
    int n = (int)s.size();
    int ans = n;
    rep(i,n-1){
        if(s[i]!=s[i+1]) ans = min(ans,max(i+1,n-(i+1)));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3728
fun main(args: Array<String>) = yorukatsu22d()

fun yorukatsu22d() {
    data class Card(val amount: Long, val value: Long)

    val (n, m) = readLine()!!.split(' ').map { it.toInt() }
    val aList = readLine()!!.split(' ').map { it.toLong() }
    val bcList = (1..m).map {
        readLine()!!.split(' ').map { it.toLong() }.let { Card(it[0], it[1]) }
    }

    val cards = (aList.groupBy { it }.map { Card(it.value.size.toLong(), it.key) } + bcList)
        .sortedByDescending { it.value }.toTypedArray()

    var remainToTake = n.toLong()
    var answer = 0L

    for ((amount, value) in cards) {
        if (remainToTake <= amount) {
            answer += remainToTake * value
            break
        } else {
            answer += amount * value
            remainToTake -= amount
        }
    }

    println(answer)
}


Measured memory_bytes: 135124
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>

// #include <unordered_set>
// #include <unordered_map>

#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())

#define pb push_back
#define mp make_pair

int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}

typedef std::pair<int, int> P;
typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = INF * 1ll * INF;
const ld DINF = 1e200;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

using namespace std;

// #define int long long

int main(){
  

    ios::sync_with_stdio(false);
    cin.tie(0);
	//cin高速化

    int n;
    cin>>n;

    // int a[3][n];

    int table1[n]={0};
    int table2[n]={0};
    int a[n]={0};
    int b[n]={0};

    int sum_a=0;
    int sum_b=0;

    REP(i,n){
    	cin>>a[i];
    	sum_a+=a[i];
    }

    REP(i,n){
    	cin>>b[i];
    	sum_b+=b[i];
    }

    // REP(i,n){
    // 	cout<<a[i]<<" ";
    // }cout<<endl;

    REP(i,n){
    	
    	// ans+=a[i];
    }

    int tmp=0;
    REP(i,n){
    	tmp+=a[i];
    	table1[i]=tmp;
	}

	tmp=0;
	for(int i=n-1;i>=0;i--){
		tmp+=b[i];
		table2[i]=tmp;
	}
    

    // REP(i,n){
    // 	cout<<table1[i]<<" ";
    // }cout<<endl;

    // REP(i,n){
    // 	cout<<table2[i]<<" ";
    // }cout<<endl;

    int ans=-1;
    REP(i,n){
    	ans=max(ans,table1[i]+table2[i]);
    }

    cout<<ans<<endl;


	


}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int N,M,result = 0;
    int max_L = 0;
    int min_R = 100000;
    int L,R = 0;
    
    if(scanf("%d",&N) == 1);
    if(scanf("%d",&M) == 1);

    for (int i=0; i<M; i++){
        if(scanf("%d",&L) == 1);
        if(scanf("%d",&R) == 1);
        if (max_L < L) {
            max_L = L;
        }
        if (min_R > R) {
            min_R = R;
        }
    }
    if (min_R > max_L) {
        result = min_R - max_L + 1;
    }else if(min_R == max_L){
        result = 1;
    }else{
        result = 0;
    }
    printf("%d\n",result);
    return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int X, A;
  cin >> X >> A;
  cout << ((X<A)?"0":"10") << '\n';
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using namespace std;

int main() {
    fastIO;
    char b;
    cin >> b;
    if (b == 'A')
        cout << 'T';
    else if (b == 'T')
        cout << 'A';
    else if (b == 'G')
        cout << 'C';
    else if (b == 'C')
        cout << 'G';
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <random>
#include <cassert>
#include <numeric>
#define ll long long int
#define LL unsigned long long
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
using namespace std;

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
const int MOD = 1000000007;



int main() {
    string a, b; cin >> a >> b;
    int na = a.size(), nb = b.size();
    if(na > nb) cout << "GREATER" << endl;
    else if(na < nb) cout << "LESS" << endl;
    else{
        rep(i,na){
            if(a[i] > b[i]){
                cout << "GREATER" << endl;
                return 0;
            }else if(a[i] < b[i]){
                cout << "LESS" << endl;
                return 0;
            }
        }
        cout << "EQUAL" << endl;
    }
}


Measured memory_bytes: 3564
let readFloatArray () =
    stdin.ReadLine().Split(" ") |> Array.map float

stdin.ReadLine()

()
|> readFloatArray
|> fun [| t; a |] ->
    ()
    |> readFloatArray
    |> Array.indexed
    |> Array.sortBy (fun (_, h) -> t - h * 0.006 - a |> abs)
    |> Array.head
    |> fun (i, _) -> i + 1
    |> printfn "%d"


Measured memory_bytes: 30588
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define nl cout<<"\n";
vector<int> graph[100005];
int dp[100005];
int visi[100005];

int dfs(int x)
{
	visi[x]=1;
	int cnt=0;
	for(int i=0; i<graph[x].size(); i++)
	{
		int node=graph[x][i];
		if(visi[node])
			cnt=max(cnt,dp[node]+1);
		else
		{
			dp[node]=dfs(node);
			cnt=max(cnt,dp[node]+1);
		}
	}
	dp[x]=cnt;
	return cnt;
}

int main()
{
	
	int n,m,ans;
	cin>>n>>m;
	memset(dp, 0, sizeof(dp));
	memset(visi, 0, sizeof(visi));
	for(int i=1; i<=m; i++)
	{
		int t1,t2;
		cin>>t1>>t2;
		graph[t1].push_back(t2);
	}
	for(int i=1; i<=n; i++)
	{
		if(!visi[i])
			ans=max(ans,dfs(i));
		else
			ans=max(ans,dp[i]);
		
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define rep(i, n) for(int i=1; i<n; i++)
using namespace std;
int main(void){
    int a=0, b=0, k=0;
    cin >> a >> b >> k;
    vector<int>L;
    rep(i, 101) if(a%i==0 and b%i==0) L.push_back(-i);
        sort(L.begin(), L.end());
    cout << -L[k-1] << endl;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x real() 
#define y imag()
#define px second
#define py first
using namespace std;
typedef complex<double> point;
typedef pair <double,double> P;
P G[100001];
vector <P> stc;
vector <point> pol;
 
bool eq(double a,double b){return (abs(a-b)<=(1e-9));}
bool on_segment(point a,point b,point c){return eq(abs(b-a),abs(a-c)+abs(b-c));}
double get_r(point a,point b,point c){
  b-=a,c-=a;
  b*=conj(c);
  return arg(b);
}
int solve(point a){
  for(int i=0;i<(int)pol.size();i++)
    if(on_segment(pol[i],pol[(i+1)%pol.size()],a)) return 1;
  
  double sum=0;
  for(int i=0;i<(int)pol.size();i++)sum+=get_r(a,pol[i],pol[(i+1)%pol.size()]);
  
  if(eq(sum,0))return 0;
  return 2;
}
//
 
int ccw(point a,point b,point c) {
  point ab=b-a, ac =c-a;
  point d =ac*conj(ab); 
  if(d.y > 0) return true;
  return false;
}

int mk(int i,int flg) {
  point av = point(stc[stc.size()-2].px,stc[stc.size()-2].py);
  point bv = point(stc[stc.size()-1].px,stc[stc.size()-1].py);
  point cv = point(G[i].px,G[i].py);
  if(ccw(av,bv,cv) && stc.size()!=1)stc.pop_back(),i+=flg;
  else  stc.push_back(G[i]);
  return i;
}

int main() {
  int n;
  while(cin >> n,n){
    pol.clear();
    stc.clear();
    for(int i=0;i<n;i++)scanf("%lf,%lf",&G[i].px,&G[i].py);
    sort(G,G+n);
   
    stc.push_back(G[0]),stc.push_back(G[1]);
    for(int i=2;i<n;i++) i=mk(i,-1);
    for(int i=n-2;i>=0;i--) i=mk(i,1);

    
    int ans=0;
    for(int i=0;i<(int)stc.size()-1;i++) pol.push_back(point(stc[i].px,stc[i].py));

    for(int i=0;i<n;i++) ans+=(solve(point(G[i].px,G[i].py))==2);
    cout <<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 2924
N = int(input())
A = list(map(int, input().split()))
ans = [[0, 0] for i in range(N)]
for i in range(N):
    ans[i] = [A[i], i]

ans.sort(key=lambda x: x[0])
ans_str = [str(ans[i][1] + 1) for i in range(N)]
print(" ".join(ans_str))


Measured memory_bytes: 28768
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)

constexpr int MAX_N = 50;

using ll = long long;

int N, A, B;
std::vector<ll> v;

ll comb[MAX_N+1][MAX_N+1];

int main()
{
  scanf( "%d%d%d", &N, &A, &B );
  rep( i, N )
  {
    ll x;
    scanf( "%lld", &x );
    v.push_back( x );
  }

  double ave = 0;

  std::sort( v.begin(), v.end(), std::less<ll>() );

  ave = std::accumulate( v.begin()+N-A, v.end(), 0.0 ) / A;

  int cnt = std::count( v.begin(), v.end(), v[N-A] );

  int p = N-A;
  while( p <= N && v[p] == v[N-A] )
    ++p;

  rep( i, N+1 )
    comb[i][0] = comb[i][i] = 1;

  rep( i, N ) rep( j, i )
    comb[i+1][j+1] = comb[i][j+1] + comb[i][j];

  printf( "%.6f\n", ave );

  ll ans = 0;

  if( *std::min_element( v.begin()+N-A, v.end() ) == *std::max_element( v.begin()+N-A, v.end() ) )
  {
    repi( j, A, std::min( B, cnt )+1 )
      ans += comb[cnt][j];
  }
  else
    ans = comb[cnt][A-(N-p)];
  
  printf( "%lld\n", ans );

  //printf( "p: %d, cnt: %d, N-p: %d, A-(N-p): %d\n", p, cnt, N-p, A-(N-p) );

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
         
typedef long long ll;
using namespace std;
        
#define F first
#define S second
#define sqr(x) x*x
#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define repit(i, n) for(auto it = n.begin(); it != n.end(); ++it)
       
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b){if(b==0)return a;else return gcd(b,a%b);}
int lcm(int a,int b){return abs(a*b)/gcd(a,b);}
          

int main(){ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin >> n;
    if(n == 1){
        cout << 1;
        exit(0);
    }
    int ans = 0;
    int cnt = 0;
    int cnt1 = 0;
    for(int i = 2; i <= n; i += 2){
        int k = i;
        while(k % 2 == 0){
            k = k / 2;
            cnt++;
        }
        if (cnt > cnt1){
            cnt1 = cnt;
            ans = i;
        }
        cnt = 0;
    }
    cout << ans;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.stream.*;
class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String S,P;
        S = input.next();
        int n = S.length();
        P = input.next();
        boolean ans = false;
        S += S.substring(0,P.length()-1);
        for (int i = 0; i < n; i++){
            String tmp = S.substring(i,i+P.length());
            if (tmp.equals(P)){
                ans = true;
                break;
            }
        }
        if (ans){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 26188
#!python3

LI = lambda: list(map(int, input().split()))

# input
A, B = LI()


def main():
    a = 100 if A == 1 else A
    b = 100 if B == 1 else B
    if a > b:
        ans = "Alice"
    elif a < b:
        ans = "Bob"
    else:
        ans = "Draw"
    print(ans)


if __name__ == "__main__":
    main()


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

int main(){
  int N;
  string S;
  map<string, int> cnt;
  
  cin >> N;
  int cnt_max = 0;
  for(int i = 0;i < N;i++){
    cin >> S;
    cnt_max = max(cnt_max, ++cnt[S]);
  }
  
  for(auto itr = cnt.begin();itr != cnt.end(); itr++){
    if(itr->second == cnt_max) cout << itr->first << endl;
  }
  
  return 0;
}

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

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

  char s[300001];
  scanf("%s", s);

  int max = INT_MIN;
  int arg_max = 0;
  int count = 0;
  rep(i,n) {
    count += (s[i] == 'W') ? -1 : 1;
    if (count > max) {
      max = count;
      arg_max = i;
    }
  }

  int ans = 0;
  rep(i,n) {
    if (i < arg_max) {
      if (s[i] == 'W') ans++;
    }
    else if (i > arg_max) {
      if (s[i] == 'E') ans++;
    }
  }

  printf("%d\n", ans);

  return 0;
}


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

const ll MX = 1e18;


int main(){
  int n;
  cin >> n;
  ll ans = 1;
  bool ng = false;
  for(int i=0; i<n; i++){
  	ll a;
    cin >> a;
    if(a==0){
      cout << 0 << endl;
      return 0;
    }
    if(ng || MX/ans < a){
      ng = true;
    }
    ans *= a;
  }
  
  if (ng) cout << -1 << endl;
  else cout << ans << endl;
  return 0;


}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    string s;
    std::deque<int> deq;
    while (cin>>s) {
        for (int i=0;i<s.size();i++) {
            deq.emplace_back(s.at(i)-48);
        }
        for (int j=9;j>0;j--) {
            for (int k=0;k<j;k++) {
                int sum = deq[k]+deq[k+1];
                int keta = sum-((sum/10)*10);
                deq.emplace_back(keta);
            }
            deq.erase(deq.begin(),deq.begin()+j+1);
        }
        cout<<deq[0]<<endl;
        deq.clear();
    }
}


Measured memory_bytes: 3172
/*
** Author: MAC45
*/

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
main()
{
    ll N,M;
    cin>>N;
    ll A[N+1]= {0};
    for(int i=1; i<N; i++)
    {
        cin>>M;
        A[M]++;
    }
    for(int i=1; i<=N; i++)
        cout<<A[i]<<endl;
    return 0;
}


Measured memory_bytes: 5188
const main = (input: string) => {
  const S = input.trim().split("");
  const X = 753;
  let sumArr = [];

  for (let i = 0; i < S.length - 2; i++) {
    sumArr.push(Math.abs(X - parseInt(S[i] + S[i + 1] + S[i + 2])));
  }

  console.log(Math.min(...sumArr))
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

int main()
{
    int N = 0;
    string S;
    string alphabet = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};

    /*入力*/
    cin >> N;
    cin >> S;

    /*メイン処理*/
    int size = S.size();
    int array[10000] = {0};
    array[size] = {-1};
    string ans = S;

    for (int i = 0; i < size; i++) {
        for (int j = 0; j < 26; j++) {
            if ( S[i] == alphabet[j] ) {
                ans[i] = alphabet[ (j + N) % 26 ];
                break;
            }
        }
    }

    /*出力*/
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

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

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	N, S := sc.nextInt(), sc.nextRuneSlice()
	bits := make([]*BIT, 26)
	for i := 0; i < 26; i++ {
		bits[i] = NewBit(N)
	}
	for i, r := range S {
		alpha := int(r - 'a')
		bits[alpha].add(i+1, 1)
	}
	Q := sc.nextInt()
	for i := 0; i < Q; i++ {
		query := sc.nextInt()
		if query == 1 {
			idx, newc := sc.nextInt(), sc.nextRuneSlice()[0]
			oldc := S[idx-1]
			bits[int(newc-'a')].add(idx, 1)
			bits[int(oldc-'a')].add(idx, -1)
			S[idx-1] = newc
		} else {
			l, r := sc.nextInt(), sc.nextInt()
			ans := 0
			for i := 0; i < 26; i++ {
				sum := bits[i].sum(r) - bits[i].sum(l-1)
				if sum > 0 {
					ans++
				}
			}
			fmt.Fprintln(wtr, ans)
		}
	}
}

// 1-indexed
type BIT struct {
	data []int
}

func NewBit(n int) *BIT {
	return &BIT{
		data: make([]int, n+1),
	}
}

func (tree *BIT) add(a, v int) {
	for i := a; i <= len(tree.data)-1; i += i & -i {
		tree.data[i] += v
	}
}

func (tree *BIT) sum(to int) int {
	res := 0
	for i := to; i > 0; i -= i & -i {
		res += tree.data[i]
	}
	return res
}


Measured memory_bytes: 110080
l = [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(int(l[K-1]))

Measured memory_bytes: 3060
//>>>>>>>>>>>>>>>>>>>>>>>>>>JAI BAJRANG BALI<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<//
//😇😇😇😇😇😇😇😇😇😇😇😇😇😇😇😇😇😇😇😇😇😇😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😝😝😝😝😝😝😝😝😝😝😝😝😝😂😂😂😂😂😂😂😜😜😜😜😜😜😜😜😜😜😜
#define HARSH_JUDGE
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define db(x)                   cout<<#x<<"="<<x<<'\n'
#define db2(x,y)                 cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define setbits(x)      __builtin_popcountll(x)
#define str string
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fo(i,a,n) for(ll i=a;i<n;i++)
#define forr(i,n,a) for(ll i=n;i>=a;i--)
#define cases   long long t;cin>>t;while(t--)
#define eb emplace_back
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
#define ff first
#define ss second
#define pb push_back
#define mem(a,x) memset(a,x,sizeof(a))
#define sp(x,y)         fixed<<setprecision(y)<<x
#define nl '\n'
#define sz(x) ((int)(x).size())
const int mod = (int) 1e9 + 7 ;
const int MOD = (int) 998244353 ;
const int INF = (int) 1e18 ;
const ll N = 1e5 + 5;
#define printall(a) fo(i,0,a.size()) cout<<a[i]<<" "; cout<<endl;



typedef vector<int> vi;
typedef map<ll, ll> mll;
typedef set<int> si;
typedef unordered_set<int> usi;
typedef map<ll, int> mli;
typedef map<char, int> mci;
typedef vector<long long> vll;
typedef pair<int, int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;

bool cmp(const pair<ll, ll>& a, const pair<ll, ll>& b)
{

	return a.ss < b.ss;
}

// >>>>>>>>>>>>>>>>>>>>>>>>>>TOR DE DUSHMAN KI NALI<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<//

void solve()
{


	ll n, k;
	cin >> n >> k;
	ll a[n + 1], dp[n + 1];
	fo(i, 1, n + 1)cin >> a[i];
	fo(i, 2, n + 1)dp[i] = INF;
	dp[1] = 0;


	fo(i, 1, n)
	{
		for (ll j = i + 1; j <= i + k && j < n + 1; j++)
			dp[j] = min(dp[j], dp[i] + abs(a[i] - a[j]));
	}
	// fo(i, 1, n + 1)cout << dp[i] << nl;
	cout << dp[n];


	return;
}

int main()
{	fio
#ifndef HARSH_JUDGE
	freopen("inputf.in", "r", stdin);
	freopen("outputf.in", "w", stdout);
#endif
	ll t = 1;
	// cin >> t;
	// clock_t timest = clock();
	// cerr << "[Executes in " << (double)(clock() - timest) / CLOCKS_PER_SEC << "s]" << endl;
	while (t--)
	{
		solve();

	}
}

Measured memory_bytes: 5252
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007
ll fac[1000000];
ll finv[1000000];
ll inv[1000000];

void comb_init(){
  fac[0] = 1;
  fac[1] = 1;
  for(int i=2;i<1000000;i++){
    fac[i] = i*fac[i-1];
    fac[i] %= MOD;
  }
  inv[1] = 1;
  for(int i=2;i<1000000;i++){
    inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
  }
  finv[0] = 1;
  finv[1] = 1;
  for(int i=2;i<1000000;i++){
    finv[i] = inv[i]*finv[i-1];
    finv[i] %= MOD;
  }
}

ll comb(ll n,ll k){
  ll c;
  c = fac[n];
  c *= finv[k];
  c %= MOD;
  c *= finv[n-k];
  c %= MOD;
  return c;
}

int main(){
  ll n,q;
  cin >> n >> q;
  ll s,t,x,d;
  vector<pair<ll,pair<ll,ll> > > event;
  for(int i=0;i<n;i++){
    cin >> s >> t >> x;
    event.push_back(make_pair(s-x,make_pair(1,x)));
    event.push_back(make_pair(t-x,make_pair(0,x)));
  }
  for(int i=0;i<q;i++){
    cin >> d;
    event.push_back(make_pair(d,make_pair(10,i)));
  }
  sort(event.begin(),event.end());
  ll ans[q];
  multiset<ll> se;
  for(int i=0;i<event.size();i++){
    pair<ll,pair<ll,ll> >  now;
    now = event[i];
    ll type = now.second.first;
    if(type == 1) se.insert(now.second.second);
    else if(type == 0) se.erase(se.lower_bound(now.second.second));
    else{
      if(se.empty()) ans[now.second.second] = -1;
      else ans[now.second.second] = *(se.begin());
    }
  }
  for(int i=0;i<q;i++){
    cout << ans[i] << endl;
  }


  return 0;
}

Measured memory_bytes: 27108
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>

using namespace std;

int full_adder(bool bit[], int n){
	
	for(int i = 0; i < n; i++){
		if(bit[i] == false){
			bit[i] = true;
			return 0;
		}
		else bit[i] = false; 
	}
	
	bit[n] = true;
	return 0;
}



int main()
{

	long N, M, X;
	cin >> N >> M >> X;
	long C[N];
	long A[N][M];
	bool bit[N + 1];
		
	for(int i = 0; i < N; i++){
		cin >> C[i];
		bit[i] = false;
		for(int j = 0; j < M; j++){
			cin >> A[i][j];		
		}
	}
	bit[N] = false;
	long ans = 9999999999;
	while(!bit[N]){
		long skill[M];
		bool ok = true;
		for(long m = 0; m < M; m++){
			skill[m] = 0;
			for(long n = 0; n < N; n++){
				if(bit[n]){ 
					skill[m] += A[n][m];	
				}
			}
			
			if(skill[m] < X) ok = false;
		}
		if(ok){
			long cost = 0;
			for(long n = 0; n < N; n++){
				if(bit[n]) cost += C[n];
			}
			//cout << cost << endl;
			ans = min(cost,ans);
		}

		full_adder(bit,N); 
	}
	
	if(ans == 9999999999) cout << "-1" << endl;
	else cout << ans << endl;

	return 0;
}

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

using namespace std;

const int inf = 1e9 + 7;
const int N = 1e6 + 5;

bool f[30];

int main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i ++) {
		int ind = s[i] - 'a';
		f[ind] ^= true;
	}
	for (int i = 0; i < 30; i ++) {
		if (f[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <stack>
#include <cmath>
#include <functional>
#include <set>
#include <string>
#include <stdlib.h>
#include <iomanip>
#include <utility>
 
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i = a;i<=b;i++)
#define ll long long int
#define ii pair<int,int>
#define mp make_pair
#define pb push_back
#define iii pair<ii,int >
#define ff first
#define ss second
#define vi vector<int>
#define vc vector<char>
 
using namespace std;


int main(){
	int n,k;
	cin >> n >> k;
	int arr[n];
	FOR(i,n)cin >> arr[i];
	bool dp[k+1];
	FOR(i,arr[0])dp[i] = false;
	FORE(i,arr[0],k){
		bool winning = false;
		FOR(j,n){
			if(i-arr[j] >=0){
				if(!dp[i-arr[j]]){
					winning = true;
				}
			}
		}
		dp[i] = winning;
	}
	cout << (dp[k]?"First":"Second") << endl;

	return 0;
}


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

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    ll x = 0;
    for (ll i = 2; i < N; i++) x ^= A[i];
    
    ll sum = A[0]+A[1];
    
    ll t = sum-x;
    if (t%2 == 1 || t < 0) {
        cout << -1 << endl;
        return 0;
    }
    
    ll b = t/2;
    if (b > A[0]) {
        cout << -1 << endl;
        return 0;
    }
    for (int i = 50; i >= 0; i--) {
        if ((b>>i)&1) continue;
        if (((x>>i)&1) == 0) continue;
        if (b+(1LL<<i) > A[0]) continue;
        b += (1LL<<i);
    }
    
    if (b == 0 || (b^(sum-b)) != x) {
        cout << -1 << endl;
        return 0;
    }
    cout << A[0]-b << endl;
    return 0;
}


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

void solve(){
  int n; cin >> n;
  for(int i = 0; 4 * i <= n; i++){
    if((n - (4 * i)) % 7 == 0){
      cout << "Yes\n";
      return;
    }
  }
  cout << "No\n";
  return;
}
int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
while True:
    try:
        n = int(raw_input())
        
        cnt = 0;
        for i in range(0, 10):
            for j in range(0, 10):
                for k in range(0, 10):
                    for l in range(0, 10):
                        if n == i+j+k+l: cnt+=1
        print cnt

    except EOFError:
        break

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

int main(){
	int D,G; cin>>D>>G;
	G /= 100;
	vector<int> P(D), C(D);
	rep(i, D){ cin>>P[i]>>C[i]; C[i]/=100; }
	int ans = INT_MAX;
	for(int bin=1; bin<(1<<D); ++bin){ // max<2^10=1024
		int cnt = 0, tot = 0;
		rep(i, D) // max=10
			if(bin & 1<<i){
				cnt += P[i]; // count
				tot += P[i]*(i+1) + C[i]; // total
			}
		if(tot < G) continue;
		ans = min(ans, cnt);
		rep(i, D)
			if(bin & 1<<i){
				int rest_g = G - (tot - P[i]*(i+1) - C[i]);
				int p = max(0, (rest_g+i)/(i+1)); // round up
				ans = min(ans, cnt - (P[i] - p));
			}
	}
	cout<< ans <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int main(){
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    printf("%d\n", c - (min(a, b+c)-b));
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    long long n,a,b;
    while(cin >> n)
    {
        if(n == 1)cout << "Hello World" << endl;
        else
        {
            cin >> a >> b;
            cout << a+b <<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import math
a,b,h,m= map(int,input().split())


#hは何度回っているかを計算する
hkaku=float(h*30)+float(m*0.5)

#mは何度回っているか
mkaku=float(m*6)

#絶対角度
kaku=abs(hkaku-mkaku)

c2=a*a+b*b-2*a*b*math.cos(math.radians(kaku))

c=math.sqrt(c2)
print(c)

Measured memory_bytes: 9440
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(998244353)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= gyaku_kaijo(r); ret %= MOD;
  ret *= gyaku_kaijo(n-r); ret %= MOD;
  return ret;
}


int main(void){
  ll K,N;
  cin>>K>>N;
  reps(i,2*K){
    if(i==1) continue;
    ll ans = 0;
    ll l = (i+1)%2;

    ll p;
    if(i%2 == 1){
      p = min(K - (i-1)/2, (ll)(i-1) / 2);
    }else{
      p = min((ll)(i/2) - 1, K - i/2);
    }
    //cerr<<"P"<<p<<endl;
    rep(j,p+1){
      ans += nCr(p, j) * mpow(2, j) %MOD * (nCr(K-2*p-l+j-1 + N-j, N-j) %MOD + l*nCr(K-2*p-l+j-1 + N-j-1, N-j-1) %MOD);
      //cout<<(nCr(K-2*p-l+j-1, N-j))<<" a"<<endl;
      ans %= MOD;
    }

    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
long long n,l,r,ans;

int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>l>>r;
		ans+=r-l+1;
	}
	cout<<ans<<endl;
	return 0;
}

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

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

using namespace std;

int main(){

  while(1){
  
    int w,h;cin>>w>>h;if(w==0&&h==0){return 0;}

  int c[h+2][w+2];memset(c,0,sizeof(c));

  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      cin>>c[i][j];
    }
  }

  queue<pair<int,int> > q;

  bool a[h+2][w+2];

  for(int i=0;i<=h+1;i++){
    for(int j=0;j<=w+1;j++){
      a[i][j]=false;
    }
  }

  int ans=0;

  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      if(c[i][j]==1&&a[i][j]==false){
	ans++;
	q.push(make_pair(i,j));
	while(!q.empty()){
	  pair<int,int> tmp=q.front();q.pop();
	  int x=tmp.first;
	  int y=tmp.second;

	  for(int i=0;i<8;i++){
	    int checkx=dx[i]+x;
	    int checky=dy[i]+y;
	    if(a[checkx][checky]==false&&c[checkx][checky]==1){
	      a[checkx][checky]=true;
	      q.push(make_pair(checkx,checky));
	    }
	  }
	  
	}
      }
    }
  }

  cout<<ans<<endl;

  }
  
  return 0;
}



Measured memory_bytes: 3024
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int i, j;
	int ans[200005];
	if (n == 3)
	{
		ans[0] = 2;
		ans[1] = 5;
		ans[2] = 63;
	}
	else
	{
		ans[0] = 2;
		ans[1] = 3;
		ans[2] = 4;
		ans[3] = 9;
		i = 4;
		j = 1;
		while (n - i > 1)
		{
			if (6 * j >= 30000)
				break;
			ans[i] = 6 * j + 2;
			ans[i + 1] = 6 * j + 4;
			i += 2;
			j++;
		}
		j = 1;
		while (n - i > 1)
		{
			if (12 * j >= 30000)
				break;
			ans[i] = 12 * j + 3;
			ans[i + 1] = 12 * j + 9;
			i += 2;
			j++;
		}
		j = 1;
		while (n - i > 0)
		{
			ans[i] = 6 * j;
			j++;
			i++;
		}
	}
	for (i = 0; i < n - 1; i++)
		printf("%d ", ans[i]);
	printf("%d\n", ans[n - 1]);
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include<cassert>
    #include<cmath>
    #include<cstdint>
     
    #define INF 1e10
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
    #define ALL(a)  (a).begin(),(a).end()
     
    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<ll, ll>;
     
    const ll MOD = INF + 7;
     
     
     
    int main(){
       string s, t;
       cin >> s >> t;
       int cnt = 0;
       rep(i, s.size()){
          if(s[i] != t[i])cnt++;
       }
       cout << cnt << endl;
    }

Measured memory_bytes: 3464
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };


int main(){cout<<fixed<<setprecision(10);
		   int n,x;
           cin>>n>>x;
           if(x==1||2*n-1==x){
            cout<<"No"<<endl;
             return 0;
           }
           cout<<"Yes"<<endl;
           vin ans(2*n,-1);
           
           rep(i,1,2*n){
             if(i==n)ans[i]=x;
             else if(i==n-1)ans[i]=1;
             else if(i==n+1)ans[i]=2*n-1;
           }
           int cnt=1;
           rep(i,1,2*n){
             if(ans[i]!=-1)continue;
             cnt++;
             if(cnt==x)cnt++;
             ans[i]=cnt;
           }
           rep(i,1,2*n)cout<<ans[i]<<endl;;
}

Measured memory_bytes: 4048
#include<bits/stdc++.h>
using namespace std;
#define endl "\n";
#define M 1000000007
#define start ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define test ll t; cin>>t; while(t--)
typedef long long int ll;
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	start
	float n;
	cin>>n; 
	cout<<(6.28*n);
	// test
	// {

	// }
	return 0;
}

Measured memory_bytes: 3804
using System;

namespace abc153_b
{
    static class Program
    {
        static void Main(string[] args)
        {
            var items = Console.ReadLine().ToIntArray();
            // モンスターの体力
            var h = items[0];
            // アライグマの攻撃の種類
            var n = items[1];
            // 各攻撃の攻撃力
            var a = Console.ReadLine().ToIntArray();

            // 同じ技を2回使わずに勝てるか
            // →すべての攻撃を1回ずつ当てても体力が残っていたらNo

            for (var i = 0; i < a.Length; i++)
            {
                h -= a[i];
                if (h <= 0)
                {
                    break;
                }
            }

            Console.WriteLine($"{(h > 0 ? "No" : "Yes")}");
        }

        static int ToInteger(this string s)
        {
            return int.Parse(s);
        }

        static int[] ToIntArray(this string s, char separator = ' ')
        {
            var items = s.Split(separator);
            var ret = new int[items.Length];
            for (int i = 0; i < items.Length; i++)
            {
                ret[i] = items[i].ToInteger();
            }
            return ret;
        }
    }
}


Measured memory_bytes: 17632
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = int.Parse(line[0]);
        var b = int.Parse(line[1]);
        if (b >= a) Console.WriteLine(a);
        else Console.WriteLine(a-1);
    }
}


Measured memory_bytes: 11092
a,b,c = map(int,input().split())
ar = [a,b,c]
ar.sort()
cond1 = ar[2] - ar[0]
cond2 = ar[2] - ar[1]
if cond1 % 2 == 0 and cond2 % 2 == 0:
    print((cond1+cond2) // 2)
elif cond1 % 2 != 0 and cond2 % 2 != 0:
    print((cond1+cond2) // 2)
else:
    print((cond1+cond2) // 2 + 2)


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

#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 ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    ll N,K; cin >> N >> K;
    vector<pair<ll,ll>> sushi(N);
    REP(i,N){
        ll t,d; cin >> t >> d;
        sushi[i] = make_pair(d,t-1);
    }
    sort(ALL(sushi), greater<pair<ll,ll>>());

    map<ll,ll> num;
    priority_queue<pair<ll,ll>> S;
    ll ans = 0;
    FOR(i,K,N){
        S.push(sushi[i]);
    }

    REP(i,K){
        num[sushi[i].second]++;
        ans += sushi[i].first;
    }

    ll f = ans;

    ans += (ll)num.size()*(ll)num.size();

    REPR(i,K-1){
        if(S.empty()) break;
        if(num[sushi[i].second]> 1){//2種のやつなら  
            while(!S.empty()){
                auto top_sushi = S.top(); S.pop();
                if(!num.count(top_sushi.second)){//交換対象なら
                    f = f - sushi[i].first + top_sushi.first;

                    num[top_sushi.second]++;
                    num[sushi[i].second]--;

                    ll next_ans = f + (ll)num.size() * (ll)num.size();



                    sushi[i] = top_sushi;
                    ans = max(ans, next_ans);
                    break;
                }
            }
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8928