akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const double EPS = 1e-10;

int main() {
    string S;
    cin >> S;
    int N = S.size();

    int point = 0;
    for (int i = 0; i < (N + 1) / 2; i++) {
        if (S[i] == 'p') point--;
    }

    for (int i = (N + 1) / 2; i < N; i++) {
        if (S[i] == 'g') point++;
    }

    cout << point << endl;

    return 0;
}

Measured memory_bytes: 3756
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
string s[105];
int n,m;
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		cin>>s[i];
	}
	sort(s+1,s+n+1);
	for(int i=1;i<=n;i++)
	{
		cout<<s[i];
	}

	return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc132/tasks/abc132_e

#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define FORR(i, m, n) for (int(i) = (n); (i) >= (m); i--)
#define rep(...) _overload3(__VA_ARGS__, FOR, REP, )(__VA_ARGS__)
#define repr(...) _overload3(__VA_ARGS__, FORR, REPR, )(__VA_ARGS__)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

vector<vector<ll>> G;
unordered_set<ll> visited;

vector<ll> kkp(vector<ll> from, ll depth)
{
  if (depth == 3)
    return from;

  vector<ll> to;
  for (auto &f : from)
  {
    for (auto &t : G[f])
    {
      to.pb(t);
    }
  }

  sort(ALL(to));
  UNIQUE(to);
  return kkp(to, depth + 1);
}

ll trip(ll from, ll to)
{
  ll cnt = 0;
  vector<ll> now = {from}, next;

  while (now.size() != 0)
  {
    if (find(ALL(now), to) != now.end())
      return cnt;

    vector<ll> nn = kkp(now, 0);
    for (ll &p : nn)
    {
      if (visited.find(p) == visited.end())
      {
        visited.insert(p);
        next.pb(p);
      }
    }
    now = next;
    next.clear();
    cnt++;
  }
  return -1;
}

int main()
{
  ll N, M, u, v, S, T;
  vector<ll> evl;
  cin >> N >> M;

  REP(i, N)
  {
    G.pb(evl);
  }
  rep(i, M)
  {
    cin >> u >> v;
    G[u - 1].pb(v - 1);
  }
  cin >> S >> T;

  cout << trip(S - 1, T - 1) << '\n';

  return 0;
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;

vi dp;
/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    cout << fixed << setprecision(15);

    int n,m; cin >> n >> m;
    vi a(n+1);
    rep(i,m) {
        int p; cin >> p;
        a[p] = -1;
    }
    dp.resize(n+1);
    dp[0] = 1;

    for(int i = 0; i < n; ++i) {
        if(a[i+1] != -1) {
            dp[i+1] += dp[i];
            dp[i+1] %= mod;
        }
        if(a[i+2] != -1) {
            dp[i+2] += dp[i];
            dp[i+2] %= mod;
        }
    }
    cout << dp[n] << '\n';
}

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

using namespace std;

int main() {
    int n, total = 0;
    cin >> n;
    // a0 e an não fazem intersecção
    vector<int> myvs(n-1);
    for(int i = 0; i < n-1; i++) {
        cin >> myvs[i];
    }
    total += myvs[0] + myvs[n-2];
    for(int i = 1; i < n-1; i++) {
        total += min(myvs[i], myvs[i-1]);
    }
    cout << total << '\n';

    return 0;
}

Measured memory_bytes: 256
package main

import (
        "bufio"
        "fmt"
        "os"
)

func solution(n int, a []int) int {
        const MOD = 1e9 + 7
        out := 0
        cum := make([]int, n+1)
        for i := 0; i < n; i++ {
                cum[i+1] = a[i] + cum[i]
        }
        for i := 0; i < n; i++ {
                sum := (cum[n] - cum[i+1]) % MOD
                out += a[i] * sum
                out %= MOD
        }
        return out
}

func main() {
        r := bufio.NewReader(os.Stdin)
        var n int
        fmt.Fscan(r, &n)
        a := make([]int, n)
        for i := range a {
                fmt.Fscan(r, &a[i])
        }
        fmt.Println(solution(n, a))
}

Measured memory_bytes: 7592
N, K = STDIN.gets.chomp.split(' ').map(&:to_i)


result = 0
for saikoro in 1..N do
  now = saikoro
  tmp = 1.0
    while (now < K) do
      now = now * 2
      tmp = tmp / 2
    end
  result += 1.0 / N * tmp
end

puts result

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

using namespace std;

const int INF = 1000;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector< vector<int> > cnt(n, vector<int>(26, 0));
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		for (char c : s) cnt[i][c - 'a']++;
	}
	
	string ans = "";
	for (int j = 0; j < 26; j++) {
		int tmp = INF;
		for (int i = 0; i < n; i++) {
			tmp = min(tmp, cnt[i][j]);
		}
		ans += string(tmp, 'a' + j);
	}
	cout << ans << endl;
	return 0;
}

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

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

    vector<pair<int, int>> p(M);
    vector<int> res(N);
    for (int i = 0; i < M; i++) {
        cin >> p[i].first >> p[i].second;
        res[p[i].first]++;
    }

    for (int i = 1; i < N; i++) {
        res[i] += res[i - 1];
    }

    sort(p.begin(), p.end());
    bool flag = false;
    for (int i = 0; i < res[1]; i++) {
        for (int j = res[p[i].second - 1]; j < res[p[i].second]; j++) {
            if (p[i].second == p[j].first && p[j].second == N) {
                flag = true;
            }
        }
    }

    if (flag) {
        cout << "POSSIBLE" << endl;
    }
    else {
        cout << "IMPOSSIBLE" << endl;
    }
}

Measured memory_bytes: 2560
#include <iostream>
using namespace std;
int main(void){
    int n,m;
    cin >>n >>m;
    int a[60],b[60],c[60],d[60];
    int i,j;
    for(i=0;i<n;i++){
        cin >>a[i] >>b[i];
    }
    
    for(j=0;j<m;j++){
        cin >>c[j] >>d[j];
    }
    
    int min_dist,cur_dist,point;
    for(i=0;i<n;i++){
        min_dist=abs(a[i]-c[0])+abs(b[i]-d[0]),point=1;
        
        for(j=1;j<m;j++){
            cur_dist=abs(a[i]-c[j])+abs(b[i]-d[j]);
            if(min_dist>cur_dist){
                min_dist=cur_dist;
                point=j+1;
            }
            
        }
        cout <<point<<endl;
    }
    return 0;
    
    
    
}

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

int main(){
    int n;
    cin>>n;
    vector<vector<pair<int,int>>> v(n,vector<pair<int,int>>());
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        for(int j=0;j<a;j++){
            int x,y;
            cin>>x>>y;
            x--;
            v[i].push_back(make_pair(x,y));
        }
    }
    int ans=0;
    for(int i=0;i<(1<<n);i++){
        int c=0;
        vector<bool> f(n,false);
        for(int j=0;j<n;j++){
            if(i&(1<<j)){
                f[j]=true;
                c++;
            }
        }
        bool ok=true;
        for(int j=0;j<n;j++){
            if(f[j]){
                for(auto p : v[j]){
                    if(p.second==1 && !f[p.first]) ok=false;
                    if(p.second==0 && f[p.first]) ok=false;
                }
            }
        }
        if(ok) ans=max(ans,c);
    }
    cout<<ans<<endl;
}


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

using namespace std;

typedef long long ll;

int main(){
  ll N,M,i;
  ll s[6];
  bool check = true;
  char c[6];
  char S[8];
  cin >> N >> M;
  for(i=0;i<=M-1;i++)
    cin >> s[i] >> c[i];
  for(i=0;i<=N-1;i++)
    S[i] = 'x';
  for(i=0;i<=M-1;i++){
    if(S[s[i]-1] == 'x') S[s[i]-1] = c[i];
    if(S[s[i]-1] != 'x' && S[s[i]-1] != c[i]) check = false;
    if(N >= 2 && s[i] == 1 && c[i] == '0') check = false;
    }
  for(i=0;i<=N-1;i++){
    if(S[i] == 'x' && i==0) S[i] = '1';
    if(S[i] == 'x' && i>0) S[i] = '0';
  }
  if(N==1 && M==0) S[0] = '0';
  if(check)
    for(i=0;i<=N-1;i++)
      cout << S[i];
  else cout << -1 << endl;
} 




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

int main(){
    long int N,M;
    cin >> N;

    if((N+3)%7==0){
        cout<<"mon"<<endl;
    }
    if((N+2)%7==0){
        cout<<"tue"<<endl;
    }
    if((N+1)%7==0){
        cout<<"wed"<<endl;
    }
    if(N%7==0){
        cout<<"thu"<<endl;
    }
    if((N-1)%7==0){
        cout<<"fri"<<endl;
    }
    if((N-2)%7==0){
        cout<<"sat"<<endl;
    }
    if((N-3)%7==0){
        cout<<"sun"<<endl;
    }
    return 0;
}


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

class D
{
private:
    int N, Q;
    vector<vector<int>> G;
    vector<int> ans;

public:
    D()
    {
        cin >> N >> Q;

        G.resize(N);
        for (int i = 0; i < N - 1; i++)
        {
            int a, b;
            cin >> a >> b;

            a--;
            b--;

            G[a].push_back(b);
            G[b].push_back(a);
        }

        ans.resize(N);
        for (int i = 0; i < Q; i++)
        {
            int p, x;
            cin >> p >> x;

            p--;

            ans[p] += x;
        }

        dfs(0);

        for (int i = 0; i < N; i++)
        {
            cout << ans[i] << (i + 1 != N ? " " : "\n");
        }
        
    };

    void dfs(int from, int parent = -1)
    {
        for (int to : G[from])
        {
            if (to == parent)
            {
                continue;
            }

            ans[to] += ans[from];
            dfs(to, from);
        }
    };
};

int main()
{
    new D();
    return 0;
}

Measured memory_bytes: 20352
import           Data.List (group, inits)

main :: IO ()
main = do
  n <- readLn
  print $ solve n

{-
N = a * m + a = a * (m + 1)
a は余りなので 0 <= a < m
-}
solve :: Int -> Int
solve n = sum $ filter (\m -> let a = n `div` (m + 1) in a < m) $ map pred $ factors n

factors :: Integral a => a -> [a]
factors = map product . mapM (map product . inits) . group . primeFactors

primes :: Integral a => [a]
primes = 2 : filter (\n -> head (primeFactors n) == n) [3, 5 ..]

primeFactors :: Integral a => a -> [a]
primeFactors = primeFactors' primes
  where
    primeFactors' :: Integral a => [a] -> a -> [a]
    primeFactors' pps@(p:ps) n
      | n < 2              = []
      | n < p ^ (2 :: Int) = [n]  -- stop early
      | n `mod` p == 0     = p : primeFactors' pps (n `div` p)
      | otherwise          = primeFactors' ps n
    primeFactors' _ _ = error "`primes` is a infinite list"


Measured memory_bytes: 4604
h =
	6.times.map { gets.split.map(&:to_i).minmax }.each_with_object(
		Hash.new(0)
	) { |i, o| o[i] += 1 }

if h.values.any?(&:odd?)
	puts 'no'
	exit
end
xy = []
h.each { |s, c| xy.concat([s] * (c / 2)) }
case xy.flatten.uniq.size
when 1
	puts 'yes'
when 2
	puts xy.count { |v| v[0] == v[1] } == 1 ? 'yes' : 'no'
when 3
	puts xy.count { |v| v[0] == v[1] } == 0 && xy.uniq.size == 3 ? 'yes' : 'no'
else
	puts 'no'
end



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

int main()
{
	ios_base::sync_with_stdio(false),cin.tie(NULL);
	string s,t;
	cin>>s>>t;
	int l1=s.length();
	int l2=t.length();

	vector<vector<int>> dp(l1+1,vector<int>(l2+1,0));

	for(int i=1;i<=l1;i++)
	{
		for(int j=1;j<=l2;j++)
		{
			if(s[i-1]==t[j-1]) dp[i][j]=dp[i-1][j-1]+1;
			else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}

	string res="";
	int i=l1,j=l2;
	while(i>0 and j>0)
	{
		if(s[i-1]==t[j-1])
		{
			res+=s[i-1];
			i--,j--;
		}
		else if(dp[i-1][j]>=dp[i][j-1]) i--;
		else j--;
	}

	reverse(res.begin(),res.end());
	cout<<res;
	return 0;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  
  for(int i = 0; i < W + 2; i++){
    cout << "#";
  }
  cout << endl;
  
  for(int i = 0; i < H; i++){
    string line;
    cin >> line;
    cout << "#" << line << "#" << endl;    
  }
  
  for(int i = 0; i < W + 2; i++){
    cout << "#";
  }
  cout << endl;

}



Measured memory_bytes: 256
# coding: utf-8

all_info = [[[0 for x in range(10)] for y in range(3)] for z in range(4)]
ct = int(input())

for i in range(ct):
    building,floor,room_num,people = (int(x) for x in input().split())
    all_info[building-1][floor-1][room_num-1] += people

for i,build in enumerate(all_info):
    for flo in build:
        temp = " " + " ".join(map(str,flo))
        print(temp)
    if i != len(all_info) - 1:
        print("#" * 20) 



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

typedef long long ll;

ll N;
string S;
ll R = 1;

int main() {
  cin >> N >> S;
  for (ll i = 1; i < N; ++i)
    if (S[i] != S[i - 1]) ++R;
  cout << R << endl;
  return 0;
}


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

typedef long long ll;
#define dbg          cout<<"Freak"<<endl;
#define dbgg(i)      cout<<i<<endl;
#define N            1e9+7
#define pb           push_back
#define pi           acos(-1)


ll t;
ll arr[200005],cnt[200005],sum[200005];



int main()
{
    ll a,b,c,d,e,f,g,i,j;
    cin>>a;
    for(i=0;i<a;i++)
    {
        cin>>arr[i];
        cnt[arr[i]]++;
        sum[arr[i]]+=(cnt[arr[i]]-1);
    }
    f=0;
    for(i=1;i<=a;i++)
    {
        f+=sum[i];
    }
    for(i=0;i<a;i++)
    {
        b=arr[i];
        cout<<(f-(cnt[b]-1))<<endl;
    }
}


Measured memory_bytes: 6272
#include <iostream>
#include <cstring>
#include <algorithm>
#include <functional>
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
 
int main () {
  int n, m;
  cin >> n >> m;
  int c = 0;
  if (n >= 2){
    c = c + n * (n-1) / 2;
  }
  if (m >= 2){
    c = c + m * (m-1) / 2;
  }
  cout << c;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long 
//typedef pair<ll, ll> P;
//const ll INF=1LL<<60;
ll gcd(ll x,ll y){return y? gcd(y,x%y) :x;}

template<typename T>
T prim(vector<vector<pair<ll, T>>> &g){
    ll n = (ll)g.size();
    T ret = 0;
    vector<bool> used(n, false);
    using P = pair<T, ll>;
    priority_queue<P, vector<P>, greater<P>> que;
    que.emplace(0,0);
    while(!que.empty()){
        auto p = que.top();
        que.pop();
        if(used[p.second]) continue;
        used[p.second] = true;
        ret += p.first;
        for(auto &e : g[p.second]){
          que.emplace(e.second,e.first);
        }
    }
    return ret;
}

int main(){
    int n;
    cin >> n;
	vector<pair<ll,int>>x,y;
    vector<vector<pair<ll, ll>>> g(n);
    rep(i,n){
        ll a,b;
		cin>>a>>b;
		x.emplace_back(a,i);
		y.emplace_back(b,i);
	}
	sort(x.begin(),x.end());
	for(int i=1;i<n;i++){
		ll kyori=x[i].first-x[i-1].first;
		g[x[i].second].emplace_back(x[i-1].second,kyori);
		g[x[i-1].second].emplace_back(x[i].second,kyori);
	}
	sort(y.begin(),y.end());
	for(int i=1;i<n;i++){
		ll kyori=y[i].first-y[i-1].first;
		g[y[i].second].emplace_back(y[i-1].second,kyori);
		g[y[i-1].second].emplace_back(y[i].second,kyori);
	}
	ll ans=prim<ll>(g);
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 21952
#include <bits/stdc++.h>
#include <string>
#include <cmath>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<ll> vll;
 
#define all(v) v.begin(),v.end()
#define test() int t;cin>>t;while(t--) 
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ff first
#define ss second
#define pb push_back
const int mod = 998244353;
const ll INF = -(ll)1e10;

int main()
{
    ll n, x, m;
    cin>>n>>x>>m;
    vll pfx_sum(m);
    vll rem(m);
    pfx_sum[1]=x;
    rem[x]=1;
    ll prev = x;
    ll ans = 0;
    for(int i = 2; i<=min(n, m+1); i++)
    {
        prev = (prev*prev)%m;
        if(prev==0)
        {
            cout<<pfx_sum[i-1]<<endl;
            return(0);
        }
        if(rem[prev])
        {
            ans = pfx_sum[i-1];
            ll left = n-i+1;
            ll div = left/(i-rem[prev]);
            ll remainder = left%(i-rem[prev]);
            ans+=((pfx_sum[i-1]-pfx_sum[rem[prev]-1])*div);
            ans+=(pfx_sum[rem[prev]+remainder-1]-pfx_sum[rem[prev]-1]);
            cout<<ans<<endl;
            return(0);
        }
        else
        {
            rem[prev]=i;
            pfx_sum[i]=(pfx_sum[i-1]+prev);
        }        
    }
    cout<<pfx_sum[n]<<endl;
}

Measured memory_bytes: 4832
import bisect


def solve(A, B, Q, Ss, Ts, Xs):
    ans = []
    Ss.append(10 ** 21)
    Ss.insert(0, -10 ** 21)
    Ts.append(10 ** 21)
    Ts.insert(0, -10 ** 21)
    for x in Xs:
        s_right = bisect.bisect_right(Ss, x)
        s_left = max(s_right - 1, 0)
        t_right = bisect.bisect_right(Ts, x)
        t_left = max(t_right - 1, 0)

        s_right = Ss[s_right]
        s_left = Ss[s_left]
        t_right = Ts[t_right]
        t_left = Ts[t_left]

        d_s_right = abs(s_right - x)
        d_s_left = abs(s_left - x)
        d_t_right = abs(t_right - x)
        d_t_left = abs(t_left - x)

        tans = 10 ** 35
        if x <= s_right and x <= t_right:
            tans = min(tans, max(d_t_right, d_s_right))
        if s_left <= x and t_left <= x:
            tans = min(tans, max(d_s_left, d_t_left))
        tans = min(tans, min(d_s_right, d_t_left) * 2 + max(d_s_right, d_t_left))
        tans = min(tans, min(d_t_right, d_s_left) * 2 + max(d_t_right, d_s_left))
        ans.append(str(tans))
    return "\n".join(ans)


if __name__ == "__main__":
    A, B, Q = tuple(map(int, input().split(" ")))
    Ss = [int(input()) for _ in range(A)]
    Ts = [int(input()) for _ in range(B)]
    Xs = [int(input()) for _ in range(Q)]
    print(solve(A, B, Q, Ss, Ts, Xs))


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

#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
#ifdef ENABLE_DEBUG
#define DEBUG(a) cerr<<#a<<"="<<a<<endl
#define DEBUG_ARRAY(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define DEBUG(a) 
#define DEBUG_ARRAY(a,n) 
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int, int> pi;
typedef vector<int> vi;
void print_pair(pi a){
  cerr<<"("<<a.first<<", "<<a.second<<") ";
}
template<int T1, int T2>
void print_2d(int a[T1][T2], int x, int y){
  For(i, x){
    For(j, y){
      cerr<<a[i][j]<<" ";
    }
    cerr<<endl;
  }
}
template<class T>
void print_array(T a[],size_t n){
  cerr<<"array:";
  REP(n-1)cerr<<a[i]<<",";
  cerr<<a[n-1]<<endl;
}

int K,N;
const int MOD=998244353;
ll ans[200000];
ll pow2_cache[2005];
const long long max_cache=100000;
long long cache_fact[max_cache],cache_inv_fact[max_cache];
long long combination_cached(long long n,long long r,long long m){
  if(r<0||r>n)return 0;
  if(r==0||n==r)return 1;
  static bool cached=false;
  if(cached==false){
    cached=true;
    cache_inv_fact[1]=1;
    for (long long i = 2; i < max_cache; i++) {
      cache_inv_fact[i]=(m-m/i)*cache_inv_fact[m%i]%m;
    }
    for (long long i = 2; i < max_cache; i++){
      cache_inv_fact[i]=cache_inv_fact[i]*cache_inv_fact[i-1]%m;
    }
    cache_fact[0]=1;
    for (long long i = 1; i < max_cache; i++) {
      cache_fact[i]=cache_fact[i-1]*i%m;
    }
  }
  //DEBUG(cache_fact[n]);
  //DEBUG(cache_inv_fact[r]);
  //DEBUG(cache_inv_fact[n-r]);
  return cache_fact[n]*cache_inv_fact[r]%m*cache_inv_fact[n-r]%m;
}
ll a(ll n,ll num,ll rest){
    ll ret=0;
    DEBUG(n+rest-1);
    DEBUG(n);
    ans[0]=combination_cached(n+rest-1,n,MOD);
    For(j,num){
      ans[j+1]=combination_cached(num,j+1,MOD)*(combination_cached(n+rest-1,j+1+rest-1,MOD))%MOD;
    }
    for(long long j = num; j > 0; j--){
      /*ans[j]+=MOD-ans[j-1];
      ans[j]%=MOD;
      */
      ans[j]*=pow2_cache[j];
      ans[j]%=MOD;
    }
    For(j,num+1){
      DEBUG_ARRAY(ans,j);
      ret+=ans[j];
      ret%=MOD;
    }
    return ret;
}
int main(){
  ll tmp=1;
  REP(2005){
    pow2_cache[i]=tmp;
    tmp=tmp*2%MOD;
  }
  cin>>K>>N;
  REP(2*K-1){
    ll num=min(2*K+2-(i+2),i+2)-1;
    ll f=num;
    ll rest=(K-num);
    num/=2;
    ll o=a(N,num,rest);
    if(f%2==1){
      o+=a(N-1,num,rest);
      o%=MOD;
    }
    cout<<o<<endl;
  }
  return 0;
}



Measured memory_bytes: 1920
X,Y = list(map(int,input().split()))

MAXN = 2*(10**6)+10
p = 10**9+7
f = [1]
for i in range(MAXN):
    f.append(f[-1] * (i+1) % p)
def nCr(n, r, mod=p):
    return f[n] * pow(f[r], mod-2, mod) * pow(f[n-r], mod-2, mod) % mod


Z = (X+Y)//3
if Z*3!=X+Y:
    print(0)
else:
    P,Q = X-Z, Y-Z
    if P<0 or Q<0:
        print(0)
    else:
        print(nCr(Z,P))


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

int main(){
    int N,K;
    cin >> N >> K;
    string S;
    cin >> S;
    vector<int> ar;
    if(S[0]=='0'){
        ar.push_back(0);
    }
    char bf = S[0];
    int d = 0;
    rep(i,N){
        if(S[i]!=bf){
            ar.push_back(d);
            bf = S[i];
            d=1;
        }else{
            d++;
            if(i==N-1){
                ar.push_back(d);
            }
        }
    }
    if(S[N-1]=='0'){
        ar.push_back(0);
    }
    vector<int> Sum(ar.size()+1);
    rep(i,ar.size()){
        Sum[i+1] = Sum[i] + ar[i];
    }
    // 0...0の塊を反転させるとその左右含めた長さ分つながる
    int ans = 0;
    for(int l=0;l<Sum.size();l+=2){ // l:1...1の始まり
        int r = min(l+2*K+1,(int)Sum.size()-1);
        ans = max(ans,Sum[r]-Sum[l]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1272
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const long double PI = (acos(-1));
#define rep(i, x, n) for (int i = x; i < (int)(n); i++)
#define sc(x) scanf("%d",&x)
#define scll(x) scanf("%lld",&x)
int main(){
    int n; sc(n);
    ll ans = 0;
    char c;
    string s; cin >> s;
    vector<int> r(n,0), g(n,0), b(n,0);
    for (int i = n-1; i >= 0; i--){
        if (i!=n-1) r[i] = r[i+1], g[i] = g[i+1], b[i] = b[i+1];
        if (s[i] == 'R') r[i]++;
        else if (s[i] == 'G') g[i]++;
        else b[i]++;
    }
    rep(i, 0, n-2){  
        rep(j, i+1, n-1){
            if (s[i] == s[j]) continue; 
            if (s[i]=='R' && s[j]=='G' || s[i]=='G' && s[j]=='R'){
                ans += b[j], c = 'B';
            }else if (s[i]=='R' && s[j]=='B' || s[i]=='B' && s[j]=='R'){
                ans += g[j], c = 'G';
            }else{
                ans += r[j], c = 'R';
            }
            if (2*j-i < n && s[2*j-i] == c) ans--; 
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  string S, T;
  cin >> S >> T;
  int N = S.size(), M = T.size();
  int ans = N + 1;
  for (int i = 0; i < N - M + 1; i++) {
    string U = S.substr(i, M);
    int X = 0;
    for (int j = 0; j < M; j++) {
      if (U.at(j) != T.at(j)) X++;
    }
    ans = min(ans, X);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3628
h, n = map(int, input().split())
ab = [map(int, input().split()) for _ in range(n)]

dp = [[float("inf")] * (h + 1) for _ in range(n + 1)]
for i in range(n + 1):
    dp[i][0] = 0

for i, (a, b) in enumerate(ab, 1):
    for j in range(h + 1):
        dp[i][j] = min(dp[i-1][j], dp[i][max(j-a, 0)] + b)

ans = dp[n][h]
print(ans)


Measured memory_bytes: 381976
#include<bits/stdc++.h>
#include<algorithm>
#define ll long long
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;
int main()
{
    fast_io
    ll t,i,j,n,m,p,x,sum=0;
    cin>>n;
    ll a[n];
    for(i=0; i<n; i++){
        cin>>a[i];
        sum+=a[i];
    }
    cin>>m;
    while(m--)
    {
        cin>>p>>x;
        ll ans=sum-a[p-1]+x;
        cout<<ans<<endl;

    }

    return 0;
}





Measured memory_bytes: 3644
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		try {
		    Scanner sc=new Scanner(System.in);
		    float r=sc.nextFloat();
		    System.out.println(2*3.14*r);
		} catch(Exception e) {
		}
	}
}

Measured memory_bytes: 37348
#include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define MP make_pair
const int oo = 1e9;
int n,t[100000];
int main(){_
string s1,s2;cin >> s1 >> s2 ;
for(int i=0;i<s1.length();i++){
    if(s1[i]==s2[0]){
            int ss=0,ok=1;
        for(int j=0;j<s1.length() && ok;j++){
            if(s1[(j+i)%s1.length()]==s2[ss]){
                ss++;
            }
            else ok=0;
        }
        if(ok) {cout << "Yes" << endl  ; return 0 ;}
    }
}
cout << "No" << endl ;
}


Measured memory_bytes: 256
a, b, c, k = [int(elem) for elem in input().split()]

if a >= k:
    print(k)
elif a < k and (a+b) >= k:
    print(a)
elif (a+b) < k and (a+b+c) >= k:
    print(a+a+b-k)
else:
    print(a-c)
    


Measured memory_bytes: 9180
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define lo long long 
#define inf 1000000000
#define md 1000000007
#define pb push_back
#define li 100005
using namespace std;
int n,m,x,y,deg[li],vis[li],tp[li];
vector<int> v[li];
vector<int> yol;
pair<int,int> A[li];
void dfs(int node,int ata){
	vis[node]=1;
	yol.pb(node);
	deg[node]--;
	int mn=inf,tut=-1;
	for(int i=0;i<(int)v[node].size();i++){
		int go=v[node][i];
		if(go!=ata && vis[go]==0){
			if(deg[go]<mn){
				mn=deg[go];
				tut=go;
			}
		}
	}
	if(tut!=-1) dfs(tut,node);
}
int main(){
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d %d",&x,&y);
		v[x].pb(y);
		v[y].pb(x);
		deg[x]++;
		deg[y]++;
	}
	for(int i=1;i<=n;i++){
		A[i]=mp(deg[i],i);
	}
	sort(A+1,A+n+1);
	for(int i=1;i<=n;i++){
		yol.clear();
		memset(vis,0,sizeof(vis));
		memset(tp,0,sizeof(tp));
		dfs(A[i].se,-1);
		for(int j=0;j<(int)yol.size();j++){
			tp[yol[j]]=1;
		}
		int flag=0;
		if((int)yol.size()<=1) continue;
		for(int j=0;j<(int)v[yol[0]].size();j++){
			if(tp[v[yol[0]][j]]==0){
				flag=1;
				break;
			}
		}
		if(flag==1) continue;
		flag=0;
		for(int j=0;j<(int)v[yol[(int)yol.size()-1]].size();j++){
			if(tp[v[yol[(int)yol.size()-1]][j]]==0){
				flag=1;
				break;
			}
		}
		if(flag==1) continue;
		flag=0;
		printf("%d\n",(int)yol.size());
		for(int j=0;j<(int)yol.size();j++) printf("%d ",yol[j]);
		return 0;
	}
	return 0;
}


Measured memory_bytes: 11896
#include <stdio.h>

int solve(int i,int m,int n,int A[]){
	int res;
	if(m == 0){
		return 1;
	}
	if (i>= n){
		return 0;
	}
	res = solve(i+1,m,n,A) || solve(i+1,m-A[i],n,A);
	return res;
}

int main(void){
	int i,q,m,n,A[2000];
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}
	
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&m);
		if(solve(0,m,n,A)==1){
			printf("yes\n");
		}
		else{
			printf("no\n");
		}
	}
	
	return 0;
}


Measured memory_bytes: 2128
H,W = map(int,input().split())
State = []
for i in range(H):
    State.append(input())
starts = [(i%H,i//H) for i in range(H*W)]
goals = [(i%H,i//H) for i in range(H*W)]
from collections import deque
def min_dist(start):
    visited = [[False for i in range(W)] for j in range(H)]
    dists = [[float('inf') for i in range(W)] for j in range(H)]
    dists[start[0]][start[1]]=0
    diffs = [(0,1),(1,0),(0,-1),(-1,0)]
    Q = deque([start])
    while Q:
        current_pos = Q.pop()
        for diff in diffs:
            next_pos = (current_pos[0]-diff[0],current_pos[1]-diff[1])
            if next_pos[0] < H and next_pos[0] >= 0 and next_pos[1] < W and next_pos[1] >= 0:
                if State[next_pos[0]][next_pos[1]] == '.':
                    dists[next_pos[0]][next_pos[1]] = min(dists[current_pos[0]][current_pos[1]]+1,dists[next_pos[0]][next_pos[1]])
                    if not visited[next_pos[0]][next_pos[1]]:
                        visited[next_pos[0]][next_pos[1]] = True
                        Q.appendleft(next_pos)
    return dists
max_dist = -100000
for start in starts:
    if State[start[0]][start[1]] == '.':
        dists = min_dist(start)
        local_max_dist = -1000000
        for i in range(W):
            for j in range(H):
                if dists[j][i] != float('inf'):
                    if local_max_dist < dists[j][i]:
                        local_max_dist = dists[j][i]
        if local_max_dist > max_dist:
            max_dist = local_max_dist
print(max_dist)

Measured memory_bytes: 3444
import Control.Arrow
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as B
main=print.solve.unfoldr(B.readInt.B.dropWhile isSpace)=<<(B.getLine>>B.getLine)
solve=maximum.uncurry(zipWith gcd).(scanl gcd 0&&&tail.scanr gcd 0)

Measured memory_bytes: 30088
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		int w = sc.nextInt();
		StringBuilder ans = new StringBuilder();
		for(int i=0;i<s.length();i+=w) {
			ans.append(s.charAt(i));
		}
		System.out.println(ans);
	}
}


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

int main()
{
  int a;int b;cin>>a>>b;
  int first=b-2*a;
  int second=4*a - b;
  
  if(first>=0 && first%2==0 && second>=0 && second%2==0)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  
  return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<vector>

using namespace std;

int main(){
	int N;
	cin >> N;
	vector< vector<int> > like_num(N);

	int ans = 0;
	for (int i = 0; i < N; i++){
		int temp;
		cin >> temp;
		temp--;
		for (int j = 0; j < like_num[i].size(); j++){
			if (like_num[i][j] == temp){
				ans++;
				break;
			}
		}
		like_num[temp].push_back(i);
	}

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

Measured memory_bytes: 5760
#include<bits/stdc++.h>
//#include<iostream>
//#include<algorithm>
using namespace std;
bool div(int x);

int main(){
    int n;
    cin>>n;
    while(n<100004){
  		if (div(n)){
              cout<<n<<endl;
              return 0;
        }else n++;
    }
     cout<<n<<endl;          
     return 0;
}
    bool div(int x){
        if (x==1) return false;
        for (int i=2;i*i <x;i++){
            if(x % i ==0)return false;
        }
        return true;
    }

Measured memory_bytes: 256
X, Y = map(int, input().split())
MOD = int(pow(10, 9) + 7)
def isValid(x, y):
    if (X + Y) % 3 != 0:
        return False
    S = (X + Y) // 3
    return Y >= S and X >= S

if not isValid(X, Y):
    print(0)
    quit()

S = (X + Y) // 3
A = (2 * X - Y) // 3

fact = [1 for i in range(S+1)]
for i in range(1, S+1): fact[i] = (i * fact[i - 1]) % MOD

def modInverse(x, power=MOD - 2):
    if power == 0: return 1
    cur = modInverse(x, power // 2); cur *= cur; cur %= MOD
    if power % 2 == 1:
        cur *= x
    cur %= MOD
    return cur


print((fact[S] * modInverse(fact[A]) * modInverse(fact[S-A])) % MOD)



Measured memory_bytes: 85232
#include<bits/stdc++.h>
using namespace std ;
#define rep( i, s, t ) for( register int i = s; i <= t; ++ i )
#define re register
#define int long long
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
const int P = 1e9 + 7 ; 
const int N = 2e5 + 5 ; 
const int inf = 1e9 + 9 ;
int n, X, Y, fa[N], vis[N], sz[N], fac[N], cnt[N], inv[N], Ans ; 
struct Col {
	int w, c ; 
} a[N] ;
vector<int> Go[N] ;
int fpow( int x, int k ) {
	int ans = 1, base = x ; 
	while( k ) {
		if( k & 1 ) ans = ans * base % P ; 
		base = base * base % P, k >>= 1 ; 
	} return ans ; 
}
bool cmp( Col x, Col y ) {
	return x.w < y.w ; 
}
int fd( int x ) {
	return ( x == fa[x] ) ? x : fa[x] = fd(fa[x]) ;
}
void merge( int x, int y ) {
	int u = fd(x), v = fd(y) ;
	if( u != v ) fa[u] = v, sz[v] += sz[u] ;
}
int st[N], top ; 
signed main()
{
	n = gi(), X = gi(), Y = gi() ; 
	rep( i, 1, n ) a[i].c = gi(), a[i].w = gi(), fa[i] = i, sz[i] = 1 ;
	sort( a + 1, a + n + 1, cmp ) ; fac[0] = 1 ; 
	rep( i, 1, n ) fac[i] = fac[i - 1] * i % P, inv[i] = fpow( fac[i], P - 2 ) ;
	int Ans = 1, Mi1 = 0, Mi2 = 0 ; a[0].w = inf ;
	rep( i, 1, n ) if( a[i].w < a[Mi1].w ) Mi1 = i ;
	rep( i, 1, n ) if( a[i].c != a[Mi1].c && a[i].w < a[Mi2].w ) Mi2 = i ;
	for( re int i = 1; i <= n; ++ i ) {
		if( !vis[a[i].c] ) vis[a[i].c] = i ;
		else if( a[vis[a[i].c]].w + a[i].w <= X ) merge( vis[a[i].c], i ) ;
		if( a[i].c == a[Mi1].c ) {
			if( a[i].w + a[Mi2].w <= Y && Mi2 ) merge( i, Mi2 ) ;
		}
		else if( a[i].w + a[Mi1].w <= Y ) merge( i, Mi1 ) ;
	}
	rep( i, 1, n ) Go[fd(i)].push_back(i) ; inv[0] = 1 ; 
	rep( i, 1, n ) if( fa[i] == i ) Ans = 1ll * Ans * fac[sz[i]] % P ; 
	rep( i, 1, n )
		if( i == fa[i] ) {
			for( auto j : Go[i] ) ++ cnt[a[j].c] ;
			for( auto j : Go[i] ) Ans = Ans * inv[cnt[a[j].c]] % P, cnt[a[j].c] = 0 ;
		}
	cout << Ans << endl ;
	return 0 ;
}

Measured memory_bytes: 23296
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  int a, b;
  cin >> a >> b;

  if ((a == 0 || b == 0) || (a < 0 && b > 0))
    cout << "Zero" << endl;
  else if (a > 0 && b > 0)
    cout << "Positive" << endl;
  else if ((b - a) % 2 == 1)
    cout << "Positive" << endl;
  else
    cout << "Negative" << endl;

  return 0;
}

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

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

    int q;
    cin >> q;

    vector<int> A;
    for(int i = 0; i < q; i++){
        int n;
        cin >> n;
        if(n == 2){
            A.pop_back();
            continue;
        }else{
            int m;
            cin >> m;
            if(n == 0){
                A.push_back(m);
            }else{
                cout << A[m] << endl;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3884
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void print() { cout << "\n"; }
template <class T> void print(const T &x) { cout << x << "\n"; }
template <class T, class... Args> void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
template <class T> void printVector(const vector<T> &v) {
    for(const T &x : v) {
        cout << x << " ";
    }
    cout << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    vector<int> num[m];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        num[a[i] % m].emplace_back(a[i]);
    }
    for(int i = 0; i < m; i++) {
        sort(ALL(num[i]));
        // cerr << i << ": ";
        // for(auto j : num[i]) {
        //     cerr << j << " ";
        // }
        // cerr << endl;
    }
    int ans = 0;
    for(int i = 0; i <= (m / 2); i++) {
        int j = m - i;
        int size_i = num[i].size(), size_j = num[j].size();
        if(i == 0 || i == j) {
            ans += size_i / 2;
            continue;
        }
        auto vi = num[i];
        auto vj = num[j];
        if(size_i > size_j) {
            swap(vi, vj), swap(size_i, size_j);
        }
        map<int, int> cnt;
        for(int k : vj) {
            cnt[k]++;
        }
        int paircnt = 0;
        for(auto p : cnt) {
            paircnt += p.second / 2;
        }
        ans += size_i + min((size_j - size_i) / 2, paircnt);
    }
    print(ans);
}

Measured memory_bytes: 6144
m, d = map(int, input().split())
r = 0
for mi in range(1, m + 1):
    for di in range(10, d + 1):
        if mi == int(str(di)[0]) * int(str(di)[1]) and int(str(di)[0]) > 1 and int(str(di)[1]) > 1:
            r += 1
print(r)


Measured memory_bytes: 2940
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var NAB = Sarray();
            var N = NAB[0];
            var A = NAB[1];
            var B = NAB[2];
            var ans = 0L;

            if (Abs(A - B) % 2 == 0)
                ans = (Abs(A - B) - 1) / 2 + 1;
            else
            {
                var down = A + (B - 1 - A ) / 2;
                var up = N - B + 1 + (B - (A + 1) ) / 2;
                ans = Min(down, up);
            }
            WriteLine(ans);

            //Out.Flush();
        }
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>

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 FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()
#define MP make_pair

int main() {
	int n, t,m = INF;
	cin >> n >> t;
	REP(i, n) {
		int a, b;
		cin >> a >> b;
		if (b <= t) m = min(m, a
		);
	}
	if (m != INF) cout << m << endl;
	else cout << "TLE" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
    
#define ll long long int
#define pb push_back
#define rep(i , j , n) for(ll i = j ; i < n ; i++)
#define pre(i , j , n) for(ll i = j ; i >= n ; i--)
#define all(x) x.begin(), x.end()
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vll;
typedef vector<char>	vc;
typedef vector<bool>	vb;
#define br "\n"
#define MAX  1000001
#define ff first
#define ss second
ll mod = 1e9 + 7;

void solve(){
    ll n,x,t;
    cin >> n >> x >> t;
    ll ans;
    if(n % x == 0) ans = n/x;
    else ans = n/x + 1;
    cout << ans*t << br;
}
	
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif  
 
    ll t = 1;
    // cin >> t;
    rep(i,0,t){
        solve();
    }
 
}	

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

 using namespace std;

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

   int ans = 0;
   for (int i = 0; i < S.length() / 2 ; i++) {
     if (S.at(i) != S.at(S.length() - i - 1)) ans++;
   }
   cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string S; cin >> S;
    bool aaa = false;
    if(S.at(0) != S.at(1) && S.at(1) != S.at(2) && S.at(0) != S.at(2) ){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

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

void solve();

int N,M;
int ans = 0;
int fid[5010][5010] = {0};

int main()
{
    scanf("%d%d",&N,&M);
    solve();
}

void solve()
{
    int a,b,x;
    for(int i = 0; i < M; i++)
    {
        scanf("%d%d%d",&a,&b,&x);
        fid[a - 1][b- 1] = x + 1;
    }
    for(int i = 0; i < N; i++)
    {
        for(int j = 0; j <= i; j++)
        {
            int mem = fid[i][j];
            if(i == 0);
            else if(j == 0)
            {
                fid[i][j] = max(fid[i - 1][j] - 1,mem);
            }
            else if(i == j)
            {
                fid[i][j] = max(fid[i - 1][j - 1] - 1,mem);
            }
            else
            {
                fid[i][j] = max
                           (max(
                            fid[i - 1][j] - 1,fid[i - 1][j - 1] - 1),mem);
            }
            if(fid[i][j])ans++;
        }
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 70028
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RNG(i,from,to) for(int i=(from); i<(int)(to); i++)
#define gcd(i,j) __gcd((i), (j))
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vecll;
template<typename S, typename T> string to_string(pair<S, T> p) { return "("+to_string(p.first)+","+to_string(p.second)+")"; }
template<typename T> string to_string(T p[2]) { return "["+to_string(p[0])+","+to_string(p[1])+"]"; }
template<typename T> void println(T e){ cout << to_string(e) << endl; }
template<typename T> void println(const vector<T>& v){ cout << "[";for(const auto& e : v){ cout << to_string(e) << ","; }cout << "]";cout << endl; }
template<typename T> void println(const vector<vector<T>>& vv){ for(const auto& v : vv){ println(v); } }
template<typename Iter> void println(Iter first, Iter last){ for(auto it=first; it != last; it++){ cout << *it << " "; }; cout << endl; }
template<typename T> T mod_pow(T x, T n, const T &p) { T ret = 1; while(n > 0) { if(n & 1) (ret *= x) %= p; (x *= x) %= p; n >>= 1; } return ret; }
template<typename T> T mod_inv(T x, const T &p) { return mod_pow(x, p-2, p); }
const ll DVSR = 1e9+7;


int main(int argc, char const *argv[])
{
  string S; cin >> S;
  cout << (S[1] == 'B' ? "ARC" : "ABC") << endl;
  return 0;
}


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

using namespace std;

vector<vector<int>> relation((int)1e5);
vector<bool> ok((int)1e5, false);
int ans = 0;

void change(int changed)
{
    ok[changed] = true;
    for (int i = 0; i < relation[changed].size(); i++)
    {
        if (!ok[relation[changed][i]])
            change(relation[changed][i]);
    }
}

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

    for (int i = 0; i < M; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        relation[a].push_back(b);
        relation[b].push_back(a);
    }

    for (int i = 0; i < N; i++)
    {
        if (!ok[i])
        {
            ans++;
            change(i);
        }
    }

    cout << ans << endl;
}

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


void solve(long long N, std::vector<long long> B){
	long long A[N];
	int i;
	for(i=0;i<N;i++){
		if(i==0){
			A[0]=B[0];
		}else if(i==N-1){
			A[N-1] = B[N-2];
		}else{
			A[i] = min(B[i-1],B[i]);
		}
	}
	for(i=0;i<N;i++){
//		cout << A[i] << " ";
//		cout << endl;
	}
	cout << accumulate(A,A+N,0) << endl;

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> B(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&B[i]);
    }
    solve(N, std::move(B));
    return 0;
}


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

int main(){
    int a,b,c,d,e,f;
    int g,h,i,j,k,l;
    cin >> a >> b >> c >> d >> e >> f;
    cin >> g >> h >> i >> j >> k >> l;
    
    for(int i=0; !(a==g && b==h); i++){
        if(d==h || c==h){
            int tmp = a;
            a = d;
            d = f;
            f = c;
            c = tmp;
        }
        for(int i=0; b!=h; i++){
            int tmp=a;
            a = b;
            b = f;
            f = e;
            e = tmp;
        }
        for(int i=0; a!=g; i++){
            int tmp=a;
            a = d;
            d = f;
            f = c;
            c = tmp;
        }
    }
    if(c==i && d==j && e==k){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3088
#include <stdio.h>
 
int main(void) {
    int input[200][3];
    int N,i,j;
    scanf("%d",&N);
    for(i=0;i<N;i++)scanf("%d%d%d",
        &input[i][0],&input[i][1],&input[i][2]);
    for(i=0;i<N;i++) {
        int ok[3]={1,1,1};
        for(j=0;j<N;j++) {
            if(j==i)continue;
            if(input[i][0]==input[j][0])ok[0]=0;
            if(input[i][1]==input[j][1])ok[1]=0;
            if(input[i][2]==input[j][2])ok[2]=0;
        }
        printf("%d\n",
            input[i][0]*ok[0]+input[i][1]*ok[1]+input[i][2]*ok[2]);
    }
    return 0;
}

Measured memory_bytes: 600
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法でnは？？

n,r=mii()

if n>=10:
    print(r)
else:
    print(r+100*(10-n))

Measured memory_bytes: 65516