akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <string>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#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 FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	int h,a; cin>>h>>a;
	cout << (h+a-1)/a << endl;


  return 0;
}


Measured memory_bytes: 256
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
//#include<unordered_map>//イテレータあるけど順序保持しないmap
//#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<valarray>//なんとなく追加
//メモ：表示桁数を大きくする　　cout << fixed << setprecision(20) << cm << endl;
using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PI acos(-1.0)
#define answer(ans) cout<<ans<<endl;
#define input(N) cin >> N ;

signed main() {
int N,A;
cin >> N;
A = N + N*N*N + N*N;
answer(A);
return 0;
}


Measured memory_bytes: 3628
import numpy as np

N,K =(int(x) for x in input().split())
list1 = np.array([int(s) for s in input().split()])


list2=np.sort(list1)

i=0
sum=0
while i<=N-K-1:
  sum=sum+list2[i]
  i=i+1

print(sum)

Measured memory_bytes: 34180
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<string>
#include<queue>
#include<utility>
#include<cmath>
#include<sstream>
#include<istream>
#include<numeric>

using namespace std;

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

  vector<string> S(N);

  for(int i=0; i<N; i++){
    cin >> S[i];
  }

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

  for(int i=0; i<N; i++){
      cout << S[i];
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
typedef long long ll;
typedef long double  ld;
#define pii pair<ll,ll> 
#define pic pair<ll,char>
#define vi vector< ll > 
#define vvi vector< vi > 
#define vpi vector< pii > 
#define vvpi vector< vpi > 
#define st  set <ll, greater <ll> >
#define mst  multiset <ll, greater <ll> >
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mapp  unordered_map <ll, ll>
#define ppii pair< pii, pii > 
#define test(t) ll t;cin>>t;while(t--)
#define inarr(n) ll arr[n];for(ll i=0;i<n;i++)cin>>arr[i];
#define ingra(m) vvi arr(100005);for(ll i=0;i<m;i++){ll u,v;cin>>u>>v;arr[u].pb(v);arr[v].pb(u);}
#define mem(a,b) memset(a,b,sizeof(a))
#define inn freopen("input.txt", "r", stdin)
#define outt freopen("output.txt", "w", stdout)
#define all(arr) arr.begin(),arr.end()
ll power(ll x,ll y){ll res = 1;while(y){if(y&1) res = (res*x)%mod;y=y/2,x=(x*x)%mod;}return res%mod;}
signed main()
{
    fast;
    ll h,w,k;
    cin>>h>>w>>k;
    ll n = h+w;
    ll p = n*(n-1)*3%mod;
    p = power(p,mod-2);
    p = p*k%mod*(k+1)%mod*(k-1)%mod*h%mod*w%mod;
    ll x = 2;
    x = power(x,mod-2);
    x = x*k%mod*(k+3)%mod;
    x = (x+p)%mod;
    ll i;
    for(i=0;i<=k-1;i++)
    {
        x = (x*(n-i))%mod;
    }
    cout<<x;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// __builtin_ctz : no of trailing zeros
#define int long long
#define ll long long
#define pp pair<int,int>
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
int max(int x, int y)
{
    return x>y ? x : y;
}
int min(int x, int y)
{
    return x<y ? x : y;
}
void _(int&a , int b)
{
    a=(a%mod+b%mod)%mod;
    a=(a+mod)%mod;
}
ll cl(ll a,ll b)
{
    return (a/b)+(!(!(a%b)));
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,m;cin >> n >> m;ll a[n];
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    vector<ll> e[n];
    for (int i = 0; i < m; ++i)
    {
        ll u,v;cin >> u >> v;u--;v--;e[u].push_back(v);e[v].push_back(u);
    }ll ans=0;
    for (int i = 0; i < n; ++i)
    {
        bool b=1;
        for(auto j : e[i])
        {
            if(a[i]<=a[j]){b=0;break;}
        }
        if(b)ans++;
    }
    cout <<ans;
    }

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

#https://atcoder.jp/contests/abc082/tasks/abc082_c
length = int(input())
a = [int(i) for i in input().split()]
set_a = set(a)

count = 0
for i in set(a):
	if (i > length):
		continue
	if(i <= a.count(i)):
		count += i
print(length - count)


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

int main() {
  int n,k,s;
  cin >> n >> k >> s;
  rep(i,k) cout << s << " ";
  if(s != 1e9) s++;
  else s--;
  rep(i,n-k){
    cout << s;
    if(i != n-k-1) cout << " ";
    else cout << "" << endl;
  }
}

Measured memory_bytes: 1280
#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)

N = int(input())
L = [int(input()) for _ in range(N)]

tmp = L[0]
for i in range(1, N):
    tmp = lcm(tmp, L[i])
    
print(tmp)


Measured memory_bytes: 3060
#include<stdio.h>
int main(void)
{
	int n,i,a[100];
	scanf("%d",&n);
//	printf("n=%d\n",n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	printf("%d",a[n-1]);
	for(i=n-2;i>=0;i--){	
		printf(" %d",a[i]);
		
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2052
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		final int a = sc.nextInt();
		final int b = sc.nextInt();

		final int east = b - a;

		int eastHight = 0;
		for (int i = 1; i <= east; i++) {
			eastHight = eastHight + i;
		}

		System.out.println(eastHight - b);

	}

}

Measured memory_bytes: 23124
abc = [int(i) for i in input().split()]

max_number = max(abc)
abc.remove(max_number)
others = abc

count = 0
count += (max_number - max(others))

gap = (max_number - (min(others) + count))
if gap % 2 == 0:
  count += gap / 2
else: 
  count += ((gap + 1) / 2) + 1

print(int(count))




Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int ll;

int main(){
	int a,b; cin >> a >> b;
	int ans=0;
	int now=1;
	while(now<b){
		now+=(a-1);
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>

#if __cplusplus >= 201103 //C++11~
#include <tuple>

#endif

using namespace std;

typedef pair<int,int> Paint;

bool Pairsecond(const Paint& pf,Paint&ps){//sortCompare
  return pf.second < ps.second;
}

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)
#define pb push_back
#define MAX 1000000000
#define MOD 1000000007

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")
long long gcd(long long a,long long b){
  if(a%b==0)return b;
  else return gcd(b,a%b);
}

int main(){
  long long a,b;cin>>a>>b;
  long long c = gcd(a,b);//cin>>c;
  vector<long long> ans;ans.push_back(1);
  long long i = 2;
  for(; c >= i*i; i++){
    if(c%i == 0){
      if(ans[ans.size()-1]!= i)ans.push_back(i);
      c/=i;
      i--;
    }
  }
  if(c!=ans[ans.size()-1])ans.push_back(c);
  cout << ans.size() << endl;
}

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

using namespace std;

long long gcd(long long  a, long long  b) { return b==0 ? a : gcd(b, a%b);}
long long lcm(long long  a, long long  b) {return a * (b/gcd(a,b));}
main(){
    int n;
    scanf("%d",&n);
    long long ans;
    long long num;
    cin >> ans;
    for(int i=1;i<n;++i){
        cin >> num;
        ans = lcm(ans,num);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (500000)
#define pii pair<int, int>

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

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

class e{
public:
  ll a, b;
  e() {a = b = -1;}
  e(ll u, ll v) {a = u; b = v;}
};

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  ll tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> &V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

ll comb(ll n, ll r){
	ll res = 1;
  rep(i, 0, r){
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

template<typename T>
T euclid(T a, T b){
  if(b == 0) return a;
  else return euclid(b, a % b);
}

vector<ll> fact(MAX, 0), fact_inv(MAX, 0);

ll pow_mod(ll a, ll b){
	ll res = 1;
	while(b > 0){
		if(b & 1) res = res * a % MOD;
		a = a * a % MOD;
		b >>= 1;
	}
	return res;
}

void prepare_comb_mod(ll n){
	fact[0] = 1LL;
	for(ll i = 0; i < n; i++) fact[i+1] = fact[i] * (i + 1) % MOD;
	fact_inv[n] = pow_mod(fact[n], MOD - 2);
	for(ll i = n - 1; i >= 0; i--) fact_inv[i] = fact_inv[i + 1] * (i + 1) % MOD;
}

ll comb_mod(ll n, ll r){
	return (fact[n] * fact_inv[r]) % MOD * fact_inv[n - r] % MOD;
}

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


void Main() {
  int N; cin >> N;
  string S; cin >> S;
  int res = 1;
  rep(i, 1, N){
    if(S[i] != S[i - 1]) res ++;
  }
  cout << res << endl;
}

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

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << std::fixed << std::setprecision(15);

  Main();
}


Measured memory_bytes: 8320
S = gets.split('')
S_len = S.length
out = 0
for i in 0..S_len
    if i.even? then
        if S[i] == "L" then
            out += 1
        end
    else
        if S[i] == "R" then
            out += 1
        end
    end
end
if out == 0 then
    puts "Yes"
else
    puts "No"
end

Measured memory_bytes: 3836
N, M = map(int, input().split())
A = list(map(int, input().split()))
num = [2, 5, 5, 4, 5, 6, 3, 7, 6]
dp = {0: 0}
for i in range(1, N + 1):
    dp[i] = -float('inf')
    for j in range(8, -1, -1):
        if j + 1 in A and i - num[j] >= 0:
            dp[i] = max(dp[i], dp[i - num[j]] + 1)

ans = []
while N > 0:
    for j in range(8, -1, -1):
        if j + 1 in A and N - num[j] in dp and dp[N - num[j]] == dp[N] - 1:
            ans.append(j + 1)
            N -= num[j]
            break

print(*ans, sep='')

Measured memory_bytes: 44528
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

class disjoint_set {
    vector<int> p;
public:
    int count;
    disjoint_set(int n) : p(n, -1), count(0) {}
    int root(int i) { return p[i] >= 0 ? p[i] = root(p[i]) : i; }
    bool same(int i, int j) { return root(i) == root(j); }
    int size(int i) { return -p[root(i)]; }
    void merge(int i, int j) {
        count++;
        i = root(i), j = root(j);
        if (i == j) return;
        if (p[i] > p[j]) swap(i, j);
        p[i] += p[j], p[j] = i;
    }
    int size(int i, int j) {
        if(same(i,j)) return size(i);
        else return size(i) + size(j);
    }
};

int main(){
    int N,M; cin >> N >> M;
    vector<ll> p(N);
    rep(i,N){
        cin >> p[i];
        p[i]--;
    }

    vector<ll> x(M),y(M);
    rep(i,M){
        cin >> x[i] >> y[i];
        x[i]--;
        y[i]--;
    }

    disjoint_set uf(N);
    rep(i,M){
        uf.merge(x[i],y[i]);
    }

    vector<int> index(N);
    rep(i,N) index[p[i]] = i;

    for(int i=0;i<N;i++){
        if(i==p[i]) continue;

        if(uf.same(i,index[i])){
            int v = p[i];
            swap(p[i],p[index[i]]);
            index[v] = index[i];
        }
    }

    int ans = 0;
    rep(i,N) if(i==p[i]) ans++;
    cout << ans << endl;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
ll gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<int>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
  ll k,x,d;
  cin >> x >> k >> d;
  x=abs(x);
  if(x/d<k){
    k-=x/d;
    x=x%d;
    if(k%2==1){
      cout << d-x << endl;
    }
    else{
      cout << x << endl;
    }
  }
  else{
    cout << x-k*d << endl;
  }
}

Measured memory_bytes: 3512
#include <bits/stdc++.h>
using namespace std;
#include <unordered_map>
#define inputarr(a,n) for(ll i=0;i<n;i++) cin>>a[i];
#define prllarr(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" ";
#define pb push_back
#define ll long long
#define mod 1000000007
#define foi ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define in(n) scanf("%lld",&n);
#define in2(x,y) scanf("%lld %lld",&(x),&(y));
#define in3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z));
#define out(n) printf("%lld\n",n);
#define out2(x,y) printf("%lld %lld\n",x,y);
#define test(t)  ll t; in(t);while(t--)
#define set(arr,n,s) for(ll i=0;i<n;i++){arr[i]=s;}


ll power(ll x,ll y,ll p){ll res=1;x=x%p;while(y>0){if(y&1){res=(res*x)%p;} y=y>>1;x=(x*x)%p;}return res;}
ll modInverse(ll a,ll p){return power(a,p-2,p);}//used with feemat little

ll gcd(ll x,ll y){if(x==0 || y==0){return max(y,x);}return gcd(y%x,x);}
ll gcdExtended(ll a,ll b,ll &x,ll &y){if(a==0){x=0;y=1;return b;}ll x1,y1;ll gcd = gcdExtended(b%a,a,x1,y1);x=y1-(b/a)*x1;y=x1;return gcd;}//o(log(b))
;
void prac(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
   #endif 
}
string k;ll d;
ll size;
ll dp[10005][2][102];
ll solve(ll index,ll active,ll sum){
	if(index==size){
		return (sum==0);
		
	}
	// cout<<sum<<endl;
	if(dp[index][active][sum]!=-1)return dp[index][active][sum];
	ll ret=0;
	ll cur=k[index]-'0';
	if(!active){
		cur=9;
	}
	for(ll i=0;i<=cur;i++){
		ret+=solve(index+1,(active)&(i==cur),(sum+i)%d);
		// cout<<sum<<" "<<ret<<endl;
		ret%=mod;
	}
	dp[index][active][sum]=ret;
	return ret;




}






int main() 
{
  	// prac();
  
  	cin>>k;
  	for(ll i=0;i<=10000;i++)for(ll j=0;j<2;j++)for(ll k=0;k<=100;k++)dp[i][j][k]=-1;
  	in(d)
  	ll ans=0;
  	size=k.size();
  	for(ll i=0;i<=(k[0]-'0');i++)
  	{
  		ans+=solve(1,i==(k[0]-'0'),(i)%d);
  		// cout<<i<<" "<<ans<<endl;
  		ans%=mod;
  	}
  	// cout<<ans<<endl;
  	out((ans-1+mod)%mod);



  	

}
/*error-----
convert every int to long long eg-1LL
create array with proper analysis of problem constrain
check mod also
*/






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

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		while(true) {
			int n=Integer.parseInt(in.next()),x=Integer.parseInt(in.next());
			if(n==0 && x==0)break;
			int cnt=0;
			for(int i=1;i<=n-2;i++) {
				for(int j=i+1;j<=n-1;j++) {
					for(int k=j+1;k<=n;k++) {
						if(i+j+k==x)cnt++;
					}
				}
			}
			out.println(cnt);
		}
		out.flush();
	}

}


Measured memory_bytes: 26948
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	for(int i = 1; i <= 50000; i++){
		if((int)(i * 1.08)== n){
			printf("%d", i);
			return 0;
		}
	}
	printf(":(");
	return 0;
}

Measured memory_bytes: 256
n = int(input())
b = list(map(int,input().split()))
a =[b[0]]
for i in range(n-2):
    if b[i] <= b[i+1]:
         a.append(b[i])
    else:
         a.append(b[i+1])
a.append(b[n-2])
print(sum(a))

Measured memory_bytes: 3060
#include <iostream>
#include <climits>
#include <algorithm>

int main()
{
	int data_num = 0;
	int min = INT_MAX;
	int prev = INT_MAX;
	int result = INT_MIN;

	std::cin >> data_num;

	for(int i = 0; i < data_num; i++ ){
		int data = 0;
		std::cin >> data;

		result = std::max(data - min, result);
		min = std::min(data, min);
		prev = data;
	}

	std::cout << result << std::endl;

	return 0;
}


Measured memory_bytes: 3116
/*
 * author :Sadik Hassan
 *
*/
#include "bits/stdc++.h"
using namespace std;
using   ll =          long long;
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define PI            (acos(-1.0))
#define repp(i,a,n)   for(int i=a;i<n;i++)
#define rep(i,n)      for(int i=0;i<n;i++)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
#define w(t)          int t;cin>>t;while(t--)
#define TSFL(s)       transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSFH(s)       transform(s.begin(),s.end(),s.begin(),::tolower);
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0),cout<<fixed<<setprecision(15);
typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = 2e5+10;
const int INF = (int)1e9+5;

int main()
{
    _SAD()
    ll n,ans=0;
    cin>>n;
    for(int i=2;i<1e6+10;i++)
    {
        int cnt=0;
        while(n%i==0)
        {
            cnt++;
            n/=i;
        }
        for(int j=1;j<10000;j++)
        {
            if(cnt<j)break;
            ans++;
            cnt-=j;
        }
    }
    if(n>1)ans++;
    cout<<ans<<nl;
    return 0;
}


Measured memory_bytes: 3652
#include <stdio.h>
#include <stdlib.h>

struct shop {
	long long int A;
	long long int B;
};

int compare(const void *a, const void *b) {
	struct shop *A = (struct shop *)a;
	struct shop *B = (struct shop *)b;
	if(A->A < B->A) return -1;
	if(A->A > B->A) return 1;
	return 0;
}

int main() {
	long long int N;
	long long int M;
	long long int index = 0;
	struct shop *shop;
	long long int i;
	long long int min_money = 0;

	scanf("%lld", &N);
	scanf("%lld", &M);
	shop = (struct shop *)malloc(sizeof(struct shop) * N);
	for(i = 0;i<N;i++) {
		scanf("%lld", &shop[i].A);
		scanf("%lld", &shop[i].B);
	}
	qsort(shop, N, sizeof(struct shop), compare);

	for(i=0;i<N;i++) {
		if(shop[i].B <= M) {
			min_money += shop[i].A * shop[i].B;
			M = M - shop[i].B;
		} else {
			min_money += shop[i].A * M;
			break;
		}
	}
	printf("%lld\n", min_money);
	return 0;
}



Measured memory_bytes: 3324
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define INF 1e16
ll n0;
ll par[100005];
ll lev[100005]={0};
ll vis[100005];

ll dfs(vector<ll> v1[],ll x)
{
    //vis[x]=1;
    ll a=0;
    if(lev[x]!=0) return lev[x];
    if(v1[x].size()==0) return 0;
    for( auto i : v1[x])
    {
        a=max(a,dfs(v1,i)+1);
    }
    lev[x]=a;
    return lev[x];
    
    
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,d,e,f,n,m,k,t,q;
    t=1;
    //cin>>t;
    while(t--)
    {
        cin>>n>>m;
        vector<ll> v1[n+1];
        for(int i=0;i<m;i++)
        {
            cin>>a>>b;
            v1[a].push_back(b);
            //par[b]=a;
        }
        a=0;
        for(int i=1;i<=n;i++)
        {
            a=max(a,dfs(v1,i));
        }
        
        cout<<a;
        
    }
    return 0;
}


Measured memory_bytes: 8576
#include<stdio.h>
#include<string.h>
int main(void) {
	int a, b, c,d;
	scanf("%d%d%d", &a, &b, &c);
	if (a <= c) {
		d = c - a;
		if (d <= b) { printf("YES\n"); }
		else printf("NO\n");
	}
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
K = int(input())
tmp = 1
ans = -1

if K % 7 == 0:
    L = 9 * K // 7
else:
    L = 9 * K

for i in range(10 ** 7):
    tmp *= 10
    tmp = tmp % L
    if tmp == 1:
        ans = i + 1
        break
   
print(ans)

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w, d;
    cin >> h >> w >> d;
    vector<pair<int, int>> v(h*w+1);
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            int a;
            cin >> a;
            v[a] = make_pair(i+1, j+1);
        }
    }
    long loc[h*w+1];
    for(int i = h*w; i > 0; i--){
        if(i+d > h*w) loc[i] = 0;
        else{
            loc[i] = loc[i+d] + abs(v[i].first - v[i+d].first)
                + abs(v[i].second - v[i+d].second);
        }
    }
    int q;
    cin >> q;
    long long ans;
    for(int i = 0; i < q; i++){
        ans = 0;
        int l, r;
        cin >> l >> r;
        ans = loc[l] - loc[r];
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 2560
/* ***********************************************
Author        :yang12138
Created Time  :2017年04月22日 星期六 23时45分36秒
File Name     :C.cpp
************************************************ */
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
typedef long long ll;
typedef pair<int,int>pii;
#define lson (root<<1)
#define rson (root<<1|1)

const int N=1e5+10;

int n;
ll solve(const int* a){
	ll ans=0,s=a[1];
	bool flag=0;
	if(a[1]>0) flag=1;
	for(int i=2;i<=n;i++){
		s+=a[i];
		if(i&1){
			if(flag){
				if(s>0) continue;
				ans+=abs(s)+1,s=1;
			}
			else{
				if(s<0) continue;
				ans+=s+1,s=-1;
			}
		}
		else{
			if(flag){
				if(s<0) continue;
				ans+=s+1,s=-1;
			}
			else{
				if(s>0) continue;
				ans+=abs(s)+1,s=1;
			}
		}
	}
	return ans;
}

int a[N];
int main(){
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",a+i);
	if(a[1]!=0){
		ll ans=solve(a);
		if(a[1]>0){
			int tmp=a[1];
			a[1]=-1;
			ans=min(ans,tmp+1+solve(a));
		}
		else{
			int tmp=abs(a[1]);
			a[1]=1;
			ans=min(ans,tmp+1+solve(a));
		}
		printf("%lld\n",ans);
	}
	else{
		a[1]=1;
		ll ans=solve(a);
		a[1]=-1;
		ans=min(ans,solve(a));
		printf("%lld\n",ans+1);
	}
    return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  int n, m;
  scan(n, m);
  vi l(m), r(m);
  rep (i, m) {
    scan(l[i], r[i]);
  }
  int l_max = l[0];
  int r_min = r[0];
  rep (i, m) {
    l_max = max(l_max, l[i]);
    r_min = min(r_min, r[i]);
  }
  int ans = max(0, r_min - l_max + 1);
  print(ans);

  return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<queue>
#include<math.h>
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
#define mod 10007
using  namespace std;
int maxn (int a,int b,int c){return max(max(a,b),max(b,c));}
int main()
{
    int n;
    long long m,a[100005];
    scanf("%d%lld",&n,&m);
    for(int i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    long long sum=0;
    if(a[0]>m){
        sum=a[0]-m;
        a[0]=m;
    }
   // printf("%lld\n",sum);
    for(int i=1;i<n;i++)
    {
        if(a[i]+a[i-1]>m)
        {
            sum+=a[i]+a[i-1]-m;
            a[i]=m-a[i-1];
        }
    }
    printf("%lld\n",sum);
    return 0;
}



Measured memory_bytes: 1024
n,m=map(int,input().split())
up=float('inf')
dp=[[up]*(1<<n) for i in range(m)]
dp[0][0]=0
buy=[]
a=[]
for cnt in range(m):
    x,y=map(int,input().split())
    a.append(x)
    c=list(map(int,input().split()))
    tmp=0
    for w in c:
        tmp|=1<<(w-1)
    buy.append(tmp)
for i in range(m-1):
    for j in range(1<<n):
        dp[i+1][j]=min(dp[i+1][j],dp[i][j])
        dp[i+1][j|buy[i]]=min(dp[i][j]+a[i],dp[i+1][j|buy[i]]) #i番目を買っているよ
if dp[m-1][-1]==float('inf'):
    print(-1)
else:
    print(dp[m-1][-1])

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int a, b;

int main() {
	cin >> a >> b;
	
	cout << (a + b + 1) / 2 << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
using vll = vector<ll>;
using vdouble = vector<double>;
using vstr = vector<string>;
typedef pair<int,int> P;
int dx[4] = {1, 0, -1, 0},dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
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; }
const ll INF = 1LL << 60;
const ll mod = 1000000007;

int main(){
	//入力
    ll N; cin>>N;
    vll A(N),sum(200200);
	rep(i,N)cin>>A[i];
	rep(i,200200)sum[i]=0;
	rep(i,N){
		ll k=A[i];
		sum[k]++;
	}
	ll ans=0;
	rep(i,200200){
		ans+=sum[i]*(sum[i]-1)/2;
	}
	rep(i,N){
        ll k=A[i];
		cout<<ans-sum[k]*(sum[k]-1)/2+(sum[k]-1)*(sum[k]-2)/2<<endl;
	}
}

Measured memory_bytes: 5760
// Marcin Knapik
#include<bits/stdc++.h>

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;

// #include <ext/pb_ds/assoc_container.hpp> // order_of_key
// #include <ext/pb_ds/tree_policy.hpp> // find by order
// using namespace __gnu_pbds; 
// #define ordered_set tree< pair<int, int> , null_type,less<pair<int, int>>, rb_tree_tag,tree_order_statistics_node_update>  

// const ll MAX_LL = 0xFFFFFFFFFFFFFFFF;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define losuj(a, b) uniform_int_distribution<ull>(a, b)(rng)
#define losuj_real(a, b) uniform_real_distribution<long double>(a, b)(rng)

typedef long double             ld;
typedef long long               ll;
typedef unsigned long long      ull;
typedef pair<ll, ll>            pll;
typedef pair<int, int>          ii;
typedef vector<int>             vi;
typedef vector<ii>              vii;
typedef vector<vi>              vvi;
typedef vector<vector<ii>>      vvii;
typedef vector< ll >            vll;
typedef vector< pll >           vpll;
 
#define sz(a)                   (int)(a).size()
#define pb                      push_back
#define all(c)                  (c).begin(), (c).end()
#define rall(c)                 (c).rbegin(), (c).rend()
#define FOR(i, a)               for (int i = 0; i < (a); i++)
#define f                       first
#define s                       second
 
template <class T> inline bool setmin(T &a, T b){if (a > b)return a = b, 1;return 0;}
template <class T> inline bool setmax(T &a, T b){if (a < b)return a = b, 1;return 0;}
 
template<class T> inline T fast(T a,T b,T mod) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}
template<class T> inline T russian(T a, T b, T mod) {ll res = 0; while(b){if(b&1) res = (res + a)%mod; a = (a+a)%mod; b>>=1;}return res;}
template <class T> istream &operator>>(istream &os, vector<T> &container){for (auto &u : container)os >> u;return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &container){for (auto &u : container)os << u << " ";return os;}
template<typename T> inline T gcd(T a, T b) { while (b)swap(a %= b, b); return a; }
  
const ll INF = 1e9 + 7;
const ll mod = 998244353;
const ll N = 1e6+7;
const ll T = 1<<20;
const ll BIG_INF = 1e18 + 7;

ll n, m, k, q;

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

    cin >> n >> k; 

    vi tab(n);
    for(auto&u:tab)
    	cin >> u;

  	vi dp(n, INF);
  	dp[0] = 0;

  	for(int i = 1; i < n; i++)
  		for(int j = i-1; j >= max((ll)0, i-k); j--)
  			setmin(dp[i], dp[j] + abs(tab[i]-tab[j]));

  	cout << dp[n-1] << '\n';
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int n,ans;
bool check(int x)
{
	int cnt=0;
	for (int i=1;i<=x;i++) if (x%i==0) cnt++;
	if (cnt==8) return true;
	else return false;
}
int main()
{
	cin>>n;
	for (int i=1;i<=n;i+=2) if (check(i)) ans++;
	cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(void) {
  string s, t;
  cin >> s;
  t = s;
  reverse(t.begin(), t.end());
  if (t == s) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <unordered_map>
// #include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x)  if(DEBUG_Switch) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
ll poww(ll a, ll b) { if (a == 0ll) {return 0ll;} ll ans = 1; while (b) {if (b & 1) {ans = ans * a ;} a = a * a ; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
void pvarr_int(int *arr, int n, int strat = 1) {if (strat == 0) {n--;} repd(i, strat, n) {printf("%d%c", arr[i], i == n ? '\n' : ' ');}}
void pvarr_LL(ll *arr, int n, int strat = 1) {if (strat == 0) {n--;} repd(i, strat, n) {printf("%lld%c", arr[i], i == n ? '\n' : ' ');}}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
#define DEBUG_Switch 0
int main()
{
#if DEBUG_Switch
    freopen("C:\\code\\input.txt", "r", stdin);
#endif
    //freopen("C:\\code\\output.txt","r",stdin);
    int n = readint();
    int k = readint();
    int base = k;
    int l = 1;
    int r = k + 1;
    while (base--)
    {
        if (l >= r)
        {
            l = k + 2;
            r = 2 * k + 1;
        }
        printf("%d %d\n", l++, r-- );
    }
    return 0;
}




Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  if(N == 1){
    cout << "Hello World" << endl;
  }
  if(N == 2){
    int A,B;
    cin >> A >> B;
    cout << A+B << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int ll
#define inf 0x3f3f3f3f
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long
#define vi vector <int>
#define pii pair <int, int>
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i,n) for (int i = 0; i < (int) (n); ++ i)
#define foreach(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); ++ it)

inline int read() {
	int x = 0, f = 1, c = getchar();
	for (;!isdigit(c);c = getchar()) if (c == '-') f ^= 1;
	for (; isdigit(c);c = getchar()) x = x * 10 + c - '0';
	return f ? x : -x;
}

string s, t;
string to2(int x) {string str; rep(i, 60) str = char('0' + (x >> i & 1)) + str; return str;}

int dp[60][2][2][2][2];

int DP(int id, int sml, int lgr, int fst, int smll) {
	if (id == 60) return 1;
	int & rem = dp[id][sml][lgr][fst][smll];
	if (~rem) return rem;
	int res = 0;
	for (int a = lgr ? 0 : s[id] - '0'; a <= (sml ? 1 : t[id] - '0'); ++ a) {
		for (int b = lgr ? 0 : s[id] - '0'; b <= (sml ? 1 : t[id] - '0'); ++ b) {
			if (!fst && b && !a) continue;
			if (a > b) continue;
			res += DP(id + 1, sml | b < t[id] - '0', lgr | a > s[id] - '0', fst | b, smll | a < b);
			if (res >= mod) res -= mod;
		}
	}
//	printf("%d %d %d %d %d = %d\n", id, sml, lgr, fst, smll, res);
	return rem = res;
}

signed main() {
	int l, r;
	scanf("%lld %lld", &l, &r);
	s = to2(l), t = to2(r);
	memset(dp, -1, sizeof dp);
	printf("%lld\n", DP(0, 0, 0, 0, 0));
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

struct Graph {
    struct VertexQ {
        bool operator<(const VertexQ& o) const {
            return c > o.c; // 逆
        }
        int i;
        ll c;
    };
    struct Vertex { int n; ll c; };
    struct Edge { int i, n, c; };
    Graph(int n, int m) : v(n, { -1 }), e(m), n(n), m(0) {}
    void add_edge(int i, int j, int c) {
        e[m] = { j, v[i].n, c };
        v[i].n = m;
        m++;
    }
    void dijkstra(int i) {
        for (int i = 0; i < n; i++) v[i].c = 1LL << 60;
        priority_queue<VertexQ> q;
        q.push({ i, v[i].c = 0 });
        while (!q.empty()) {
            auto p = q.top(); q.pop();
            //if (p.i == j) break;
            if (p.c > v[p.i].c) continue;
            for (int j = v[p.i].n; j >= 0; j = e[j].n) {
                Edge& o = e[j];
                ll c = p.c + o.c;
                if (c < v[o.i].c) q.push({ o.i, v[o.i].c = c });
            }
        }
    }
    vector<Vertex> v;
    vector<Edge> e;
    int n, m;
};

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

    int n, m, s, t;
    cin >> n >> m >> s >> t;
    s--; t--;

    Graph g0(n, m * 2), g1(n, m * 2);
    for (int i = 0; i < m; i++) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        u--; v--;

        g0.add_edge(u, v, a);
        g0.add_edge(v, u, a);
        g1.add_edge(u, v, b);
        g1.add_edge(v, u, b);
    }

    g0.dijkstra(s);
    g1.dijkstra(t);

    vector<ll> r(n);
    ll x = 1LL << 60;
    for (int i = n - 1; i >= 0; i--) {
        x = min(x, g0.v[i].c + g1.v[i].c);
        r[i] = x;
    }

    ll y = 1000000000000000LL;
    for (int i = 0; i < n; i++) {
        cout << y - r[i] << '\n';
    }
    cout << flush;

    return 0;
}

Measured memory_bytes: 10436
# include<stdio.h>
int main(void)
{
   int n,i,j,flag=0;
   scanf("%d",&n);
   for(i=1;i<=9;i++){
    for(j=1;j<=9;j++)
    if(n==i*j)
   {
       flag=1;
       break;
   }
}
if(flag==1)
    printf("Yes");
else
    printf("No");
  
  return 0;

}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count[] = new int[5];
		for (int i = 0; i < 3; ++i) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			count[a]++;
			count[b]++;
		}
		sc.close();
		String ans[] = { "YES", "NO" };
		int a = 0;

		for (int i = 1; i < 5; ++i) {
			if(count[i] == 3)a = 1;
		}
		System.out.println(ans[a]);
	}

}


Measured memory_bytes: 22740
#include<bits/stdc++.h>
using namespace std;
int n,p[200010],k,num,ans;
int main(){
	cin>>n>>k;
	for (int i=0;i<k;i++){
		cin>>p[i];
		num+=p[i];
	}
	ans=num;
	for (int i=k;i<n;i++){
		cin>>p[i];
		num+=p[i]-p[i-k];
		ans=max(ans,num);
	}
	float x=ans,y=k;
	printf("%.12f",(x+y)/2);
	return 0;
}

Measured memory_bytes: 1024
use std::io;
use std::collections::VecDeque;

fn main() {
    let mut input = Input::new();
    let n: usize = input.next();
    let mut a: usize = input.next();
    let mut x = a / 2;
    a %= 2;
    for _ in 0..n - 1 {
        let mut t: usize = input.next();
        let c = if a > t { t } else { a };
        x += c;
        t -= c;
        x += t / 2;
        t %= 2;
        a = t;
    }
    println!("{}", x);
}

struct Input {
    queue: VecDeque<String>,
}

impl Input {
    fn new() -> Input {
        Input { queue: VecDeque::new() }
    }

    fn next<T>(&mut self) -> T
        where T: std::str::FromStr,
              T::Err: std::fmt::Debug
    {
        if self.queue.is_empty() {
            let mut line = String::new();
            let _ = io::stdin().read_line(&mut line);
            for x in line.split_whitespace() {
                self.queue.push_back(String::from(x));
            }
        }
        return self.queue.pop_front().unwrap().parse::<T>().unwrap();
    }
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main(){

  int A, B, C;

  cin >> A;
  cin >> B;
  cin >> C;

  cout << max(C - (A-B), 0) << endl;;

  return 0;
}


Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


int main_B() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, X; cin >> N >> X;
    vi m(N); REP(i, N) cin >> m[i];

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

    int ans = 0;
    int mat = X;
    REP(i, N) {
        mat -= m[i];
        ans++;
    }
    ans += mat / m[0];

    cout << ans << endl;

    return 0;
}

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

int main()
{
  char arr[110000];
  char divide[4][10] = {"dream", "dreamer", "erase", "eraser"};

  fgets(arr, sizeof(arr), stdin);
  arr[strlen(arr) - 1] = '\0';  //改行の場所にナル文字

  //文字列を反転させる
  for (int i = 0; i < 4; i++) {
    char t[10];
    size_t siz_s = strlen(divide[i]) - 1;
    int r = 0;
    for (int j = siz_s; j >= 0; j--) {
      t[r] = divide[i][j];
      r++;
    }
      t[r] = '\0';

    for (int j = 0; j <= siz_s; j++) {
      divide[i][j] = t[j];
    }

  }

  size_t siz_arr = strlen(arr);
  char arr_ex[110000];
  int r = 0;

  for (int i = siz_arr-1; i >= 0; i--) {
    arr_ex[r] = arr[i];
    r++;
  }
   arr_ex[r] = '\0';


  bool flag = true;
  int count = 0;

  for (; arr_ex[count] != '\0'; ) {
    int i,j;
    char t[10];
  for (i = count,j=0; i < count + 5; i++,j++) {
    t[j] = arr_ex[i];
  }
    t[j] = '\0';
    if ( strcmp(divide[0], t) == 0) {
      count += 5;
      continue;
    }
    if ( strcmp(divide[2], t) == 0) {
      count += 5;
      continue;
    }
  for (i = count,j=0; i < count + 6; i++,j++) {
    t[j] = arr_ex[i];
  }
    t[j] = '\0';
    if ( strcmp(divide[3], t) == 0) {
      count += 6;
      continue;
    }
  for (i = count,j=0; i < count + 7; i++,j++) {
    t[j] = arr_ex[i];
  }
    t[j] = '\0';
    if ( strcmp(divide[1], t) == 0) {
      count += 7;
      continue;
    }
    
    flag = false;
    break;
  }

  if (flag == false) {
    printf("NO\n");
  } else {
    printf("YES\n");
  }


  return 0;
}


Measured memory_bytes: 384