akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
#define MOD 1000000007
void input_array(int how_data,int *data);
int get_random(int min, int max);
int factorial(int n);
int fibonacci(int n);
int qsort_09(const int *sys1 , const int *sys2);
int qsort_90(const int *sys1 , const int *sys2);

int main(void){
    char a,b;
    scanf("%c %c",&a,&b);
    a==b?printf("H\n"):printf("D\n");
    return 0;
    
    
}


//how_data個の配列data[]に標準入力
//input_array(how_data,data);
void input_array(int how_data,int *data){
    int loop;
    for(loop=0;loop<how_data;loop++){
        scanf("%d",&data[loop]);
    }
}

int get_random(int min, int max){   //指定の範囲から乱数を1つ返すやつ
    //srand((unsigned int)time(0));   //現在時刻で疑似乱数初期化
    rand();rand();rand();rand();    //乱数を空打ち
    return (rand()%(max+1-min))+min;
}


int factorial(int n){//n!のMOD10^9+7を返すやつ
    unsigned long long int ret=1;
    for(int i=1;i<=n;i++)ret=(ret*i)%1000000007;
    return (int)ret;
}

int qsort_09(const int *sys1 , const int *sys2){ //小さいのが上にくるやつ
    //qsort(data,how_data,sizeof(int),(int (*)(const void *,const void *))qsort_09);
    if(*sys1<*sys2){
        return -1;
    }else if(*sys1==*sys2){
        return 0;
    }else{
        return 1;
    }
}

int qsort_90(const int *sys1 , const int *sys2){ //大きいのが上にくるやつ
    //qsort(data,how_data,sizeof(int),(int (*)(const void *,const void *))qsort_90);
    if(*sys1<*sys2){
        return 1;
    }else if(*sys1==*sys2){
        return 0;
    }else{
        return -1;
    }
}
int fibonacci(int n){
    switch(n){
        case 0:return 0;
        case 1:return 1;
        default :return fibonacci(n-1)+fibonacci(n-2);
    }
}



Measured memory_bytes: 128
n=int(input())
a=list(input().split())
b1=[]
b2=[]
if n%2==0:
    for i in range(n):
        if i%2!=0:
            b1.append(a[n-i])
        else:
            b2.append(a[i])
else:
    for i in range(n):
        if i%2==0:
            b1.append(a[n-1-i])
        else:
            b2.append(a[i])

b1.extend(b2)

print(" ".join(b1))

Measured memory_bytes: 27204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll> > P3;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()


int main() {
    int n, cnt[3]{}, a, b;
    cin >> n >> a >> b;
    REP(i,n){
        int p;
        cin >> p;
        if(p <= a) cnt[0]++;
        else if(p <= b) cnt[1]++;
        else cnt[2]++;
    }
    int ans = IINF;
    REP(i,3) ans = min(ans,cnt[i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import copy
S_original = input()
T = input()

lis_t = list(T)
T_size = len(T)
S_size = len(S_original)
hantei = 0
lis = []

if T_size <= S_size:
    for start_index in range(S_size - T_size + 1):

        S_prime = copy.deepcopy(S_original)
        hantei = 0
        for i in range(T_size):
            if S_prime[start_index+i] == T[i]:
                continue
            elif S_prime[start_index+i] == "?":
                s_lis = list(S_prime)
                s_lis[start_index+i] = lis_t[i]
                S_prime = "".join(s_lis)
            elif S_prime[start_index+i] != T[i]:
                hantei = 1
                break
        if hantei == 0:
            for j in range(S_size):
                if S_prime[j] != "?":
                    continue
                else:
                    s_lis = list(S_prime)
                    s_lis[j] = "a"
                    S_prime = "".join(s_lis)
            lis.append(S_prime)

if lis:
    lis = sorted(lis)
    print(lis[0])
else:
    print ("UNRESTORABLE")


Measured memory_bytes: 38768
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>

using namespace std;
typedef unsigned long ul;

int main(int argc, char const *argv[]) {
  string inp;

  cin >> inp;
  if(inp == "SUN"){
    cout << 7;
  } else if(inp == "MON"){
    cout << 6;
  } else if(inp == "TUE"){
    cout << 5;
  } else if(inp == "WED"){
    cout << 4;
  } else if(inp == "THU"){
    cout << 3;
  } else if(inp == "FRI"){
    cout << 2;
  } else if(inp == "SAT"){
    cout << 1;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;
 
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; }
 
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }
 
 
signed main()
{
  int a,b;cin>>a>>b;
  int ans=a-2*b;
  if(ans<0)ans=0;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
' Imports System.Collections.Generic
' Imports System.Text.RegularExpressions

Class Main
    Public Shared Sub Main()
        Dim K As Integer
        DIm S As String
        K = Console.ReadLine()
        S = Console.ReadLine()
        If S.Length <= K Then
            Console.WriteLine(S)
        Else
            Console.WriteLine(S.Substring(0, K) & "...")
        End If
        Return
    End Sub
End Class


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

int main(){
    int arr[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
};
    int k; cin >> k;
    cout << arr[k-1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18
// cout << fixed << setprecision(10);

int main() {
    int X, Y;
    cin >> X >> Y;
    if (((Y  - 2 * X) % 2) != 0) {
        cout << "No" << endl;
    }
    else {
        int b = (Y  - 2 * X) / 2;
        int a = X - b;
        if ((a >= 0) && (b >= 0)) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
}


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

int main()
{
  int a[3];
  rep(i,3){
    cin >> a[i];
  }
  sort(a, a + 3);
  cout << a[0] + a[1] << endl;
  return 0;
}


Measured memory_bytes: 3584
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int[] ab=cin.ArrayInt(2,0);
        if(ab[0]<=ab[1])Console.WriteLine(ab[0]);
       else Console.WriteLine(ab[0]-1);
        
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
    public void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}

Measured memory_bytes: 13140
n=int(input())
a1=list(map(int,input().split()))
a2=list(map(int,input().split()))
cand=0
cand_max=0

for i in range(n):
	cand += sum(a1[:(i+1)])+sum(a2[i:n])
	if cand > cand_max:
		cand_max=cand
	cand=0

print(cand_max)

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int x,t;cin>>x>>t;

    cout<<max(0,x-t)<<endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<static_cast<int>(n);++i)
#define per(i, n) for(int i=static_cast<int>(n)-1;i>=0;--i)
#define eee(a) (cerr<<"[@"<<__LINE__<<"] "<<(#a)<<": "<<(a)<<'\n');
#define ppp(a) (cout<<(a)<<'\n'); 
#define cop(a) for(auto x:(a)){cerr<<(x)<<'\n';}
using ll = long long;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
constexpr ll MOD = 1e9+7;
constexpr ll Mod = 998244353;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr double phi = (1+sqrt(5))/2;
constexpr double pi = 3.14159265358979323846264338327950288;
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll inverse(ll n,ll m=MOD){ll a=n,b=m,x=1,y=0;while(b){ll t=a/b;a-=t*b;swap(a,b);x-=t*y;swap(x,y);}return (a%m+m)%m;}
inline void Yes(){puts("Yes");}
inline void No(){puts("No");}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){puts("YES");}
inline void NO(){puts("NO");}
inline void JUDGE(bool b){b?YES():NO();}
inline ll powmod(ll b, ll e, ll m=MOD){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
inline double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}
inline double d2r(double d){return d*pi/180;}
inline double r2d(double r){return r*180/pi;}
template<class T>inline bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
template<typename T1,typename T2>ostream& operator<<(ostream& s,const pair<T1, T2>& p){return s <<"("<<p.first<<", "<<p.second<<")";}
template<typename T> ostream& operator<<(ostream& s,const vector<T>& v){s<<'[';for(size_t i=0;i<v.size();++i){s<<v[i];if(i<v.size()-1)s<<", ";}s<<']';return s;}
template<typename T> istream& operator>>(istream& s,vector<T>& v){for(T& x:v)s>>x;return s;}

int main(){
    cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = n/(a+b)*a;
    n %= (a+b);
    ans += min(n, a);
    cout << ans << '\n';
    
    
    
    
    return 0;
}


Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    K,X = MI()
    ans = [X-K+1+i for i in range(2*K-1)]
    print(*ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const K = parseInt(arg[0].split(" ")[1]);
    
    const V = arg[1].split(" ").map(n=>parseInt(n));
    
    let answerList = [0];
    
    for(let a=0; a<=Math.min(K, N); a++) {
        for(let b=0; b<=Math.min(K, N); b++) {
            const rest = K - (a + b);
            
            if(N < a + b) continue;
            if(rest < 0) continue;
            
            let list = [];
            
            list = [...V.slice(0, a), ...V.slice(V.length - b, V.length)];

            list.sort((a,b)=>a-b);
            
            let deleteCnt = 0;
            
            for(let i=0; i<rest; i++) {
                if(list[i] < 0) {
                    deleteCnt++;
                } else {
                    break;
                }
            }
            
            list.splice(0, deleteCnt);
            
            if(list.length) {
                answerList.push(list.reduce((m,n)=>m+n));
            }
        }
    }
    
    const answer = answerList.sort((a,b)=>b-a)[0];
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main(){

    unordered_map<string,int> mp ={ {"RE", 0 }, {"TLE", 0}, {"WA", 0}, {"AC", 0} };
    string str;
    int n;
    cin >>n;
    for (int i =0; i < n; i++){
        cin>>str;
        mp[str]++;
    }

    for (auto m : mp)
        cout << m.first << " x " << m.second <<endl;


}

Measured memory_bytes: 3596
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cmath>
#include<bitset>
typedef long long ll;
#define PB	push_back
#define FOR(n)			for(int i = 0; i < n; ++i)
#define RFOR(n)			for(int i = n; i >= 0; --i)
#define FORR(start,end) for(int i = start; i < end; ++i)
#define COUT(n)			cout << n << " " << flush
#define vi(v)			vector<int> v
#define vii(v)			vector<pair<int,int>> v
#define pii(p)			pair<int,int> p
#define mii(m)			map<int, int> m
#define msi(m)			map<string, int, less<>> m
#define mmsi(m)			multimap<string, int, less<>> m
#define mkp(a,b)		make_pair(a,b)
#define ALL(obj)		obj.begin(), obj.end()
#define PI 3.141592
#define MOD 1e9+7
using namespace std;

void solve() {
	int n;
	bool ok = true;
	cin >> n;
	vi(a)(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	sort(ALL(a));
	for (int i = 0; i < n - 1; ++i)
		if (a[i] == a[i + 1]) ok = false;
	if (ok)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}

int main() {
	solve();
	return 0;
}

Measured memory_bytes: 1024
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;

string s;
bool is_balanced(int l, int r){
	for(; l < r; ++l) {
		switch(s[l]) {
		case '(':
		case'[':
			goto next;
		case ')':
		case ']':
			return false;
		}
	}

	return true;

next:;

	int cnt = 1;
	for(int i = l + 1; i < r; ++i) {
		switch(s[i]) {
		case '(':
		case'[':
			++cnt;
			break;
		case ')':
		case ']':
			if(--cnt == 0) {
				if(s[l] == '(' && s[i] == ')' || s[l] == '[' && s[i] == ']')
					return is_balanced(l + 1, i) && is_balanced(i + 1, r);
			}
		}
	}

	return false;
}

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

	while(getline(cin, s), s != ".")
		cout << (is_balanced(0, s.size()) ? "yes" : "no") << endl;

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1180
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<iosfwd>
#include<sstream>
#define N 100
using namespace std;
int main(){
    int n,k;
    string s;
    cin >> n >> s >> k;
    const char* x= s.c_str();
    char t= x[k-1];
    for(int i=0; i<strlen(x); i++){
        if(x[i]==t) cout << t;
        else cout << "*";
    }
    cout << endl;
}


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

using namespace std;

typedef long long LL;

int main(){
  int N, K;
  cin >> N >> K;
  LL H[200010];
  for(int i=0; i<N; i++) cin >> H[i];
  sort(H, H+N);
  long long ans=0;
  for(int i=0; i<N-K; i++) ans+=H[i];
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const long long mod=998244353,maxn=10000;
long long jc[11111],injc[11111],pw[11111],numfake;
bool f;
long long binpow(long long a,long long t)
{
	long long res=1,p=a;
	for (long long i=t;i;i>>=1)
	{
		if (i&1) res=res*p%mod;
		p=p*p%mod;
	}
	return res;
}
long long C(long long n,long long m)
{
	if (n<m || m<0 || n<0) return 0;
	return (jc[n]*injc[m]%mod)*injc[n-m]%mod;
}
long long chaban(long long n,long long m)
{
	return C(n+m-1,m-1);
}
long long k,n,ans,num;
long long solve(long long n,long long nf)
{
	long long res=0;
	for (long long i=0;i<=nf;i++)
	{
		res=(res+(pw[i]*chaban(n-i,k-nf*2+i)%mod)*C(nf,i))%mod;
	}
	return res;
}
int main()
{
	scanf("%lld%lld",&k,&n);
	jc[0]=injc[0]=1;
	for (long long i=1;i<=maxn;i++)
	{
		jc[i]=jc[i-1]*i%mod;
		injc[i]=injc[i-1]*binpow(i,mod-2)%mod;
	}
	pw[0]=1;
	for (long long i=1;i<=maxn;i++) pw[i]=pw[i-1]*2%mod;
	for (long long i=2;i<=2*k;i++)
	{
		f=0;numfake=0;
		for (long long j=1;j<=k;j++)
		{
			if (j*2==i) f=1;
			else if (i-j>0 && i-j<=k) numfake++;
		}
		if (i%2==0) k--;
		numfake/=2;
		if (f) printf("%lld\n",(solve(n,numfake)+solve(n-1,numfake))%mod);
		else printf("%lld\n",solve(n,numfake));
		if (i%2==0) k++;
	}
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<i64> A(N);
  map<i64, int> ma;
  for (auto& x : A) {
    cin >> x;
    ma[x]++;
  }
  vector<pair<i64, int>> va;
  int over = 0;
  for (auto [x, k] : ma) {
    va.emplace_back(x, k);
    over += k - 1;
  }
  int uniq = va.size();
  int ans = (over % 2) ? (uniq - 1) : uniq;
  cout << ans << endl;
}


Measured memory_bytes: 12232
#include <bits/stdc++.h>
#define int long long int
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}
#define DUMP(x)  cerr<<#x<<" = "<<(x)<<endl;

struct edge { int to, cost; };

const int INF = 1e18;
const int MOD = 1e9+7;

signed main()
{
   int n, x; cin >> n >> x;
   V<int> a(n);
   for (int i = 0; i < n; i++) {
      cin >> a[i];
   }

   V<V<int>> m(n, V<int>(n, INF));
   // m[k][i]: min(a[i-k], ... , a[i])
   copy(a.begin(), a.end(), m[0].begin());
   for (int k = 1; k < n; k++) {
      for (int i = 0; i < n; i++) {
         m[k][i] = min(m[k-1][i], a[(i-k+n) % n]);
      }
   }

   int ans = INF;
   for (int k = 0; k < n; k++) {
      int total = k * x;
      for (int i = 0; i < n; i++) {
         total += m[k][i];
      }
      chmin(ans, total);
   }
   cout << ans << endl;

   return 0;
}


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


int main(){
  	int n,a[100],cnt = 0;
  	cin >> n;
  	rep(i,0,n) cin >> a[i];
  
  	sort(a,a+n,greater<int>());
  	
  	rep(i,0,n){
      if(i > 0 && a[i-1] == a[i]){
        continue;
      }
      else{
        cnt++;
      }
    }
  
  	cout << cnt << endl;
  
	return 0; 
}

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

int main(){
    int N;
    cin>>N;
    vector < pair <int,int> > A(N);
    for(int i=0;i<N;i++){
        int num;
        cin>>num;
        A[i]=make_pair(num,i+1);
    }

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

    for(int i=0;i<N;i++){
        cout<<A[i].second;
        if(i==N-1) break;
        cout<<" ";
    }
   
   cout<<endl;

 return 0; 
}

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

int main(){
  int N;
  string S;
  cin >> N;
  cin >> S;
  int cnt = 0;
  for(int i=0;i<1000;i++){
    string s1=to_string((int)i/100),s2=to_string((int)(i%100)/10),s3=to_string((int)i%10);
  	string b = S;
    int p1 = b.find(s1);
    if(p1==string::npos)continue;
    b.erase(0,p1+1);
    int p2 = b.find(s2);
    if(p2==string::npos)continue;
    b.erase(0,p2+1);
    int p3 = b.find(s3);
    if(p3==string::npos)continue;
    //cout << i << endl;
    cnt++;
  }
  cout << cnt << endl;
}
  

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define mod (1000000007)


struct UnionFind {
    vector<int>pre,sz;
    UnionFind(int n) {
        sz=vector<int>(n,1);
        pre=vector<int>(n);
        for(int i=0;i<n;i++)pre[i]=i;
    }
    int find(int x) {
        if(x!=pre[x])pre[x]=find(pre[x]);
        return pre[x];
    }
    bool unite(int x,int y) {
        x=find(x);
        y=find(y);
        if(x==y)return false;
        if(x>y)swap(x,y);
        pre[y]=x,sz[x]+=sz[y];
        return true;
    }
    int maxsz(){
        int ans=0;
        for(auto it:sz)ans=max(ans,it);
        return ans;
    }
};

void solve() 
{
    int n,m;cin>>n>>m;
    UnionFind UF(n);
    REP(i,m){
        int a,b;cin>>a>>b;a--;b--;
        UF.unite(a,b);
    }
    cout<<UF.maxsz()<<endl;
}

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

Measured memory_bytes: 4780
#include <iostream>
#include <vector>
#include <string>
#include <functional>

template <class T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }

using lint = long long;
constexpr lint INF = 1LL << 60;

lint add(lint a, lint b) { return std::min(a + b, INF); }

void solve() {
    std::string s;
    std::cin >> s;
    int n = s.length();
    s = '$' + s;

    auto ldp = vec(n + 1, vec(n + 1, -1));
    auto pdp = vec(n + 1, vec(n + 1, 0LL));

    for (int len = 0; len <= n; ++len) {
        for (int l = 1; l <= n && l + len - 1 <= n; ++l) {
            int r = l + len - 1;

            if (len <= 1) {
                ldp[l][r] = len;
                pdp[l][r] = 1;
                continue;
            }

            if (s[l] == s[r]) {
                ldp[l][r] = ldp[l + 1][r - 1] + 2;
                pdp[l][r] = pdp[l + 1][r - 1];

            } else {
                if (ldp[l + 1][r] <= ldp[l][r - 1]) {
                    ldp[l][r] = ldp[l + 1][r] + 2;
                    pdp[l][r] = pdp[l + 1][r];

                } else {
                    ldp[l][r] = ldp[l][r - 1] + 2;
                    pdp[l][r] = pdp[l][r - 1];
                }

                if (ldp[l + 1][r] == ldp[l][r - 1]) {
                    pdp[l][r] = add(pdp[l + 1][r], pdp[l][r - 1]);
                }
            }
        }
    }

    bool valid = true;
    std::function<std::string(int, int, lint)>
        dfs = [&](int l, int r, lint k) {
            if (r - l + 1 <= 1) {
                if (k > 0) valid = false;
                return s.substr(l, r - l + 1);
            }

            int nl, nr;
            char c;
            if (s[l] == s[r]) {
                nl = l + 1, nr = r - 1;
                c = s[l];

            } else if (ldp[l + 1][r] < ldp[l][r - 1]) {
                nl = l + 1, nr = r;
                c = s[l];

            } else if (ldp[l + 1][r] > ldp[l][r - 1]) {
                nl = l, nr = r - 1;
                c = s[r];

            } else if (s[l] < s[r]) {
                if (k < pdp[l + 1][r]) {
                    nl = l + 1, nr = r;
                    c = s[l];
                } else {
                    k -= pdp[l + 1][r];
                    nl = l, nr = r - 1;
                    c = s[r];
                }

            } else {
                if (k < pdp[l][r - 1]) {
                    nl = l, nr = r - 1;
                    c = s[r];
                } else {
                    k -= pdp[l][r - 1];
                    nl = l + 1, nr = r;
                    c = s[l];
                }
            }

            auto t = dfs(nl, nr, k);
            return c + t + c;
        };

    lint k;
    std::cin >> k;
    auto ans = dfs(1, n, k - 1);
    std::cout << (valid ? ans : "NONE") << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}



Measured memory_bytes: 50460
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int ans = 0;
  string s;
  for(int i = 1; i <= n; ++i){
    if(to_string(i).length() % 2 != 0) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

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

using namespace std;

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

	long long int x,y;

	cin >> x >> y;

	if(x%y==0)
	{
		cout << -1 << '\n';
		return 0;
	}

	for(long long int i=1; ;i++)
	{
		long long int val = i*x;
		if(val%y!=0)
		{
			cout << val << '\n';
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3648
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

       int S = scan.nextInt();
       int h ;
       int m ;
       int s ;
        
       h = S/3600;
       m = (S%3600)/60;
       s = (S%3600)%60;
       System.out.println(h+":"+m+":"+s);
            }
        }


Measured memory_bytes: 26232
#include <stdio.h>

int main() {
    int N, min, temp, cou = 0;
    scanf("%d", &N);
    int A[N];
    for (int x=0; x<N; x++) {
        scanf("%d", &A[x]);
    }
    
    for (int i=0; i<N; i++) {
        min = i;
        for (int j=i; j<N; j++) {
            if (A[j] < A[min]) {
                min = j;
            }
        }
        temp = A[i];
        A[i] = A[min];
        A[min] = temp;
        if (i != min) {cou++;}
    }
    
    for (int y=0; y<N; y++) {
        printf("%d", A[y]);
        if (y == N - 1) {
            putchar('\n');
        } else {
            putchar(' ');
        }
    }
    printf("%d\n", cou);
    return 0;
}



Measured memory_bytes: 2128
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main(){
    int R[MAX], n;
    
    cin >> n;
    for (int i=0; i<n; i++) cin >> R[i];
    
    int maxv = -2000000000;
    int minv = R[0];
    
    for (int i = 1; i < n; i++){
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }
    
    cout << maxv << endl;
    
    return 0;
}


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

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define pb push_back
#define ins insert
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)9e18);
const int ninf=((int)-9e18);
const int mod=1000000007;

using namespace std;

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","r",stdin);
    //FILE *fptr2=freopen("out.txt","w",stdout);

    int n;
    cin>>n;

    vector <int> a(n);
    for(int &x:a)
        cin>>x;

    sort(all(a));

    double ans=a[0];

    for(int i=1;i<n;i++)
    {
        ans=(a[i]+ans)/2.0;
    }

    printf("%0.12f",ans);


    return 0;
}


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

using namespace std;

const int N = 100100;
const int mod = 1e9 + 7;

int n;
char s[N];
int cnt[26];

int main() {
	scanf("%d %s", &n, s + 1);
	for (int i = 1; i <= n; ++i) {
		++cnt[s[i] - 'a'];
	}
	int ans = 1;
	for (int i = 0; i < 26; ++i) {
		ans = 1LL * ans * (cnt[i] + 1) % mod;
	}
	ans = (ans - 1 + mod) % mod;
	printf("%d\n", ans);
}


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

public class Main {
    public static void main(String[] args) throws IOException {
        FastReader scan = new FastReader();
        //PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("marathon.out")));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        Task solver = new Task();
        //int t = scan.nextInt();
        int t = 1;
        for(int i = 1; i <= t; i++) solver.solve(i, scan, out);
        out.close();
    }
    static class Task {
        public void solve(int testNumber, FastReader sc, PrintWriter pw) {
            int n = sc.nextInt();
            int c = sc.nextInt();
            int sum=0;
            for(int i=0;i<c;i++){
                sum+=sc.nextInt();
            }
            pw.println(n>sum?"No":"Yes");
        }
    }
    static class tup implements Comparable<tup>{
        int a, b;
        tup(int a, int b){
            this.a=a;
            this.b=b;
        }

        @Override
        public int compareTo(tup o) {
            return a!=o.a?Integer.compare(a,o.a):Integer.compare(b,o.b);
        }
    }
    static void shuffle(long[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            long temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }
    static void shuffle(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(new File(s)));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}

Measured memory_bytes: 35716
#include <iostream>
#include <string>

using namespace std;

string s;
int n;

bool Valid(string val) {
  for (int i = 0; i < (int)val.size() / 2; ++i) {
    if (val[i] != val[(int)val.size() - i - 1]) {
      return false;
    }
  }
  return true;
}

int main(int argc, char const *argv[]) {
  cin >> s; n = (int)s.size();

  string t = s.substr(0, (n - 1) / 2);
  string u = s.substr((n + 3) / 2 - 1, n - (n + 3) / 2 + 1);
  if (Valid(s) && Valid(t) && Valid(u)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;


public class Main {
	static int N,K;
	static int[] trees;
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		 N = sc.nextInt();
		 K = sc.nextInt();
		 trees = new int[N];

		 for(int i = 0 ; i < N ; i++){
			 trees[i] = sc.nextInt();
			 }
		 sc.close();

		 Arrays.sort(trees);

		 int current = trees[K-1] - trees[0];
		 int height = 0 ;
		 for(int i = 1 ; i < N-K+1 ; i++){
			 height = trees[i+K-1]-trees[i];
			 
			 if(current > height){
				 current = height;
			 }
			 
		 }
	System.out.println(current);
	}
}

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

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

const int MAXN = 1e5;

int n, m, arr[MAXN+10];
ll ans=0;

int main()
{
    int i, j;
    scanf("%d%d", &n, &m);
    for(i=1; i<=n; i++) scanf("%d", &arr[i]);

    sort(arr+1, arr+n+1);

    vector<pii> V;
    for(i=0; i<m; i++)
    {
        int a, b;
        scanf("%d%d", &a, &b);
        V.push_back({b, a});
    }
    sort(V.begin(), V.end(), greater<pii>());

    int now=0;
    for(i=0; i<V.size(); i++)
    {
        int it=lower_bound(arr+1, arr+n+1, V[i].first)-arr-1;
        int nxt=max(now, min(now+V[i].second, it));
        ans+=(ll)(nxt-now)*V[i].first;
        now=nxt;
    }
    for(i=now+1; i<=n; i++) ans+=arr[i];
    printf("%lld", ans);
}


Measured memory_bytes: 1784
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication16
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string n = Console.ReadLine();

                if (n == "-")
                {
                    break;
                }

                string st = Console.ReadLine();
                int m = int.Parse(st);

                for (int i = 0; i < m; ++i)
                {
                    string str = Console.ReadLine();
                    int h = int.Parse(str);

                    string str1 = n.Substring(0, h);

                    string str2 = n.Substring(h);

                    n = str2 + str1;
                }

                Console.WriteLine(n);

              }
        }
    }
}

Measured memory_bytes: 5364
#include <bits/stdc++.h>
using namespace std;
using ll= long long ;
using P = pair<ll,ll>;
#define rep(i,n) for (ll i = 0; i<(ll)(n); i++)
#define mod 1000000007
#define pi 3.141592653589793
typedef vector<ll> vcl;

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a, ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t =rep_jijo(n,x/2);
        return t*t%mod;
  }
  return n*rep_jijo(n,x-1)%mod;
}
ll c2(ll n){
    return n*(n-1)/2;
}

int main() {
    ll x;
    cin>>x;
  for(ll i=-200;i<=200;i++){
      for(ll j=-200; j<=200;j++){
          if(i*i*i*i*i-j*j*j*j*j==x){
        cout<<i<<" "<<j<<endl;
        return 0;
          }
      }
  }
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define F            first
#define S            second
#define pb(x)        push_back(x)
#define mp(a,b)      make_pair(a,b)
#define mt(a,b,c)    make_tuple(a,b,c)
#define sz           size()
#define all(A)       A.begin(), A.end()
#define mem(a, b)    memset(a, b, sizeof(a))   // all elements of A are b=0 or b=-1 else don't work
#define f0(i,b)      for(ll i=0;i<(b);i++)
#define f1(i,b)      for(ll i=1;i<=(b);i++)
#define f2(i,a,b)    for(ll i=(a);i<=(b);i++)
#define f3(i,b,a)    for(ll i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(ll i=(a);i!=(b);i+=(c))

#define mod          10000007
#define PI           acos(-1.0)
#define MAX3(a,b,c)  max(a,max(b,c))

#define whilee(i,t)  while(i!=t)
#define  sl(a)       scanf("%lld",&a)
#define  pl(a)       printf("%lld\n",a)

//x = 1e18 means 10^18
//for(auto it =A.begin(); it!=A.end(); it++)
//sort(A.begin(),A.end()); //sort(A, +n, greater<int>());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end());
//cout << *min_element(A.begin(), A.end());
//count(A.begin(), A.end(), X); //counts the occurrences of X
//distance(A.begin(),A.end());  //distance between first to last element
//accumulate(A.begin(), A.end(), 0); //add
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());
//swap(S[0], T[0]);

//scanf("%lld",&x);
//printf("%lld\n",x);
//printf("%I64d\n", a);
//while (scanf("%lld %lld", &a, &b) == 2)
//printf("Case %lld: %lld\n", t++, a);

// int dx[] = {1,-1,0,0} , dy[] = {0,0,1,-1};  // 4 Direction
// int dx[] = {1,-1,0,0,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1,1,-1};  // 8 Direction
// int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1};  // Knight Direction
// int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1};  // Hexagonal Direction

//vector <ll> A;
//deque <ll> A;
//queue <ll> A;
//stack <ll> A;
//list <int> A;
//set <ll> A;
//map <ll,ll> A;
//unordered_map <ll, ll> A;
//pair <ll,ll> A ;
//tuple <ll, ll, ll> A;
//vector <pair <ll,ll>> A ;
//bitset<32> bset1;
//bool ok = true;
//char ch;
//string S, T, U;

ll i=0, j=0, k=0, a, b, c, d, e, f, g, h, l, m, n, o, p, q, r, s, t=1, u, v, w, x, y, z, maxx=INT_MIN, minn=INT_MAX, ans=0, sum=0, cnt=0;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);//NULL
    cout.tie(nullptr);//NULL

    cin>>n;
    ll A[n];
    f0(i,n)
    {
        cin>>A[i];
    }
    f0(i,n-1)
    {
        for(ll j=i+1; j<(n); j++)
        {
            ans+=(A[i]*A[j]);
        }
    }
    cout<<ans<<endl;
    return 0;
}


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


void solve(long long A, long long B){
    string number;
    long long count = 0;
    for(long long i = A; i <= B; ++i){
        number = to_string(i);
        if(number[0] == number[4] && number[1] == number[3]) count++;
    }
    cout << count << endl;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


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

typedef long long int lli;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<lli> vli;
typedef priority_queue <int, vector <int>, greater <int> > min_pq;

const int MOD	= 1e9 + 7;

#define fastio			ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define init(a)         memset(a,0,sizeof(a))    
#define pb              push_back  
#define all(a)          a.begin(),a.end()  
#define loop(i,n)       for(int i=0;i<n;i++)  
#define loops(i,s,n)    for(int i=s;i<n;i++)
#define rloop(i,n)      for(int i=n-1;i>=0;i--)
#define rloops(i,s,n)   for(int i=n-1;i>=s;i--)

template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template <typename T> T lcm(T a, T b){return (a*b)/gcd(a,b); }


double tick(){static clock_t oldt,newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt=newt;return diff;}
//---------------------------------------------------------------------------------------------


int main(){
    fastio;

    // #ifndef ONLINE_JUDGE
	// 	freopen("in.txt", "r", stdin);
	// #endif


    int n,k,q;
    cin>>n>>k>>q;
    int c[n];
    loop(i,n){
        c[i] = 0;
    }

    loop(i,q){
        int x;
        cin>>x;
        c[x-1]++;
    }
    loop(i,n){
        if(k - (q-c[i])> 0 ){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
    
    
    // cout<<"Execution time : "<<tick()<<"\n";

    return 0;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<String[]> list = new ArrayList<String[]>();
        while(true) {
          String line = sc.nextLine();
          String[] linesp = line.split(" ");
          
          if(linesp[0].equals("0") && linesp[1].equals("0")) {
              break;
          }
          list.add(linesp);
        }
        for(int i = 0; i < list.size(); i++) {
            int sum = 0;
            int n = Integer.parseInt(list.get(i)[0]);
            int x = Integer.parseInt(list.get(i)[1]);
            for(int j = 1; j <= n; j++) {
                for(int k = j; k <= n; k++) {
                    for(int l = k; l <= n; l++) {
                        if(j != k && j!= l && k != l) {
                            if(j + k + l == x) {
                                sum += 1;
                            }
                        }
                    }
                }
            }
            System.out.println(sum);
        }
  }
}


Measured memory_bytes: 26852
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF LLONG_MAX/10
#define rep(i,n) for(int i=0;i<n;i++)
#define krep(i,k,n,m) for(int i=k;i<n;i+=m)
#define erep(i,k,n) for(int i=k;i<n;i++)
#define mod 1000000007
//最大公約数
int gcd(int s,int b){
    if(b==0)return s;
    return gcd(b,s%b);
}
signed main(){
    int n,m;
    cin>>n>>m;
    int a[n],b[n];
    rep(i,n){
        cin>>a[i]>>b[i];
    }
    sort(b,b+n);
    reverse(b,b+n);
    sort(a,a+n);
    reverse(a,a+n);
    int itika=0,nino=0;
    rep(i,n){
        if(b[i]<a[0]){
            break;
        }
        itika+=b[i];
        nino++;
        
        if(itika>=m){
            cout<<nino<<endl;
            return 0;
        }
    }
    if((m-itika)%a[0]==0){
        cout<<(m-itika)/a[0]+nino<<endl;
    }
    else{
        cout<<(m-itika)/a[0]+nino+1<<endl;
    }
}



Measured memory_bytes: 1792
import sys

import numpy as np

input = sys.stdin.readline
N, weights = map(int, input().split())

# dp = [0] * (weights + 1)
dp = np.zeros(weights + 1, dtype=np.int64)

while N:
    w, v = map(int, input().split())
    np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])
    # for i in range(weights, -1, -1):
    #     if i - w >= 0:
    #         dp[i] = max(dp[i], dp[i - w] + v)
    # print(dp)
    N -= 1
print(dp[-1])

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

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max()/2;
const int MOD = 1e9+7;

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

    ll h,w;cin>>h>>w;
    int dx[9]={-2,-2,-2,0,0,0,-1,-1,-1},dy[9]={-2,0,-1,-2,0,-1,-2,0,-1};
    int n;cin>>n;
    map<P,int> mp;
    for(int i=0;i<n;i++){
        int a,b;cin>>a>>b;a--;b--;
        for(int j=0;j<9;j++){
            int nx=a+dx[j],ny=b+dy[j];
            if(nx<0 || h-2<=nx || ny<0 || w-2<=ny) continue;
            P p=P(nx,ny);
            mp[p]++;
        }
    }
    vector<ll> count(10);
    ll sum=0;
    for(auto itr=mp.begin();itr!=mp.end();itr++){
        auto p=*itr;
        int num=p.second;
        count[num]++;
        sum++;
    }
    cout<<(h-2)*(w-2)-sum<<endl;
    for(int i=1;i<=9;i++) cout<<count[i]<<endl;
}

Measured memory_bytes: 56576