akhauriyash/Code-Regression huggingface dataset:
public class Main {
  private static void solve() {
    int l = ni();
    int k = ni();
    
    //0:white 1:black
    long[][] dp = new long[l + k + 1][2];
    dp[0][0] = 1;
    
    for (int i = 0; i < l; i ++) {
      dp[i + k][1] += dp[i][0];
      dp[i + 1][1] += dp[i][0];
      dp[i + 1][0] += dp[i][1];
    }
    
    long sum = 0;
    for (int i = 0; i <= l; i ++) {
      sum += dp[i][1];
    }
    System.out.println(sum);
  }


  
  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}

Measured memory_bytes: 24576
#include <cstdio>
#include <utility>
#include <string>
using namespace std;

#define gcu getchar_unlocked
int in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
int in() {return in(gcu());}
bool scan(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
bool scan(char &c){c=gcu();gcu();return c!=EOF;}
//bool scan(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
template <typename head, typename... tail>
bool scan(head &h, tail&&... t){return scan(h) && scan(t...);}
#define pcu putchar_unlocked
#define vo inline void out
template <typename T>
vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
vo(const char *s){while(*s)pcu(*s++);}
vo(char c){pcu(c);}
vo(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail> vo(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T> vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef vo

int main() {
	for (int n; (n = in());) {
		int t[10] = {};
		while (n--)
			t[in()]++;
		for (int i: t)
			out(i ? string(i, '*') : "-",'\n');
	}
}


Measured memory_bytes: 2576
if __name__ == "__main__":
    x, n = map(int, input().split())
    p = list(map(int, input().split()))

    min_val = 0
    diff = abs(x-min_val)
    for i in range(1, 102):
        if diff > abs(x-i) and not(i in p):
            min_val = i
            diff = abs(x-min_val)
        elif diff < abs(x-i) and not(i in p):
            break

    print(min_val)

Measured memory_bytes: 9200
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    ll A[N + 1];
    REP(i, 0, N) {
        cin >> A[i];
    }
    A[N] = 0;
    bool all = false;
    ll B[N + 1];
    REP(i, 0, K) {
        fill(B, B + N + 1, 0);
        REP(j, 0, N) {
            B[max(j - A[j], 0LL)]++;
            B[min(j + A[j] + 1, N)]--;
        }
        REP(j, 1, N + 1) {
            B[j] += B[j - 1];
        }
        bool tmp = true;
        REP(j, 0, N) {
            if (B[j] != N) {
                tmp = false;
            }
        }
        if (tmp) {
            all = true;
            break;
        }
        REP(j, 0, N) {
            A[j] = B[j];
        }
    }
    if (all) {
        REP(i, 0, N) {
            cout << N << " ";
        }
        cout << endl;
    } else {
        REP(i, 0, N) {
            cout << A[i] << " ";
        }
        cout << endl;
    }
}


Measured memory_bytes: 6744
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new MyInputStream(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(MyInputStream cin)
        {
            var A = cin.ReadInt();
            var B = cin.ReadInt();
            var C = cin.ReadInt();
            var X = cin.ReadInt();
            var ans = 0;
            for (int i = 0; i <= A; ++i)
                for (int j = 0; j <= B; ++j)
                    for (int k = 0; k <= C; ++k)
                        if (500 * i + 100 * j + 50 * k == X)
                            ans++;
            WriteLine(ans);
        }
    }

    public class MyInputStream
    {
        private readonly System.IO.TextReader _stream;
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(System.IO.TextReader s, char separator = ' ')
        {
            this.separator = separator;
            this._stream = s;
            inputStream = new Queue<string>();
        }
        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
        public string ReadLine() { return _stream.ReadLine(); }
        public int ReadInt() { return int.Parse(Read()); }
        public long ReadLong() { return long.Parse(Read()); }
        public double ReadDouble() { return double.Parse(Read()); }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read(); return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt(); return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong(); return ret;}
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace std;
using pi = pair<int, int>;
 
int main() {
  int n; cin >> n;
  vector <int> as(n, 0);
  for (auto& a : as) cin >> a;
  sort(as.begin(), as.end());
  reverse(as.begin(), as.end());
  long long sum = as[0];
  if (n <= 1) { cout << 0 << endl; return 0; }
  if (n <= 2) { cout << sum << endl; return 0; }
  for (int i = 2; i < n; i++) {
    sum += as[i / 2];
  }
  cout << sum << endl;
}

Measured memory_bytes: 3988
#include <stdio.h>
#define inf 1000000007
typedef long long ll;
ll each(ll n, ll k){return (k*(n-k+1)+1)%inf;}
int main() {
	ll n,k,ans=0;
	scanf("%lld %lld",&n,&k);
	for(ll i=k;i<=n+1;i++){
		ans+=(each(n,i))%inf;
		ans=ans%inf;}

	printf("%lld",ans);
}

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

int main(){
  int N,count=0;
  cin >> N;
  
  for(int i=0;i<N;i++){
    int d1,d2;
    cin >> d1 >> d2;
    
    if(d1==d2) count++;
    else count = 0;
    
    if(count==3){
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

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

    int n;
    cin >> n;
    ll asum = 0, bsum = 0;
    ll minus = 0;
    vector<int> a(n), b(n);
    vector<int> plus;
    int ans = 0;
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n) {
        asum += a[i]; bsum += b[i];
        if (a[i] >= b[i]) plus.push_back(a[i] - b[i]);
        else minus += b[i] - a[i], ans++;
    }
    if (asum >= bsum) {
        sort(plus.begin(), plus.end());
        while (minus > 0) {
            ans++;
            minus -= plus.back();
            plus.pop_back();
        }
        cout << ans << endl;
    } else cout << -1 << endl;
    
}


Measured memory_bytes: 4580
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


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

  vector<vector<int>> A(N, vector<int>(3));
  REP(i, N){
    cin >> A[i][0] >> A[i][1] >> A[i][2];
  }


  int ans = 0;
  vector<vector<int>> vec(N, vector<int>(3));
  REP(bit, (1<<3)){
    REP(i, N) REP(j, 3){
      if((bit >> j)&1) vec[i][j] = A[i][j];
      else vec[i][j] = -A[i][j];
    }
    sort(ALL(vec), [](vector<int> const &l, vector<int> const &r){
        return (l[0]+l[1]+l[2]) > (r[0]+r[1]+r[2]);
        });

    int ret = 0;
    REP(i, M){
      ret += vec[i][0]+vec[i][1]+vec[i][2];
    }
    chmax(ans, ret);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;
#define all(x) (x).begin(),(x).end()

ll gcd(ll a,ll 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 fac(ll n){
    ll t = 1;
    rep1(i, n + 1)t *= i;
    return t;
}

int main()
{
    ll n,m,g;
    string s,t;
    cin >> n >> m >> s >> t;
    g = gcd(n,m);
    
    for(int i=0; i<n; i++){
        if(i * m % n == 0 && s[i] != t[i * m / n]){
            cout << "-1" << endl;
            return 0;
        }
    }
    
    cout << n * m / g << endl;
    return 0;
}


Measured memory_bytes: 512
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

char s[12];
int main()
{
  int ans = 0;
  scanf("%s", s);
  for (int i = 0; i < strlen(s); i++)
  {
    if (s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C')
    {
      int tmp = 0;
      for (int j = i; j < strlen(s); j++)
      {
        if (s[j] == 'A' || s[j] == 'T' || s[j] == 'G' || s[j] == 'C')
        {
          tmp++;
        }
        else
        {
          break;
        }
        ans = MAX(ans, tmp);
      }
    }
  }
  printf("%d\n", ans);
}

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

int main() {
	int n=0,m=0;
	cin>>n>>m;
	int total=0;
	if(m<2)
	{
		total+=0;
	}
	if(n<=0)
	total+=0;
	if(m>=2)
	total+=(m*(m-1))/2;
	if(n>=2)
	total+=(n*(n-1))/2;
	cout<<total<<"\n";
	return 0;
}

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

const int MAX = 2001;
const int MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  rep(i, MAX) {
    if (i==0||i==1) continue;
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}

// 二項係数計算
ll COM(int n, int k) {
  if (n<k) return 0;
  if (n<0||k<0) return 0;
  return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

int main() {
  int n,k;
  cin>>n>>k;

  COMinit();
  rep(i, k+1) {
    if (i==0)continue;
    if (i<=n-k+1) cout<<COM(n-k+1, i)*COM(k-1, i-1)%MOD<<endl;
    else cout<<0<<endl;
  }
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace MyProgram
{
    public class Program
    {	
        public static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            double[] input = Console.ReadLine().Split(' ').Select(s => double.Parse(s)).ToArray();
            double T = input[0];
            double A = input[1];
            
            double[] palace = new double[n];
            input = Console.ReadLine().Split(' ').Select(s => double.Parse(s)).ToArray();
            
            double min = 99999999;
            double index = 0;
            
            for(int i = 0 ; i < n ; i++)
            {
                palace[i] = T - input[i] * 0.006;
                double sa = Math.Abs(A - palace[i]);
                if(sa < min)
                {
                    min = sa;
                    index = i+1;
                }
                
            }

            Console.WriteLine(index);
            
        }
    }
}

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

const int MAXN = 302;

double dp[MAXN][MAXN][MAXN];
int N,vis[MAXN][MAXN][MAXN];

double solve(int x,int y,int z){
	
	if(vis[x][y][z]) return dp[x][y][z];
	//printf("Solving %d %d %d\n",x,y,z);
	vis[x][y][z] = 1;

	if(x == 0 && y == 0 && z == 0) return dp[x][y][z] = 0;

	int soma = x + y + z;
	double convertido = (double)soma;
	double tot = (N - soma)/convertido;
	
	//printf("Tot antes %d %d %d %d %lf\n",N - soma,x,y,z,tot);

	if(x != 0) tot += x*((solve(x-1,y,z) + 1)/convertido);
	if(y != 0) tot += y*((solve(x+1,y-1,z) + 1)/convertido);
	if(z != 0) tot += z*((solve(x,y+1,z-1) + 1)/convertido);

	//printf("Tot (%d,%d,%d) = %lf\n",x,y,z,tot);

	return dp[x][y][z] = tot;

}

int main(){

	int a[4] = {0,0,0,0};

	cin >> N;

	for(int i = 1;i<=N;i++){
		int x;
		cin >> x;
		a[x]++;
	}

	printf("%.9lf\n",solve(a[1],a[2],a[3]));

	return 0;
}

Measured memory_bytes: 321920
#include <stdio.h>
#define MAX 100

typedef struct{
  int A[MAX];
  int chenge;
}data;

void BubbleSort(data *,int);

int main(void){

  int i,len;
  data a;

  scanf("%d",&len);

  for(i=0;i<len;i++)
    scanf("%d",&a.A[i]);

  BubbleSort(&a,len);

  for(i=1;i<len;i++)
    printf("%d ",a.A[i-1]);
  printf("%d\n",a.A[i-1]);

  printf("%d\n",a.chenge);
  return 0;
}


void BubbleSort(data *p,int len){
  
  int i,j,key;
  
  p->chenge=0;
  
  for(j=1;j<len;j++){
    key = p->A[j];
    i = j - 1;
    while(i >= 0 && p->A[i] > key){
      p->A[i+1] = p->A[i];
      i = i - 1;
      p->A[i+1] = key;
      p->chenge++;
    }
  }
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
int mod = 998244353;
// int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(11);
  int T;
  T = 1;
  while (T--) solve();
}

void solve() {
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  cin >> a;

  vector<vector<ll> > dp(n + 1, vector<ll>(s + 1));
  dp[0][0] = 1;
  rep(i, n) rep(j, s + 1) {
    add(dp[i + 1][j], dp[i][j] * 2 + (j - a[i] >= 0 ? dp[i][j - a[i]] : 0));
  }
  cout << dp[n][s] << endl;
}


Measured memory_bytes: 73688
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)

int b,r,g,c,s,t;

int main(){
	while(cin>>b>>r>>g>>c>>s>>t&&t){
		cout<<100+b*95+r*63+g*7+c*2+s*3-t*3<<endl;
	}
}

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

using namespace std;

bool calc(char a)
{
	if(a == 'A')
      return true;
  	if(a == 'G')
      return true;
	if(a == 'C')
      return true;
  	if(a == 'T')
      return true;
  	
  	return false;
}

int main()
{
	string str;
  	cin >> str;
  
  	int i;
  
  	int max,now;
  	max = 0;
  	now = 0;
  
  	for(i=0;i<str.length();i++)
    {
    	if(calc(str[i]))
        {
        	now++;
        }
      	else
      	{
      		if(now > max)
            	max = now;
      	
        	now = 0;
        }
    }

  	if(now > max)
    	max = now;
  	printf("%d",max);
  	
  	return 0;
}


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

bool func(char c){
  if(c >= '0' && c <= '9')
    return true;
  else
    return false;
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int a,b;
  cin >> a >> b;
  string s;
  cin >> s;
  rep(i, a){
    if(func(s[i]) == false){
      cout << "No" << endl;
      return 0;
    }
  }
  if(s[a] != '-') {
    cout << "No" << endl;
    return 0;
  }
  for(int i=b+1; i<s.length();i++){
     if(func(s[i]) == false){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int A[3][1003];
int f[3][1003];
bool vis[3][1003];

inline int DP(int i,int j)
{
	if(i<=0||j<=0) return 0; 
	if(vis[i][j]) return f[i][j];
	f[i][j]+=max(DP(i,j-1),DP(i-1,j));
	vis[i][j]=1;
	return f[i][j];
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=2;i++)
	for(int j=1;j<=n;j++)
	scanf("%d",&A[i][j]);
	vis[1][1]=1;
	
	for(int i=1;i<=2;i++)
	for(int j=1;j<=n;j++)
	f[i][j]=A[i][j];
	
	printf("%d",DP(2,n));
	return 0; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define gt(n) scanf("%d", &n)
#define gtll(n) scanf("%ld", &n)
#define out(n) printf("%d", n)
#define outll(n) printf("%ld", n)
#define loop(n) for(int i=0; i<n; i++)
#define MAXX 1001
#define mem(x, y) memset(x, y, sizeof(x))
#define loop1(n) for(int i=1; i<=n; i++)
#define ll long long
#define pb push_back
#define pi acos(-1)
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
//(only in c)char[33];itoa(n,buffer,base);printf("%s",buffer);
#define dec_to_bin(n) std::string binary = std::bitset<64>(n).to_string();
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
int main()
{
    fast;
    ll n;
    cin>>n;
    ll a[n+7];
    ll sum=0,sum1=0,sum2=0;
    ll mn=10000000000;
    ll c=0;
    for(ll i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]<0)c++;
        mn=min(abs(a[i]),mn);
        sum+=abs(a[i]);
    }
   cout<<sum-mn*2*(c%2)<<endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n; cin >> n;
    deque<int> neg, pos;
    FOR(i, 0, n) {
        int a; cin >> a;
        if (a < 0)neg.push_back(a);
        else pos.push_back(a);
    }

    rSORT(neg, greater<int>());
    SORT(pos);
    if (neg.empty()) {
        neg.push_front(pos[0]);
        pos.pop_front();
    }
    else if (pos.empty()) {
        pos.push_front(neg[0]);
        neg.pop_front();
    }

    int a = neg[0], b = pos[0];
    VI x, y;
    FOR(i, 1, pos.size()) {
        x.push_back(a);
        y.push_back(pos[i]);
        a -= pos[i];
    }
    FOR(i, 1, neg.size()) {
        x.push_back(b);
        y.push_back(neg[i]);
        b -= neg[i];
    }
    x.push_back(b);
    y.push_back(a);
    b -= a;
    cout << b << "\n";
    FOR(i, 0, x.size())cout << x[i] << " " << y[i] << "\n";
}


Measured memory_bytes: 3316
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.NoSuchElementException;
public class Main {
	public static void main(String[] args)throws Exception{
		PrintWriter out = new PrintWriter(System.out);
		int N=nextInt();
		int x[]=new int[N];
		int y[]=new int[N];
		int k[]=new int[N];
		int f[]=new int[N];
		boolean visit[]=new boolean[N];
		double ans=0;
		for(int i=0;i<N;i++){
			x[i]=nextInt();
			y[i]=nextInt();
			if(i==0)f[i]=1;
			else f[i]=f[i-1]*(i+1);
		}k[0]=-1;
		for(int i=0;i<f[N-1];i++){
			boolean lis=false;
			for(int j=0;j<N;j++){
				int z=0;
				if(j!=N-1&&lis==false&&i%f[N-2-j]==0){
					lis=true;z=k[j]+1;k[j]++;
				}
				if(lis||j==N-1)
					for(int l=z;l<N;l++){
						if(visit[l]==false){
							k[j]=l;break;
						}
					}
				if(k[j]<N)
					visit[k[j]]=true;
			}
			visit=new boolean[N];
			for(int j=0;j<N-1;j++){
				double a=Math.pow(x[k[j]]-x[k[j+1]],2);
				double b=Math.pow(y[k[j]]-y[k[j+1]],2);
				ans+=Math.sqrt(a+b);
			}
		}
		System.out.println(ans/f[N-1]);
	}
	static boolean isOK(int index,int key,ArrayList<Integer>a){
		if (a.get(index) >= key) return true;
	    else return false;
	}
	static int binary_search(int key,ArrayList<Integer> a) {
	    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	    int ok = (int)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	    while (Math.abs(ok - ng) > 1) {
	        int mid = (ok + ng) / 2;

	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    }
	    return ok;
	}
	//FastScanner
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	}
}



Measured memory_bytes: 36356
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
int main() {
	ll n,k;
	cin>>n>>k;
	vector<ll>a;
	for(ll i=0;i<n;i++){
		ll x;
		cin>>x;
		a.push_back(x);
	}
	sort(a.begin(),a.end());
	if(k>=n){
		cout <<0;
		return 0;
	}
	ll ans=0;
	for(ll i=0;i<n-k;i++ ){
		ans+=a[i];
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 2420
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>

using namespace std;

long long int n, t, sum;
vector<int> v;

int main(){
	cin >> n;
	while (cin >> t) v.push_back(t);
	sort(v.begin(), v.end());
	for (int i = 0; i < n; i++) sum += v[i];
	cout << v[0] << " " << v[n - 1] << " " << sum << endl; //accumulate(v.begin(), v.end(), 0)
}

Measured memory_bytes: 1328
#include <iostream>
#include <cmath>

using namespace std;
int main(){
  int h,n;
  string s;
  cin >> h >> n;
  int a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
	}
  for(int i=0;i<n;i++){
    h=h-a[i];
  }
  if(h<=0){
    s = "Yes";
  }
  else{
    s = "No";
  }
  cout << s << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define pi acos(-1)
#define lli long long int
using namespace std;

int main()
{
    FIO
    lli a,b,k;
    cin >> a >> b >> k;
    if(a <= k) {
        k -= a;
        a = 0;
        // cout << k << ' ';
        if(b < k) b = 0; 
        else b -= k;
        // cout << a << ' ' << b <<" "<< k << endl;
    } 
    else 
        a = a-k;

    cout << a <<" "<< b << endl;
    
    return 0;
}
    

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
//imit
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<int> L(n);
    for(int i = 0;i < n;i++){
        cin >> L[i];
    }
    sort(L.begin(),L.end());//昇順にソート
    int ans = 0;
    for(int a = 0;a < n - 1;a++){
        for(int b = a + 1;b < n;b++){
            int ab = L[a] + L[b];//AとBの和
            int r = lower_bound(L.begin(),L.end(),ab) - L.begin();//C < A + B となりうるCの最大値の位置
            int l = b + 1;//最小値
            ans += max(0,r - l);
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = Integer.parseInt(sc.next());
        int cnt = 0;
        int ans = 0;
        for(int i = 1; i<=x; i++) {
            cnt += i;
            if(cnt >= x) {
                ans = i;
                break;
            }
        }
        System.out.println(ans);

    }
}

Measured memory_bytes: 25300
N, K = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
        .group_by { |x| x }
        .map { |k, v| v.size }
        .sort { |a, b| b <=> a }

if a.size <= K
  puts 0
else
  puts a[K..-1].inject(0, &:+)
end


Measured memory_bytes: 46832
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

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

        Map<String, Integer> A = new HashMap<>();
        for (char i = 'a'; i <= 'z'; i++) {
            A.put(String.valueOf(i), 0);
        }


        while (sc.hasNext()) {
            String S = sc.nextLine();
            for (String s : S.split("")) {
                if (Character.isLetter(s.charAt(0))) {
                    A.put(String.valueOf(Character.toLowerCase(s.charAt(0))), A.get(String.valueOf(Character.toLowerCase(s.charAt(0)))) + 1);
                }
            }
        }

        A.forEach((s, integer) -> System.out.printf("%s : %d\n", s, integer));
    }
}

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

#define mp make_pair
#define pb push_back

using namespace std;

typedef int32_t i32;
typedef uint32_t u32;
typedef int64_t i64;
typedef uint64_t u64;
typedef pair<int,int> pii;
typedef vector<int> vi;

const int MAX_N = 100000;
int n,l,t;
vector<int> lx,rx;
int pos[MAX_N];

int main()
{
  cin >> n >> l >> t;
  int x,w;
  for (int i = 0; i < n; i++) {
    cin >> x >> w;
    if (w == 1) {
      rx.pb(x);
    } else {
      lx.pb(x);
    }
  }

  i64 d = (t / l * (lx.size() - rx.size() + n)) % n;
  t = t % l;

  //printf("t=%d l=%d\n", t, l);
  i64 lc = 0;
  for (int v : lx) {
    if (v < t) lc++;
  }

  i64 rc = 0;
  for (int v : rx) {
    if (v >= l - t) rc++;
  }

  i64 first = (d + lc - rc + n) % n;

  vector<int> last_pos;
  for (int x : rx) {
    last_pos.pb((x+t)%l);
  }
  for (int x : lx) {
    last_pos.pb((x-t+l)%l);
  }

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

  for (int i = 0; i < n; i++) {
    pos[(first+n)%n] = last_pos[i];
    first++;
  }

  for (int i = 0; i < n; i++) {
    cout << pos[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 2504
#include<bits/stdc++.h>
using namespace std;
const int lg = 14;
int main(){
	long long a, b, c, ans;
	cin >> a >> b;
	c = b - a + 1;
	if(a % 2 == 0){
		if(c % 2 == 0)
			return cout << (c / 2) % 2 , 0;
		else{
			long long ans = b ^ ((c / 2) % 2);
			return cout << ans, 0;
		}
	}
	else
		if(c % 2 == 1){
			long long ans =  a ^ ((c / 2) % 2);
			return cout << ans, 0;
		}
		else{
			long long ans = a ^ b ^ (((c - 2) / 2) % 2);
			return cout << ans, 0;
		}
	cout << ans;
}

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

int N;

int a[450][450];

int main() {
	
	int v = 0;
	for(int i=0;i<450;++i) {
		for(int j=0;j<=i;++j) {
			a[i][j] = ++v;
		}
	}
	
	cin>>N;
	
	int k = 1;
	while(k*(k-1)/2<N)++k;
	
	if(k*(k-1)/2==N) {
		cout << "Yes" << endl;
		cout << k << endl;
		for(int i=0;i<k-1;++i){
			cout << k-1;
			for(int j=0;j<=i;++j)cout << ' ' << a[i][j];
			for(int j=i+1;j<k-1;++j)cout << ' ' << a[j][i];
			cout << endl;
		}
		cout << k-1;
		for(int i=0;i<k-1;++i)cout << ' ' << a[i][i];
		cout << endl;
	}else {
		cout << "No" <<endl;
	}
	
	return 0;
}

Measured memory_bytes: 2176
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	vector< int > A(N);
	rep(i, N) cin >> A[i];
	vector< int > S(N + 1, 0);
	rep(i, N) S[i + 1] = S[i] + A[i];
	vector< vector< int > > dp(N + 1, vector< int >(N + 1, LINF));
	rep(i, N) dp[i][i + 1] = 0;
	for (int d = 2; d <= N; d++)
		for (int l = 0; l + d <= N; l++)
			for (int m = l + 1; m < l + d; m++) {
				int r = l + d;
				chmin(dp[l][r], dp[l][m] + dp[m][r] + S[r] - S[l]);
			}
	//cout << dp;
	cout << dp[0][N] << endl;
	return 0;
}

Measured memory_bytes: 1536
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
print("Yes" if N == M else "No")

Measured memory_bytes: 5140
import sys

ERROR_INPUT = 'input is invalid'
ERROR_INPUT_NOT_UNIQUE = 'input is not unique'


def main():
    S = get_input1()
    T = get_input2()

    count = 0
    for t in T:
        for s in S:
            if t == s:
                count += 1
                break

    print(count)


def get_input1():
    n = int(input())
    if n > 10000:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        li.append(x)

    return li


def get_input2():
    n = int(input())
    if n > 500:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        elif int(x) in li:
            print(ERROR_INPUT_NOT_UNIQUE)
            sys.exit(1)
        li.append(x)

    return li


main()

Measured memory_bytes: 6240
#include <iostream>
#include <map>
#include <string>

using namespace std;

int main() {
    map<string, int> M;
    int n, m;
    cin >> n;
    string s;
    for (int i = 0; i < n; i++) {
        cin >> s;
        M[s]++;
    }

    int ans = 0;
    cin >> m;
    for (int i = 0; i < m; i++) {
        cin >> s;
        if (M[s] > 0) 
            M[s]--;
    }

    map<string, int>::iterator ite;
    for (ite = M.begin(); ite != M.end(); ite++) 
        ans = max(ans, ite->second);
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    int arr[n];
    for(int i = 0; i < n; i ++)
        cin >> arr[i];
    
    int steps = ceil(1+((float)(n-k)/(k-1)));
    
    cout << steps;
	return 0;
}

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

int main(void)
{
    using namespace std;
    int n, x, res;

    while (true) {
        scanf("%d %d", &n, &x);
        if (n == 0 && x == 0) {
            break;
        }
        res = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = i + 1; j <= n; j++) {
                for (int k = j + 1; k <= n; k++) {
                    if (i != j && i != k && j != k && i + j + k == x) {
                        res++;
                    }
                }
            }
        }
        printf("%d\n", res);
    }
}


Measured memory_bytes: 3200
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] NMXY = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long[] x = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long[] y = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            String result = "War";

            int Xmax = (int)x.Max();
            int Ymin = (int)y.Min();
            if (Xmax < Ymin)
            {
                for (int Z = (int)NMXY[2] + 1; Z <= (int)NMXY[3]; Z++)
                {
                    if (Xmax < Z && Z <= Ymin)
                    {
                        result = "No War";
                        break;
                    }
                }
            }
            
            ////X < Z <= Y
            //if(NMXY[2] < y.Min() && y.Min() <= NMXY[3])
            //{
            //    //x < z <= y
            //    if (x.Max() < y.Min())
            //    {
            //        result = "No War";
            //    }
            //}
            Console.WriteLine(result);
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


Measured memory_bytes: 28240
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		for(; sc.hasNext();){
			long a=sc.nextLong();
			long b=sc.nextLong();
			long n=sc.nextLong();
			long ans=0;
			for(int i=0; i<n; i++){
				a=(a*10)%(b*10);
				ans+=a/b;
			}
			println(ans+"");
		}
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 12000
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>

#include <climits>
#include <cmath>
#include <cstring>

#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;

int main()
{
	FAST;
	ll n,m;
	cin >> n >> m;
	
	ull ans = 0;
	ll temp = min(n , m/2);
	ans += temp;
	n -= temp;
	m -= (2*temp);
	
	
	ans += (m/4);

	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
	
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
    }
    
    ll sum=0;
    for(ll i=1;i<n;i++)
    {
        if(a[i]<a[i-1])
        {
            sum+=(a[i-1]-a[i]);
            a[i]=a[i-1];
        }
    }
    cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 5200
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int ask(int a,int b,int p)
{
	if(a<b)return !ask(b,a,a+b-p+1);
	int k=(a-1)/(b+1)+1;
	int c=a/k;
	b-=c,a%=k;
	if((a&&b<=k)||(a==0&&b<k))
	{
		if(p<=(k+1)*c)return p%(k+1)==0;
		p-=(k+1)*c;
		return p>a;
	}
	int x;
	if(k*(a+1)-1>=b)x=0;
	else x=(int)((b-k*a-k)/(1ll*k*k-1)+1);
	c-=x;
	a+=x*k,b+=x;
	int cc=b/k;
	a-=cc,b%=k;
	if(p<=(k+1)*c)return p%(k+1)==0;
	p-=(k+1)*c;
	if(p<=a+b)return p>a;
	p-=a+b;
	return p%(k+1)!=1;
}
int q;
int main()
{
	scanf("%d",&q);
	while(q--)
	{
		int a,b,c,d;
		scanf("%d%d%d%d",&a,&b,&c,&d);
		for(int i=c;i<=d;i++)putchar('A'+ask(a,b,i));
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 256
def a_anti_adjacency(N, K):
    if N % 2 == 0:
        ans = 'YES' if N // 2 >= K else 'NO'
    else:
        ans = 'YES' if (1 + N // 2) >= K else 'NO'
    return ans

N, K = [int(i) for i in input().split()]
print(a_anti_adjacency(N, K))

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

/* ????????????????????£?¨?*/
//?????????????´???????????????????
void trace(int A[], int N);

//?????\?????????
void inserctionSort(int A[], int N);

int main(){

	int N, i;
	int A[100];

	cin >> N;

	for (i = 0; i < N; i++) cin >> A[i];

	trace(A, N);
	inserctionSort(A, N);

}

//?????????????´???????????????????
void trace(int A[], int N){
	
	int i;

	for (i = 0; i < N; i++){
		if (i > 0) cout << ' ';
		cout << A[i];
	}
		
	cout << endl;


}

//?????\?????????
void inserctionSort(int A[], int N){

	int i, j, v;

	for (i = 1; i < N; i++){
		v = A[i];
		j = i - 1;
		while (j >= 0 && A[j] > v){
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
		trace(A, N);
	}
}

Measured memory_bytes: 1160