akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
 
using namespace std;
 
int main(){
    int A, B, K, i;
    cin >> A >> B >> K;
    for(i=1; i<=K; i++){
        if(i%2==1){
            if(A%2==1) A -= 1;
            B += A/2;
            A -= A/2;
        }
        else{
            if(B%2==1) B -= 1;
            A += B/2;
            B -= B/2;
        }
    }
    cout << A << " " << B << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <ctime>

#define inf 0x3f3f3f3f
#define Inf 0x3FFFFFFFFFFFFFFFLL
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Rep(i, n) for (int i = 1; i <= (n); ++i)
#define clr(x, a) memset(x, (a), sizeof x)
using namespace std;
typedef long long ll;
int const N = 1002020;
ll const mod = 998244353;
struct Node {
  int x, d;
  friend bool operator<(Node a, Node b) {
    return a.x < b.x;
  }
} p[N];

int xp[N];
int find(int l, int r, int x){
    int mid;
    while(l <= r){
        mid = (l + r) >> 1;
        if(xp[mid] < x) l = mid + 1;
        else r = mid - 1;
    }
    return r;
}

ll f[N];
int tree[N];
void update(int l, int r, int x, int y, int pp) {
  if (l == r) {
    //printf("%d -> %d\n",pp,y);
    tree[pp] = y; return;
  }
  int mid = (l + r) / 2, lp = pp * 2, rp = pp * 2 + 1;
  if (x <= mid) update(l, mid, x, y, lp);
  else update(mid+1, r, x, y, rp);
  tree[pp] = max(tree[lp], tree[rp]);
}
int query(int l, int r, int a, int b, int pp) {
  //printf("qry(%d,%d,%d)\n",l,r,pp);
  if(l == a && r == b) {
    return tree[pp];
  }
  int mid = (l + r) / 2, lp = pp * 2, rp = pp * 2 + 1;
  if (b <= mid) return query(l, mid, a, b, lp);
  else if (a > mid) return query(mid+1, r, a, b, rp);
  else {
    return max(query(l, mid, a, mid, lp), query(mid+1, r, mid+1, b, rp));
  }  
}
int main() {
  int n; scanf("%d", &n);
  Rep(i, n) {
    scanf("%d%d", &p[i].x, &p[i].d);
  }  
  sort(p + 1, p + n + 1);
  Rep(i, n) xp[i] = p[i].x;
  f[n + 1] = 1;
  for (int i = n; i >= 1; --i) {
    int pos = find(i, n, p[i].x + p[i].d);
    if (pos >= n) pos = n;
    update(1, n, i, pos, 1);
    f[i] = f[i + 1];
    int qry = query(1, n, i, pos, 1);
    update(1, n, i, qry, 1);
    //cout<<pos<<endl;
    f[i] += f[qry + 1];
    f[i] %= mod;

  } 
  cout << f[1] << endl;
  return 0;
}



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

int main() {
  int P, Q, R;
  cin >> P >> Q >> R;
  
  int A, B, C;
  A = P + Q;
  B = Q + R;
  C = R + P;
  int ans = 0;
  if(A < B){
    if(A < C){
      ans = A;
    } else {
      ans = C;
    }
  } else {
    if(B < C){
      ans = B;
    } else {
      ans = C;
    }
  }
  cout << ans << endl;
}




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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl ;
#define Yes cout << "Yes" << endl ;
#define NO cout << "NO" << endl ;
#define No cout << "No" << endl ;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main ()
{
    fastio

    lli x , y ;

    cin >> x >> y ;

    cout << x + (y / 2) << endl ;

    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



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

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; ++i) {
        cin >> p.at(i);
    }

    int count = 0;
    for (int i = 1; i < n-1; ++i) {
        if(p.at(i-1)< p.at(i) && p.at(i) < p.at(i+1) || p.at(i-1) > p.at(i) && p.at(i) > p.at(i+1)) count++;
    }

    cout << count;

    return 0;
}

Measured memory_bytes: 256
using System;

namespace Sample101
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string result = s[0].ToString();
            result = result + (s.Length - 2).ToString() + s[s.Length - 1];
            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n,l[2002];
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>l[i];
	sort(l,l+n);
	int ans=0;
	for(int i=n-1;i>1;i--)
	{
		for(int j=i-1;j>0;j--)
		{
			int mmin=l[i]-l[j];
			for(int k=j-1;k>=0;k--)
			{
				if(l[k]<=mmin)
					break;
				else ans++;
			}
		}
	}
	cout<<ans<<endl;
}

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

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
  cout << endl;
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   " << endl;
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}
 
int main(){
	int N, P;
	cin >> N >> P;
	string S;
	cin >> S;
	//reverse(S.begin(), S.end());//*pow(10, i)したときにiがindexと一致するようにする
  //↑なんかここでreverseしたら P==2 || P==5 のときに違う答えが出てしまう
	if(P==2 || P==5){
		ll ans = 0;
		for(int i=0; i<N; i++){
			if((S[i]-'0')%P !=0) continue;
			ans += i+1;
		}
		cout << ans << endl;
		return 0;
	}

	reverse(S.begin(), S.end());//*pow(10, i)したときにiがindexと一致するようにする


	int wa = 0;//累積和
	int pow_10_i = 1;// pow(10, i)%P
	map<int, int> mp;
	ll ans = 0;
	for(int i=0; i<N; i++){
		mp[wa]++;
		wa += (S[i]-'0')*pow_10_i;
		wa %= P;
		ans += mp[wa];
		pow_10_i = pow_10_i * 10 % P;
	}


	cout << ans << endl;


}


Measured memory_bytes: 3992
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

using ll = long long;
using P = pair<int, int>;

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

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  ll N;
  cin >> N;
  ll a[N];
  for (int i = 0; i < N; i++) scanf("%lld", a + i);

  ll total = N * (N + 1) / 2;
  ll sum = 0;
  for (int i = 0; i < N; i++) sum += a[i];

  string ans = "NO";
  if (sum % total == 0) {
    ll k = sum / total; // 操作を行う回数
    ll d[N];
    d[0] = (a[0] - a[N-1]) - k;
    for (int i = 1; i < N; i++) {
      d[i] = (a[i] - a[i-1]) - k;
    }

    sum = 0;
    for (int i = 0; i < N; i++) {
      sum += d[i];
    }
    if (-sum == k * N) {
      bool flag = true;
      for (int i = 0; i < N; i++) if (d[i] > 0 || -d[i] % N != 0) {
        flag = false;
      }
      if (flag) ans = "YES";
    }
  }

  // 解答
  cout << ans << endl;

  return 0;
}


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

int main() {
    int N,M;
    cin>>N>>M;
    priority_queue<int> que;

    rep(i,N){
        int a;
        cin>>a;
        que.push(a);
    }

    rep(i,M){
        int b=que.top()/2;
        que.pop();
        que.push(b);
    }
    
    ll ans=0;
    rep(i,N){
       ans+=que.top(); 
       que.pop();
    }

    cout<<ans;

}


Measured memory_bytes: 892
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

int main(){
    int n;
    cin>>n;
    int a[n];
    int ocnt=0,fcnt=0,tcnt=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]%2!=0)ocnt++;
        if(a[i]%4==2)tcnt++;
        if(a[i]%4==0)fcnt++;
    }
    if(tcnt==0&&ocnt<=fcnt+1)cout<<"Yes"<<endl;
    else if(tcnt!=0&&ocnt<=fcnt)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3972
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <bitset>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using lint = long long;
using namespace std;

const int MOD = 1000000007;

int main() {
    int N;
    cin >> N;
    int A[30], B[30], C[30];
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    rep(i, N-1) cin >> C[i];

    int eat[30];

    int res = 0;

    for (int i = 0; i < N; i++) {
        res += B[A[i]-1];
        eat[i] = A[i];
        if (i > 0 && eat[i-1]+1 == A[i]) {
            res += C[eat[i-1]-1];
        }
    }

    cout << res << endl;
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i % 3!=0 && i % 5 != 0) ans += i;
  }

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


Measured memory_bytes: 3628
from collections import deque
s=list(input())
d=deque(s)
q=int(input())
ct=0
for i in range(q):
  l=list(input().split())
  if l[0]=='1':
    ct+=1
  else:
    if ct%2==0:
      if l[1]=='1':
        d.appendleft(l[2])
      else:
        d.append(l[2])
    else:
      if l[1]=='2':
        d.appendleft(l[2])
      else:
        d.append(l[2])
d=list(d)
if ct%2==1:
  d.reverse()
print(''.join(d))

Measured memory_bytes: 73464
//16-4
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)

int gcd(int a, int b){
    if(b > a) swap(a,b);
    if(a%b == 0) return b;
    return gcd(b,a%b);
}

int main(){
    int W,H,C;
    cin >> W >> H >> C;
    int tmp = gcd(W,H);
    cout << W/tmp * H/tmp * C << endl;
    return 0;
}



Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+5;
long long tt(long long n){
	long long sum=0;
	if(n==1)
	return 1;

	sum+=1;
	sum+=2*tt(n/2);

	return sum;
}
int main(){
	long long n;
	cin>>n;
	cout<<tt(n);
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
x, k, d = gets.split.map(&:to_i)
ans = 0

x = x.abs
if x > (k * d)
    ans = x - (k * d)
else
    num = x / d
    if (k - num) % 2 == 0
        ans = x - (d * (x / d))
    else
        ans = x - (d * ((x / d) + 1))
    end
end

puts ans.abs


Measured memory_bytes: 14384
N = int(input())
D = [list(map(int,input().split())) for _ in range(N)]

cnt,cnt_max = 0,0
for i in range(N):
    if D[i][0] == D[i][1]:
        cnt += 1
    else:
        cnt = 0
    cnt_max = max(cnt,cnt_max)

if cnt_max >= 3:
    print("Yes")
else:
    print("No")


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef long long ll;
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = 10e15;
const ll MINF = -10e10;
const int INF = INT_MAX / 100;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("~/Downloads/02.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;
const int mod = 1000000007;
const double PI = 3.14159265358979323846;

string to_upper(string str) {
    int diff = 'a' - 'A';
    for (int i = 0; i < str.size(); i++) {
        char c = str[i];
        if ('A' <= c && c <= 'Z') {
            c += diff;
            str[i] = c;
        }
    }
    return str;
}

int main() {

    double a, b, deg;
    cin >> a >> b >> deg;

    double rad = deg * (PI / 180);

    double cc = (b * b) + (a * a) - 2 * a * b * cos(rad);

    double c = sqrt(cc);

    double l = a + b + c;

    double ms = (a + b + c) / 2;
    double s = sqrt(ms * (ms - a) * (ms - b) * (ms - c));

    printf("%.20f %.20f %.20f\n", s, l, s * 2 / a);


}



Measured memory_bytes: 3360
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;


int main(void){
  int n,i;
  string s,t;
  
  cin >> n >> s >> t;
  
  for (i=0;i<n;i++) cout << s[i] << t[i];
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val n = nextInt()

    for (i in n downTo 1) {
        val tmp = Math.sqrt(i.toDouble()).toInt()

        if (tmp * tmp == i) {
            println(i)
            return
        }
    }
}

fun next() = readLine()!!
fun nextInt() = next().toInt()

fun println(value : Any) {
    pw.println(value)
}

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

int compare(const void *a, const void *b)
{
    return (*(int*)a - *(int*)b);
}

int main(void)
{
	int i, h[10];
	
	for (i = 0; i < 10; i++){
		scanf("%d", &h[i]);
	}
	
	qsort(h, 10, sizeof(int), compare);
	
	for (i = 10 - 1; 6 < i; i--){
		printf("%d\n", h[i]);
	}
	
	return (0);
}

Measured memory_bytes: 604
/***
بسم الله الرحمن الرحيم
اللهم ما صلّ على سيدنا محمد
اذكر الله
واتقوا يوما ترجعون فيه إلى الله ثم توفى كل نفس ما كسبت وهم لا يظلمون
****/

#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define shalaby ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);cerr.tie(0);

using namespace std;

inline int D()
{
    int t;
    scanf("%d",&t);
    return t;
}
inline ll llD()
{
    ll t;
    scanf("%lld",&t);
    return t;
}

const ll OO=-1e18;
int xt[4]= {1,0,0,-1};
int yt[4]= {0,1,-1,0};
////////////////////////////////////////////////////////////////////////////////////

const int N = 1e6+1;



ll mem[1005][1005],n,m,mod=1e9+7;
bool valid(int x,int y)
{
    return x>-1 && y>-1 && x<n && y<m;
}
void init()
{
    memset(mem,-1,sizeof mem);
}
char grid[1009][1009];
ll solve(int i=0,int j=0)
{
  ///  cout<<i<<" "<<j<<endl;
    if(!valid(i,j)|| grid[i][j]=='#')
        return 0;
    if(i==n-1 && j==m-1 && grid[i][j]=='.')
    {
    return 1;
    }
    ll &ret=mem[i][j];
    if(~ret)return ret%mod;

   ret=((solve(i+1,j)%mod)+(solve(i,j+1)%mod))%mod;
   return ret%mod;
}
int main()
{
int T=1;
///T=D();

while(T-->0)
{
    init();
cin>>n>>m;
for(int i=0;i<n;i++)
    for(int j=0;j<m;j++)
    cin>>grid[i][j];
cout<<solve();

}

}


Measured memory_bytes: 12580
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> D(N);
  for (int i=0; i<N; i++){
    cin >> D.at(i);
  }
  int count = 0;
  for(int i=0; i<N; i++){
    if(D.at(i)%2==1){
      count++;
    }
    else if(D.at(i)%2 == 0){
      if((D.at(i)%3 ==0)||(D.at(i)%5==0)){
        count++;
      }
    }
  }
  if (count == N){
    cout << "APPROVED" << endl;
  }
  else{
    cout << "DENIED" << endl;
  }
}
#include <bits/stdc++.h>
using namespace std;

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const ll Mod = 998244353;
const int Maxn = 3e2 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 21;

ll dp[Maxn][Maxn * Maxn];
ll dp2[Maxn][Maxn * Maxn];
ll pw[Maxn];
ll a[Maxn];

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	pw[0] = 1;
	for(int i = 1; i < Maxn; i++) pw[i] = (pw[i - 1] * 3) % Mod;
	ll n;
	cin >> n;
	ll s = 0;
	for(int i = 1; i <= n; i++) cin >> a[i], s += a[i];
	dp[0][0] = 1;
	for(int i = 1; i <= n; i++){
		for(int j = 0; j < Maxn * Maxn; j++){
			dp[i][j] = 2 * dp[i - 1][j] + (j >= a[i] ? dp[i - 1][j - a[i]] : 0);
			dp[i][j] %= Mod;
		}
	}
	dp2[0][0] = 1;
	for(int i = 1; i <= n; i++){
		for(int j = 0; j < Maxn * Maxn; j++){
			dp2[i][j] = dp2[i - 1][j] + (j >= a[i] ? dp2[i - 1][j - a[i]] : 0);
			dp2[i][j] %= Mod;
		}
	}
	ll ans = pw[n];
	for(int i = (s + 1) / 2; i <= s; i++) ans -= 3 * dp[n][i];
	if(s % 2 == 0) ans += (dp2[n][s/2] * 3);
	ans %= Mod;
	cout << (ans + Mod) % Mod;
	return 0;
}

/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/



Measured memory_bytes: 454144
import java.io.PrintStream;
import java.util.Scanner;


public class Main {
    static final Scanner     sc = new Scanner(System.in);
    static final PrintStream so = System.out;
    
    public static void main(String[] args) {
        int a = ni();
        int b = ni();
        so.println(a >= 13 ? b : a >= 6 ? b/2 : 0);
    }
    
    private static int ni() {
        return sc.nextInt();
    }

    private static long nl() {
        return sc.nextLong();
    }

    private static String ns() {
        return sc.next();
    }

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

    private static int[] nints(int n) {
        return nints(n, 0);
    }

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


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';


struct Precision{
  Precision(){
    cout<<fixed<<setprecision(12);
  }
}precision_beet;

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  using D = double;
  D d;
  cin>>d;
  cout<<max(D(int(d+1.)),sqrt(D(2))*d)<<newl;
  return 0;
}



Measured memory_bytes: 3300
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;



int main(){	
	long long B;
	long long C;
	long long A;
	scanf("%lld",&A);
	scanf("%lld",&B);
	scanf("%lld",&C);
	ll ca, cb, cc;
	rep(i, 10000) {
		if (A%2 == 1 || B%2 == 1 || C%2 == 1) {
			cout << i << endl;
			return 0;
		}
		ca = (B+C)/2;
		cb = (A+C)/2;
		cc = (A+B)/2;
		A = ca; B = cb; C = cc;
	}
	cout << "-1" << endl;
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    long long ans=0;
    long long n,m;
    cin>>n>>m;
    m=m*m;
    long long a,b;
    for(int i=1;i<=n;i++)
    {
        cin>>a>>b;
        if(a*a+b*b<=m)
            ans++;
    }
    cout<<ans<<endl;
    return 0;

}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define pb push_back
#define all(v) v.begin(), v.end()
#define _GLIBCXX_DEBUG
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    char a,b; cin>>a>>b;
    if(a=='H') {
        if(b=='H') cout<<"H"<<endl;
        else cout<<"D"<<endl;
    }
    else if(b=='H') cout<<"D"<<endl;
    else cout<<"H"<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int n;
int R[200000];
int maxdR, mdR, dR;

int main(void)
{
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> R[i];
	}
	
	mdR = R[n-1]-R[n-2];
	maxdR  = mdR;

	for(int i=1;i<n-1;i++){
		dR = R[n-i-1]-R[n-i-2];
		if (mdR>0){
			mdR += dR;
		}else{
			mdR = dR;
		}
		if (mdR>maxdR){
			maxdR = mdR;
		}
	}
	
	cout << maxdR << endl;

	return 0;
}

Measured memory_bytes: 1940
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i, n) for (int i=0; i < n; i++)
#define repd(i, n) for (int i = n-1; i > -1; i--)
#define repran(i, a,b) for (int i = a; i<b;i++)
#define all(x) (x).begin(), (x).end()
#define v(T) vector<T>
#define vv(T) vector<v(T)>
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;



int main()
{
    ll n, m ,v, p;
    cin >> n >> m >> v >> p;
    vll a(n), s(n+1);
    rep(i, n) cin >> a[i];
    sort(all(a));
    reverse(all(a));
    rep(i, n) s[i+1] = s[i]+a[i];
    int ans = n;
    repran(i, p, n){
        ll score = m*(p+n-i-1);
        if (a[i]+m < a[p-1]) ans--;
        else {
            score += (i-p+1)*(a[i]+m) -(s[i]-s[p-1]);
            if (score< m*v) ans--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4828
#include <bits/stdc++.h>
#define fastIO ios::sync_with_stdio(NULL); cin.tie(NULL);

using namespace std;
const int N = 1E5+7;

long long f[107][N];
int n,W;
long long w[N], c[N];

int main()
{
    fastIO
    cin>>n>>W;
    
    for (int i = 1;i <= n; ++i) cin>>w[i]>>c[i];
    
    for (int i = 1;i <= n; ++i)
        for (int j = 1;j <= W;++j)
            if (j-w[i] >= 0) f[i][j] = max(f[i-1][j],f[i-1][j-w[i]]+c[i]);
            else f[i][j] = f[i-1][j];
    
    cout<<f[n][W];
}

Measured memory_bytes: 81760
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

const mod = 10^^9 + 7;

long modPow(long x, long k, long m) {
    if (k == 0) return 1;
    if (k % 2 == 0) return modPow(x * x % m, k / 2, m);
    return x * modPow(x, k - 1, m) % m;
}

long nck(long n, long k, long mod) {
    long x = 1;
    for (int i = 0; i < k; i++) {
        x = (x * (n - i)) % mod;
    }

    long kk = 1;
    for (int i = 1; i <= k; i++) {
        kk = (kk * i) % mod;
    }

    return (x * modPow(kk, mod - 2, mod)) % mod;
}

long calc(long n, long a, long b) {
    long ans = modPow(2, n, mod);
    ans = (ans - nck(n, a, mod) + mod) % mod;
    ans = (ans - nck(n, b, mod) + mod) % mod;
    ans--;
    return ans;
}

void main() {
    int n, a, b; scan(n, a, b);
    writeln(calc(n, a, b));
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int sum=0,i=0;
	int a,b;
	double ave=0.0;
	char gomi;
	while(cin>>a>>gomi>>b){
		sum+=a*b;
		ave+=b;
		i++;
	}
	ave=ave/i;
	if(ave-(double)(int)ave<0.5)
	ave=(double)(int)ave;
	else ave=(double)(int)(ave+0.9);   
	cout<<sum<<"\n"<<ave<<endl;
}

Measured memory_bytes: 1240
package main

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

var (
	scanner = bufio.NewScanner(os.Stdin)
)

func readRunes() (read []rune) {
	scanner.Scan()
	for _, v := range scanner.Text() {
		read = append(read, v)
	}
	return
}

func main() {
	s := readRunes()
	n := 0
	max := 0
	for _, c := range s {
		if "R" == string(c) {
			n++
		} else {
			max = int(math.Max(float64(n), float64(max)))
			n = 0
		}
	}
	max = int(math.Max(float64(n), float64(max)))
	fmt.Println(max)
}

Measured memory_bytes: 1772
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define debug(...) fprintf(stderr,__VA_ARGS__)

using namespace std;

const int maxn=200005;
const int inf=1e9;

struct data {
	int x,y;
	bool operator < (const data &other) const {
		return x<other.x;
	}
}a[maxn];
int n,m,mx[maxn<<2],tag[maxn<<2];

#define mid (l+r>>1)
#define lson (o<<1)
#define rson (o<<1|1)
void pushup(int o) {
	mx[o]=max(mx[lson],mx[rson]);
}

void pushdown(int o) {
	if(tag[o]) {
		mx[lson]+=tag[o],tag[lson]+=tag[o];
		mx[rson]+=tag[o],tag[rson]+=tag[o];
		tag[o]=0;
	}
}

void build(int l,int r,int o) {
	if(l==r) {
		mx[o]=-(m+1-l);
		return;
	}
	build(l,mid,lson);
	build(mid+1,r,rson);
	pushup(o);
}

int query(int l,int r,int o,int a,int b) {
	if(a<=l&&r<=b) return mx[o];
	pushdown(o);
	int ans=0;
	if(a<=mid) ans=max(ans,query(l,mid,lson,a,b));
	if(b>mid) ans=max(ans,query(mid+1,r,rson,a,b));
	return ans;
}

void add(int l,int r,int o,int a,int b,int c) {
	if(a<=l&&r<=b) {
		mx[o]+=c,tag[o]+=c;
		return ;
	}
	pushdown(o);
	if(a<=mid) add(l,mid,lson,a,b,c);
	if(b>mid) add(mid+1,r,rson,a,b,c);
	pushup(o);
}

int main() {
	scanf("%d%d",&n,&m);
	rep(i,1,n)
		scanf("%d%d",&a[i].x,&a[i].y);
	sort(a+1,a+n+1);
	build(1,m+1,1);
	int ans=max(0,n-m);
	rep(i,1,n) {
		add(1,m+1,1,1,a[i].y,1);
		ans=max(ans,query(1,m+1,1,a[i].x+1,m+1)-a[i].x);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 7936
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;


// void solve()
// {
//     string s;
//     cin>>s;
//     ll x1=s[0]-'a';
//     ll x2=s[1]-'a';
//     ll x3=s[2]-'a';
//     ll x4=s[3]-'a';
//     ll f1=0,f2=0;

     
    
    
// }
const int N=1e5+5;
vector<pll> v[N];
ll vis[N];
ll ans[N];

ll f=0;

void holve(ll x,ll col,ll s)
{
    vis[x]=1;
    ans[x]=col;
    
    for(auto it:v[x])
    {
        if(!vis[it.first])
        {
            if(it.second%2==0)
            {
                holve(it.first,col,x);   
            }
            else{
                holve(it.first,1-col,x);
            }
        }
    }
}


void solve()
{
    ll n;
    cin>>n;
    ll u,vv,dis;
    ll i,j;
    clr(ans);
    for(i=0;i<n-1;i++)
    {
        cin>>u>>vv>>dis;
        u--,vv--;
        v[u].pb(mp(vv,dis));
        v[vv].pb(mp(u,dis));
    }
    ll lef=-1;

   
    for(i=0;i<n;i++)
    {
       ll si = v[i].size();
       if(si==1)
       {
           lef=i;
           break;
       }
    }
     f=0;
     ll col2 = v[lef][0].second;
     if(col2%2==0)
     {
         col2=1;
     }
     else{
         col2=0;
     }
     holve(lef,col2,-1);
    //  clr(vis);
    //  holve(lef,1,-1);
        for(i=0;i<n;i++)
        {
            cout<<ans[i]<<"\n";
        }
    
    
}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 13056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


class UnionFind{
	vector<int> d;
	int maxSize;
	public:
	UnionFind(int n = 0):d(n,-1),maxSize(1){}
	~UnionFind(){}
	int find(int x){
		if(d[x] < 0) return x;
		return d[x] = find(d[x]);
	}
	bool unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return false; // 既にxとyは繋がっている。
		if(d[x] > d[y]) swap(x,y);
		d[x] += d[y];
		d[y] = x;
		maxSize = (maxSize < -d[x] ? -d[x] : maxSize);
		return true;
	}
	bool same(int x, int y) { return find(x) == find(y);}
  	int size(int x) { return -d[find(x)];}
  	int sizeMax() { return maxSize;}
};

int main() {
	int N,M;
	cin >> N >> M;
	UnionFind U(N);
	for(int i = 1; i <= M; i++){
		int a,b;
		cin >> a >> b;
		U.unite(a-1,b-1);
	}

	



	cout << U.sizeMax() << endl;
	return(0);
}


Measured memory_bytes: 4024
n,k = map(int, input().split())
s=input()

init=0
if s[0] == "L":
    init+=1
if s[-1]=="R":
    init+=1

for i in range(n-1):
    if s[i]=="R" and s[i+1]=="L":
        init+=2

init -= 2*k
if init <= 0:
    init=1
print(n-init)

Measured memory_bytes: 39408
import java.util.*
import java.math.*
fun main(args: Array<String>) {

    var N = readLine()!!.toInt()
    var A = readLine()!!.split(" ").map{it.toLong()}

    //val S = readLine()!!
    var ans = 0L;
    var min =1000000001L
    var count = 0
    for (a in A) {
        var b = a
        if (b < 0) {
            count++
            b = -a
        }
        ans += b
        if (min > b) min = b
    }

    if (count %2 == 1) ans -= 2*min

    println(ans)
}

Measured memory_bytes: 59876
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

const int MAX = 100010;

const int mod = 1e9 + 7;

inline int add(int a, int b) {
  return a+b >= mod ? a+b-mod : a+b;
}

inline int sub(int a, int b) {
  return a >= b ? a-b : a-b+mod;
}

inline int mul(int a, int b) {
  return llint(a)*b % mod;
}

int A[MAX], B[MAX];
int lo[MAX], hi[MAX];

int main(void) {
  int N;
  scanf("%d", &N);
  REP(i, N) scanf("%d", A+i);
  REP(i, N) scanf("%d", B+i);

  int prev = 0;
  REP(i, N) {
    if (A[i] > prev) lo[i] = hi[i] = A[i];
    else if (A[i] < prev) { puts("0"); return 0; }
    else lo[i] = 1, hi[i] = A[i];
    prev = A[i];
  }

  prev = 0;
  for (int i = N-1; i >= 0; --i) {
    if (B[i] > prev) lo[i] = max(lo[i], B[i]), hi[i] = min(hi[i], B[i]);
    else if (B[i] < prev) { puts("0"); return 0; }
    else lo[i] = max(lo[i], 1), hi[i] = min(hi[i], B[i]);
    prev = B[i];
  }

  int ans = 1;
  REP(i, N) {
    ans = mul(ans, max(0, hi[i]-lo[i]+1));
  }
  printf("%d\n", ans);
  
  return 0;
}


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

int main() {
  long long A, B, C=1, Ans=0;
  cin >> A >> B;
  while(A*C<=A*B){
    if(A*C%B==0){
      Ans=A*C;
      break;
    }
    C++;
  }
  cout << Ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
void SWAP(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void SWAP(int& a, int& b) { a ^= b; b ^= a; a ^= b; }


class C {
	int n;
	vll a;
	vll s;
public:
	C()
	{
		cin >> n;
		a.resize(n, 0);
		s.resize(n + 1, 0);

		ll last{ 0 };
		REP(i, n)
		{
			cin >> a[i];
			last += a[i];
			s[i] = last;
		}
	}
	void solve()
	{
		ll ans{ LLMAX };
		ll tmp;

		REP(i, n - 1)
		{
			ll p = s[i];
			ll q = s[n - 1] - p;

			tmp = abs(p - q);
			chmin(ans, tmp);
		}

		cout << ans << endl;
	}
};


int main()
{
	C solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int32_t main(){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++)
		cin >> a[i];
	
	int dp[n+1] = {0};
	
	for(int i = 1; i < n; i++){
		dp[i] = dp[i-1] + abs(a[i-1]-a[i]);
		if(i > 1)
			dp[i] = min(dp[i],dp[i-2] + abs(a[i-2]-a[i])); 
	}
	cout << dp[n-1] << endl;

	return 0;
}



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

class Prime
{
	ll i, iLimit;
public:
	bool isPrime(ll a);
};

bool Prime::isPrime(ll a)
{
	if (a == 1) return false;
	iLimit = (int)sqrt(a);
	for (i = 2; i <= iLimit; i++) if (a % i == 0) break;
	return (i == iLimit + 1 ? true : false);
}

int main() {
	int x;
	cin >> x;
	Prime p;
	for (int i = x;; ++i) {
		bool elf = p.isPrime(i);
		if (elf) {
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}


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

int main() {
  int a,b,c,z=1,N=0;
  cin>>a>>b;
  
  for(int i=0;i<a;i++){
    cin>>c;
    N+=c;
    if(N<=b){
      z++;
    }
  }
  
  cout<<z<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<long long> x(n), y(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
	}
	map<pair<long long, long long>, int> a;
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			a[make_pair(x[i] - x[j], y[i] - y[j])]++;
			a[make_pair(x[j] - x[i], y[j] - y[i])]++;
		}
	}

	int mx = 0;
	for (auto & i : a) {
		mx = max(mx, i.second);
	}

	cout << n - mx << endl;

	return 0;
}

Measured memory_bytes: 384
use std::fmt;
use std::io::stdin;
use std::io::BufRead;
use std::str;
use std::str::FromStr;

fn main() {
	let stdin = stdin();
	let mut scan = InputScanner::new(stdin.lock(),256);

	let k:usize = scan.next();
	let s:usize = scan.next();
	let mut answer:usize = 0;

	for x in 0..(k+1) {
		for y in 0..(k+1) {
			if (s - (x + y)) <= k {
				answer += 1;
			}
		}
	}

	println!("{}",answer);
}
struct InputScanner<R: BufRead> {
	reader: R,
	buf: Vec<u8>, // Should never be empty
	pos: usize,   // Should never be out of bounds as long as the input ends with '\n'
}
impl<R: BufRead> InputScanner<R> {
	fn new(reader: R, capacity: usize) -> Self {
		InputScanner {
			reader: reader,
			buf: Vec::with_capacity(capacity),
			pos: 0,
		}
	}

	#[inline]
	fn next<T: FromStr>(&mut self) -> T
	where
		T::Err: fmt::Debug,
	{
		if self.buf.is_empty() {
			self._read_next_line();
		}
		let mut start = None;
		loop {
			match (self.buf[self.pos], start.is_some()) {
				(b' ', true) | (b'\n', true) | (b'\r', true) => break,
				(_, true) | (b' ', false) => self.pos += 1,
				(b'\n', false) | (b'\r', false) => self._read_next_line(),
				(_, false) => start = Some(self.pos),
			}
		}
		let target = &self.buf[start.unwrap()..self.pos];
		unsafe { str::from_utf8_unchecked(target) }.parse().unwrap()
	}

	#[inline]
	fn _read_next_line(&mut self) {
		self.pos = 0;
		self.buf.clear();
		if self.reader.read_until(b'\n', &mut self.buf).unwrap() == 0 {
			panic!("Reached EOF");
		}
	}
}


Measured memory_bytes: 4352
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

//vector出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){
  o<<"{";
  for(int i=0;i<(int)v.size();i++) o << (i>0?", ":"") << v[i];
  o<<"}";
  return o;
}



int main() {
  int N,A;
  cin >> N >> A;
  vector<int> X(N);
  rep(i,N) cin >> X[i];
  vector<vector<vector<ll>>> dp(N+1,vector<vector<ll>>(N+1,vector<ll>(2501,0)));
  dp[0][0][0]=1;
  rep2(i,1,N+1){//ターン
    int x = X[i-1];
    rep(j,N+1){//枚数
      rep(k,2501){
        dp[i][j][k] = dp[i-1][j][k];
        if (j>0&&k-x>=0) dp[i][j][k]+=dp[i-1][j-1][k-x];
      }
    }
  }
  ll res=0;
  rep2(i,1,N+1) res += dp[N][i][A*i];
  cout << res << endl;
}

Measured memory_bytes: 52224
S=input()
N=len(S)
flag=0
for i in range(0,N):
    if(i%2==0):
        if(S[i]=="L"):
            flag=1
            break
    else:
        if(S[i]=="R"):
            flag=1 
            break

if(flag==0):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
import java.util.Scanner;

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

			int N = scan.nextInt();
			int[][]D = new int[N][2];
			int[]che = new int[N];


			int count = 0;
			int renzoku = 0;
			for(int i = 0;i<N;i++) {
				D[i][0] = scan.nextInt();
				D[i][1] = scan.nextInt();

				if(D[i][0]==D[i][1]) {
					che[i]++;
				}
			}

			int ok = 0;

			for(int i = 0;i<N-2;i++) {
				if(D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1]) {
					ok=1;
				}
			}

			if(ok==1) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}




		}


	}




}


Measured memory_bytes: 35936
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<random>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
//const int inf = 1e9 + 7;
//int dy[] = {0, 0, -1, 1};
//int dx[] = {1, -1, 0, 0};

void datasets(int n, int t, int l, int b) {
    int table[101] = {0};
    rep(i, l) {int rest; cin >> rest; table[rest] = -4;} //e
    rep(i, b) {int back; cin >> back; table[back] = -1;} //a
    double bt[101] = {0}; bt[0] = 1; //before transition
    double at[101] = {0};
    double sumpro = 0;
    double sta[101] = {0}; //lose stack
    while (t--) {
        rep(i, n + 1) {
            if (table[i] == -4) {
            
                at[i] += sta[i];
                sta[i] = 0;
            }
        }
        rep(i, n + 1) {
            rrep(j, 1, 6 + 1) {
                int wg = i + j; //where to go
                if (i + j > n) {
                    wg = n - (i + j - n);
                }
                int flg = 0;
                if (wg == n) {
                    sumpro += bt[i] / 6;
                    flg = 1;
                }
                if (table[wg] == -4) {
                    sta[wg] += bt[i] / 6;
                    flg = 2;
                }
                if (table[wg] == -1) {
                    at[0] += bt[i] / 6;
                    flg = 3;
                }
                if (flg == 0) {
                    at[wg] += bt[i] / 6;
                }
            }
        }
        
        rep(i, n + 1) {
            bt[i] = at[i];
            at[i] = 0;
        }
        /*
        rep(i, n + 1) {
            cout << bt[i] << " ";
            if (i == n) cout << endl;
        }
        rep(i, n + 1) cout << sta[i] << " ";
        cout << endl;
         */
    }
    cout << fixed << setprecision(10);
    cout << sumpro << endl;
}

int main() {
    int n, t, l, b;
    while (cin >> n >> t >> l >> b && n) {
        datasets(n, t, l, b);
    }
}




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

int main() {
    int n; cin >> n;
    vector<int> d(n);
    for (int i = 0;i < n; i++) cin >> d.at(i);

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

    int ans = 0;
    for (int i = 0; i < n - 1; i++) {
        if (d.at(i) < d.at(i + 1)) ans++;
    }

    cout << ans  + 1<< endl;
}

Measured memory_bytes: 256
#include<cctype>
#include<cstdio>
#include<cstring>
#include<algorithm>
const int N=1<<14|1,P=998244353;
int n,m,lim,fac[N],ifac[N],w[N],rev[N],f[N],g[N],t[N];
int read(){int x=0,c=getchar();while(isspace(c))c=getchar();while(isdigit(c))(x*=10)+=c&15,c=getchar();return x;}
void inc(int&a,int b){a+=b-P,a+=a>>31&P;}
void dec(int&a,int b){a-=b,a+=a>>31&P;}
void mul(int&a,int b){a=1ll*a*b%P;}
int pow(int a,int b){int r=1;for(;b;b>>=1,mul(a,a))if(b&1)mul(r,a);return r;}
void init(int n)
{
    int half=(lim=1<<(33-__builtin_clz(n)))/2,g=pow(3,(P-1)/lim);
    w[half]=fac[0]=ifac[0]=1;
    for(int i=1;i<lim;++i) rev[i]=(rev[i>>1]>>1)|(i&1? half:0),mul(fac[i]=fac[i-1],i),ifac[i]=pow(fac[i],P-2);
    for(int i=half+1;i<lim;++i) mul(w[i]=w[i-1],g);
    for(int i=half-1;i;--i) w[i]=w[i<<1];
}
void NTT(int*a,int f)
{
    if(!~f) std::reverse(a+1,a+lim);
    for(int i=1;i<lim;++i) if(i<rev[i]) std::swap(a[i],a[rev[i]]);
    for(int i=1;i<lim;i<<=1) for(int j=0,d=i<<1;j<lim;j+=d) for(int k=0,x;k<i;++k) x=1ll*a[i+j+k]*w[i+k]%P,dec(a[i+j+k]=a[j+k],x),inc(a[j+k],x);
    if(!~f) for(int i=0,x=P-(P-1)/lim;i<lim;++i) mul(a[i],x);
}
int main()
{
    int n=read(),m=read(),ans=0;
    init(n),memcpy(g+1,ifac+3,4*n),NTT(g,1),f[0]=t[0]=1;
    for(int i=1;i<=m;++i)
    {
	NTT(f,1);
	for(int j=0;j<lim;++j) mul(f[j],g[j]);
	NTT(f,-1);
        for(int j=0;j<=n;++j) t[j]=(1ll*f[j]*fac[j+2]+t[j]*(j*(j+1)/2+1ll))%P,mul(f[j]=t[j],ifac[j]);
	memset(f+n+1,0,4*(lim-n-1));
    }
    for(int i=0;i<=n;++i) inc(ans,1ll*ifac[i]*ifac[n-i]%P*t[i]%P);
    mul(ans,fac[n]),printf("%d",ans);
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define vi vector<int>
#define vl vector<long long>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPD(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORD(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define INF 1e18
#define MOD 1e9+7

template<class T> bool chmax(T &a, const T & b) {
    if (a<b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> bool chmin(T &a, const T & b) {
    if (a>b) {
        a = b;
        return true;
    }
    return false;
}

const int MAX_N = 110;
const int MAX_W = 10010;
int dp[MAX_N][MAX_W];
int value[MAX_N];
int weight[MAX_N];

int N, W;

void knapsack() {
    dp[0][0] = 0;
    REP(i, N) {
        REP(w, W+1) {
            if (w >= weight[i]) dp[i+1][w] = max(dp[i][w-weight[i]]+value[i], dp[i][w]);
            else dp[i+1][w] = dp[i][w];
        }
    }
}
int main() {
    cin >> N >> W;
    REP(i, N) {
        cin >> value[i] >> weight[i];
    }
    knapsack();
    cout << dp[N][W] << endl;
    return 0;
}


Measured memory_bytes: 7016
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n) ; ++i)
#define PI 3.14159265
using namespace std;
using ll = long long;
void self_max(int &a,int b){
	a = max(a,b);
}
void self_min(ll &a,ll b){
	a = min(a,b);
}

int main(){
	int n; cin >> n;
	
	int a = n/100;
	int b = n%100;
	

	if(5*a >= b) cout << 1 << endl;
	else cout << 0 << endl;

	return 0;
}

Measured memory_bytes: 256
mod = 10**9+7

def cmb(n, r):
    p, q = 1, 1
    for i in range(r):
        p = p * (n - i) % mod
        q = q * (i + 1) % mod
    return p * pow(q, mod - 2, mod) % mod

n,a,b = list(map(int,input().split()))
ans=pow(2,n,mod)-1
ans-=cmb(n,a)
ans-=cmb(n,b)

print((ans)%mod)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0LL)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<(#a)<<':'<<(a)<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;}
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}

bool isOk(ll key,ll value){
  return key < value;
}

int binary_search(vector<ll> a,ll key){
  ll ok = a.size();
  ll ng = -1;

  while(abs(ok - ng) > 1){
    ll mid = (ok + ng) / 2;
    if(isOk(key,a[mid]))ok = mid;
    else ng = mid;
  }
  return ok;
}


int main() {
  cin.tie(0); ios::sync_with_stdio(0);
  int h,w;cin>>h>>w;
  vector<string> str(h);rep(i,h)cin>>str[i];
  vector<vector<int>> ans(h,vector<int>(w));
  rep(i,h){
    rep(j,w){
      int tmp = 0;
      tmp += (i-1 >= 0 && str[i-1][j]   == '#');
      tmp += (j-1 >= 0 && str[i]  [j-1] == '#');
      tmp += (i+1 <  h && str[i+1][j]   == '#');
      tmp += (j+1 <  w && str[i]  [j+1] == '#');
      tmp += (i-1 >= 0 && j-1 >= 0 && str[i-1][j-1] == '#');
      tmp += (i-1 >= 0 && j+1 < w  && str[i-1][j+1] == '#');
      tmp += (i+1 <  h && j-1 >= 0 && str[i+1][j-1] == '#');
      tmp += (i+1 <  h && j+1 < w  && str[i+1][j+1] == '#');
      ans[i][j] = tmp;
      if(str[i][j] == '#')ans[i][j] = -1;
    }
  }
  rep(i,h){
    rep(j,w)if(ans[i][j] == -1)cout<<'#';
            else cout<<ans[i][j]; 
    cout<<endl;
  }
  return 0;
} 


Measured memory_bytes: 256