akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <iomanip>
#include <math.h>

using namespace std;

long long mod = 1000000007;

long long pow(long long x, long long k)
{
    if (k == 0)
    {
        return 1LL;
    }
    long long temp = pow(x, k / 2);
    if (k % 2 == 1)
    {
        return (((temp * temp) % mod) * x) % mod;
    }
    else
    {
        return (temp * temp) % mod;
    }
}

long long modular_inverse(long long x)
{
    return pow(x, mod - 2);
}

long long binomial(long long n, long long k)
{
    long long rez = 1;
    for (int i = n - k + 1; i <= n; i++)
    {
        rez *= i;
        rez %= mod;
    }
    long long temp = 1;
    for (int i = 1; i <= k; i++)
    {
        temp *= i;
        temp %= mod;
    }
    rez *= modular_inverse(temp);
    rez %= mod;
    return rez;
}

int query(int start, int n)
{
    cout << "?";
    for (int i = 0; i < n; i++)
    {
        cout << ' ' << start + i;
    }
    cout << '\n';
    string response;
    cin >> response;
    return response[0];
}

char queryKnowing(int pos, int knownPos, char knownChar, int n)
{
    cout << "? " << pos;
    for (int i = 1; i < n; i++)
    {
        cout << ' ' << knownPos + i;
    }
    cout << '\n';
    string response;
    cin >> response;
    return response[0];
}

char queryKnowing(vector<int> &v, int pos)
{
    cout << "?";
    for (int i = 0; i < v.size(); i++)
    {
        cout << " " << v[i];
    }
    cout << " " << pos << '\n';
    string response;
    cin >> response;
    return response[0];
}

int main()
{
    int n;
    cin >> n;
    int l = 1, r = n + 1;
    char start = query(l, n);
    while (r - l > 1)
    {
        int mid = (l + r) / 2;
        if (query(mid, n) == start)
        {
            l = mid;
        }
        else
        {
            r = mid;
        }
    }

    vector<int> positions;
    int reds = 1, blues = 1;
    vector<char> res(2 * n + 1, 'x');
    res[l] = start;
    res[l + n] = (start == 'R') ? 'B' : 'R';

    positions.push_back(l);
    positions.push_back(l + n);


    for (int i = 1; i < l; i++)
    {
        res[i] = queryKnowing(i, l, start, n);
        if (res[i] == 'R' && reds != n / 2)
        {
            reds++;
            positions.push_back(i);
        }
        if (res[i] == 'B' && blues != n / 2)
        {
            blues++;
            positions.push_back(i);
        }
    }
    for (int i = l + n + 1; i <= 2 * n; i++)
    {
        res[i] = queryKnowing(i, l, start, n);
        if (res[i] == 'R' && reds != n / 2)
        {
            reds++;
            positions.push_back(i);
        }
        if (res[i] == 'B' && blues != n / 2)
        {
            blues++;
            positions.push_back(i);
        }
    }

    for (int i = 1; i < n; i++)
    {
        res[l + i] = queryKnowing(positions, l + i);
    }

    cout << "! ";
    for (int i = 1; i <= 2 * n; i++)
    {
        cout << res[i];
    }
    cout << '\n';
    return 0;
}


Measured memory_bytes: 724
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
const int INF=1e9+10;
int n,pc[500010],f[300010][55],ans,a[500010],b[500010];
int tr(int x,int y){
	if ((abs(x-y))&1) return b[x]; else return a[x];
}
int main(){
	pc[0]=0;
	FOR(i,1,500000) pc[i]=pc[i>>1]+(i&1);
	cin>>n;
	FOR(i,0,n-1) getint(a[i]);
	FOR(i,0,n-1) getint(b[i]);
	FOR(i,0,(1<<n)-1) FOR(j,1,50) f[i][j]=INF;
	f[0][1]=0;
	FOR(i,0,(1<<n)-2)
		FOR(j,1,50)
			if (f[i][j]<INF){
				int cnt=0;
				FOR(k,0,n-1){
					if ((i>>k)&1){++cnt;continue;}
					int too=tr(k,pc[i]);
					if (too>=j) f[i|(1<<k)][too]=min(f[i|(1<<k)][too],f[i][j]+pc[i]-cnt);
				}
			}
	ans=INF;
	FOR(i,1,50) ans=min(ans,f[(1<<n)-1][i]);
	if (ans<INF) cout<<ans<<endl; else puts("-1");
	return 0;
}

Measured memory_bytes: 62336
#include <bits/stdc++.h>
using namespace std;
pair<int,int>pi;
priority_queue<pair<int,int> >que;

int main() {
    //priority_queue<pair<int,int>, vector<pair<int,int> >, greater<pair<int,int> > >que;
    int ans=0;
    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    int x = a%10;
    if(x==0) x=10;
    que.push(make_pair(x,a));
    x = b%10;
    if(x==0) x=10;
    que.push(make_pair(x,b));
    x = c%10;
    if(x==0) x=10;
    que.push(make_pair(x,c));
    x = d%10;
    if(x==0) x=10;
    que.push(make_pair(x,d));
    x = e%10;
    if(x==0) x=10;
    que.push(make_pair(x,e));
    int l=0;
    while(que.size()) {
        pair<int,int> p = que.top(); que.pop();
//        cout<<p.first<<"   "<<p.second<<endl;
        int y=p.second%10;

        if(y){
            ans = ans+p.second+(10-y);
            l = (10-y);
        }
        else ans = ans+p.second;
    }
    if(l==10) l=0;
    cout<<ans-l<<endl;
    return 0;
}


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

int main(void) {
    int a, b;
    char op;
    
    while (1) {
        cin >> a >> op >> b;
        
        if (op == '?') {
            break;
        }
        
        if (op == '+') {cout << a + b << endl;}
        else if (op == '-') {cout << a - b << endl;}
        else if (op == '*') {cout << a * b << endl;}
        else if (op == '/') {cout << a / b << endl;}
        
        
    }
    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int n,k;
int a[200002];
long long ans=0;
int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for(int i=1;i<=n-k;i++) ans+=a[i];
	printf("%lld\n",ans);
}

Measured memory_bytes: 1024
n = int(input())
a = list(map(int, input().split()))
b = [0]*10**5
ans = 0
for i in a:
  b[i] += 1
for i in range(1,10**5-1):
  SUM = sum(b[i-1:i+2])
  if SUM > ans:
    ans = SUM
print(ans)

Measured memory_bytes: 13964
#include <bits/stdc++.h>
using namespace std;
 
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    int N;

    cin >> N ;

    long long a;

    a = modpow(10,N,1000000000+7) - 2 * modpow(9,N,1000000000+7) + modpow(8,N,1000000000+7);

    long long ans;

    ans = a % (1000000000+7);

    if(ans < 0) ans += 1000000000+7;

    cout << ans << endl;
}



Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

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

    int n = 3;
    //for(int bit = 0; bit < 8; ++bit)
    for (int bit = 0; bit < (1<<n); ++bit)
    {
      int tmp = (int)(S[0] - '0');
      for(int i = 0; i < 3; ++i)
      {
        if(bit & (1<<i))tmp +=(int)(S[i+1] - '0');
        else tmp -= (int)(S[i+1] - '0');
      }

      if(tmp == 7)
      {
        cout << S[0];

        for(int i = 0; i < 3; ++i)
        {
          if(bit & (1<<i))cout << '+'; 
          else cout << '-';

          cout << S[i+1]; 
        }

        cout << "=7" << endl;
        return 0;
      }
    }
}

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

#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)

using ll = long long;
using namespace std;


void solve();

int main() {

   solve();
   return 0;

}

void solve() {

	

	ll n, m;
	cin >> n >> m;
	vector<vector<ll>> v(n+1);

	ll a, b;
	REP(i, m) {

		cin >> a >> b;
		v[a].push_back(b);

	}
	bool f = false;
	for (auto x : v[1]) {
		for (auto y : v[x]) {
			if (y == n) {
				f = true;
			}
		}
	}

	cout << (f ? "POSSIBLE" : "IMPOSSIBLE") << endl;

}

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

using namespace std;
typedef long long ll;
//typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll INF=1000000000;

vector<ll> pw2(51,1); vector<ll> pw10(19,1);
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll mid(ll x,ll y,ll z){return x>y?y>=z?y:min(z,x):x>=z?x:min(y,z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll myceil(ll x,ll y){if(x<=y) return 1;else if(x%y==0) return x/y;else return x/y+1;}
vector<ll> divisor(ll x){
	vector<ll> div;
	for(int i=1;i*i<=x;i++){
		if(i*i!=x && x%i==0){
			div.pb(i);
			div.pb(x/i);
		}
		else if(x%i==0) div.pb(i);
	}
	return div;
}
vector<ll> vectorprime(ll x){
	vector<bool> is_prime(x+1);
	vector<ll> prime;
	rep(i,x+1) is_prime[i]=true;
	is_prime[0]=is_prime[1]=false;
	for(int i=2;i<=x;i++){
		if(is_prime[i]){
			prime.pb(i);
		}
		for(int j=i*2;j<=x;j+=i) is_prime[j]=false;
	}
	return prime;
}

int main(){
	ll N,P; cin>>N>>P;
	ll tmp=P,ans=1;
	vector<ll>prime=vectorprime((ll)sqrt(P));
	rep(i,prime.sz){
		ll cnt=0;
		while(tmp%prime[i]==0){
			tmp/=prime[i];
			cnt++;
		}
		rep(k,cnt/N) ans*=prime[i];
	}
	if(tmp!=1 && N==1) ans*=tmp;
	cout<<ans;
}

Measured memory_bytes: 1528
#include<iostream>
using namespace std;
int H[100100][3];
int DP[100100][3];
int main()
{
  int N;
  cin>>N;
  for(int i=0;i<N;i++)
    for(int j=0;j<3;j++)
      cin>>H[i][j];
  for(int i=0;i<3;i++)
    DP[0][i]=H[0][i];
  for(int i=1;i<N;i++)
    for(int j=0;j<3;j++)
      for(int k=0;k<3;k++)
        if(j!=k)
          DP[i][j]=max(DP[i][j],DP[i-1][k]+H[i][j]);
  cout<<max(DP[N-1][0],max(DP[N-1][1],DP[N-1][2]));
  return 0;
}

Measured memory_bytes: 2560
import sys
from collections import defaultdict

n, m = map(int, sys.stdin.readline().strip().split(" ", 2))
list_city = defaultdict(list)

for line in sys.stdin:
    p, y = map(int, line.strip().split(" ", 2))
    list_city[p].append(y)

count_city = {}
for p, yl in list_city.iteritems():
    count_city[p] = {y:i+1 for i, y in enumerate(sorted(yl))}

    
sys.stdin.seek(0)
n, m = map(int, sys.stdin.readline().strip().split(" ", 2))

for line in sys.stdin:
    p, y = map(int, line.strip().split(" ", 2))
    print("{:0=6}{:0=6}".format(p, count_city[p][y]))


Measured memory_bytes: 65452
#include "bits/stdc++.h"
using namespace std;
int main() {
	double N, K;
	cin >> N >> K;
	vector<double>Dice(N);
	vector<double>Sum_Dice(N, 0);
	for (double i = 0; i < N; i++) {
		cin >> Dice.at(i);
		if (i == 0) Sum_Dice.at(i) = Dice.at(i);
		else Sum_Dice.at(i) = Sum_Dice.at(i - 1) + Dice.at(i);
	}
	vector<double>Max(N - K + 1);
	Max.at(0) = Sum_Dice.at(K - 1);
	for (double i = K + 1; i < N; i++) {
		Max.at(i - K) = Sum_Dice.at(i) - Sum_Dice.at(i - K);
	}
	sort(Max.begin(), Max.end(), greater<double>());
	double MAX = Max.at(0);
	double const ave = (MAX + K) / 2.0000000;
	printf("%.12lf\n", ave);
}

Measured memory_bytes: 4992
K = int(input())

i = 7 % K

result = set()
for x in range(K):
    if i == 0:
        print(x + 1)
        exit()
    if i in result:
        print(-1)
        exit()
    else:
        result.add(i)

    i = (i * 10 + 7) % K

print(-1)


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

using namespace std;

int main()
{
    int N, A, B;

    cin >> N >> A >> B;

    int a = N * A;

    if(a < B)
    {
        cout << a << endl;
    }
    else
    {
        cout << B << endl;
    }

    return 0;
}

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


int main()
{
    long long n,m;
    cin>>n>>m;
    if(n>=m)
    {
        if(n%m==0) cout<<0<<endl;
        else
        {
            long long z=n/m;
            n=abs(n-(z*m));
            cout<<min(n,abs(n-m))<<endl;
        }
    }
    else if(m>n)
    {
        long long z=abs(n-m);
        cout<<min(z,n)<<endl;
    }
    return 0;
}


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

int main(){
    long long h,w;
    cin >> h >> w;
    long long s[3];
    long long ans = h*w;

    for(int i=0; i<2; i++){
        for(int j=0; j<2; j++){
            long long a=h,b=w;
            if(i==0){
                s[0] = a*(b/3+j);
                b -= b/3+j;
            }
            else{
                s[0] = b*(a/3+j);
                a -= a/3+j;
            }
            if(a%2==0 || b%2==0){
                s[1] = a*b/2;
                s[2] = s[1];
            }
            else if(a<=b){
                s[1] = a*(b/2);
                s[2] = h*w - s[0] -s[1];
            }
            else {
                s[1] = b*(a/2);
                s[2] = h*w - s[0] -s[1];
            }
            long long t = *max_element(s,s+3) - *min_element(s,s+3);
            ans = min(ans,t);
        }
    }
    cout << ans << endl;
    return 0;
}


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

void Main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    int l=0, r=1;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        r = max(r, a[i]);
    }
    r++;
    while(r-l>1){
        long kk = 0;
        int m = (l+r)/2;
        for (int i = 0; i < n; i++)
        {
            kk += (long)(a[i]-1)/m;
        }
        if(kk > k){
            l = m;
        }else{
            r = m;
        }
    }
    cout << l+1 << endl;
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


Measured memory_bytes: 3988
import java.util.*;
import java.lang.Math;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();

    int[] W = new int[N];
    int all = 0;

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

    int S1 = 0;
    int S2 = all;
    int hall = all/2;
    for(int fh = 0; fh < N; fh++){
      S1 += W[fh];
      if(S1 >= hall){
        break;
      }
    }
		S2 -= S1;
		int ans = Math.abs(S2 - S1);

		S1 = 0;
		S2 = all;
		for(int sh = N-1; sh >= 0; sh--){
      S1 += W[sh];
      if(S1 >= hall){
        break;
      }
    }
		S2 -= S1;
		if(ans > Math.abs(S2 - S1)){
			ans = Math.abs(S2 - S1);
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 23252
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision


#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;

#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 

using namespace std;

typedef long long ll;

const long long int INF = 1000000000; //<10^10
//const ll MOD = 998244353;
const ll MOD = 1000000007;

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

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

  int n,k;
	cin >> n >> k;

	vector<long double> p(n);
	rep(i, n) {
		cin >> p[i];
	}

	vector<long double> psum(n+1); 
	psum[0] = 0;
	rep(i, n) {
		psum[i+1] = psum[i] + p[i];
	}

	long double ans = 0;
	rep(i, n - k+1) {
		chmax(ans, (psum[i+k] - psum[i] + k)/2);
	}

	cout << setprecision(8) << ans << endl;
	
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
#include <cstdlib> // abs(x-y)
#include <iomanip> // 出力の桁数指定
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  int ans = -1;
  
  if (a <= 9 and b <= 9)
    ans = a*b;
  cout << ans << endl;
}


Measured memory_bytes: 256
program prob2
    implicit none
    integer(16) :: a,b,c,k
    read(*,*) a,b,c,k

    if(abs(a-b) > 1000000000000000000_16) then
        write(*,*) "Unfair"
    end if

    if(mod(k, 2) == 0) then
        write(*,*) a-b
    else
        write(*,*) b-a
    end if


    
    stop
contains
end program prob2

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#include <iomanip>
#include <queue>
#include <string.h>
#include <bitset>
#define ll long long int
#define ld long double
#define rep(i,n) for(int i = 0;i < n;i++)
#define rep1(i,n) for(int i = 1;i < n;i++)
#define co(x) cout << x << endl
#define cosp(x) cout << x << " "
#define all(x) x.begin(),x.end()
#define allr(x) x.begin(),x.end(),greater<int>()
#define P pair<ll,ll>
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1ll << 60
#define PI 3.14159265359

using namespace std;

int main(){
	ll n;
	cin >> n;
	ll a;
	ll sum = 0;
	ll sum1 = 0;
	rep(i,n) {
		cin >> a;
		sum += a;
		sum1 += i+1;
	}
	cout << sum-sum1 << endl;
	
	return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double a,b;
  double ans;
  int ansInt;
  cin>>a>>b;
  
  ans=(a+b)/2;
  ansInt=ans;
  
  if(ans-ansInt>0){
    ansInt=ansInt+1;
  }
  
  cout<<  ansInt  <<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll i,j,N,H,W,ans=0;
  cin>>N>>H;
  cout<<max(N-H*2,0LL)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
#include <stack>
#include <cctype>
#include <cmath>
#include <bitset>

using namespace std;

/* typedef */
typedef long long ll;

/* constant */
const int INF = 1 << 30;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;

/* global variables */

/* function */

/* main */
int main(){

    int n, m, x;
    cin >> n >> m;
    bitset<18> mask(0);
    for (int i = 0; i < m; i++) {
        cin >> x;
        mask.set(x);
    }
    // Print bit if binary(i) includes mask bits
    /*
    // 1 ============================
    for (int i = 0; i < (1 << n); i++) {
        bitset<18> bs(i);
        if ((bs & mask) == mask) {
            printf("%d:", i);
            for (int j = 0; j < n; j++) {
                if ((bs >> j)[0]) printf(" %d", j);
            } 
            printf("\n");
        }
    }
    */

    int mask_int = mask.to_ulong();
    // 2 ===========================
    for (int b = 0; b < (1 << n); b++) {
        if ((b & mask_int) == mask_int) {
            printf("%d:", b);
            for (int i = 0; i < n;i++)
                if( (b >> i) & 1)
                    printf(" %d", i);
            printf("\n");
        }
    }
}



Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  bool four = false;
  rep(i,N){
    char c;
    cin >> c;
    if(c == 'Y') four = true;
  }

  if(!four) cout << "Three" << endl;
  else cout << "Four" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <numeric>

using namespace std;

string ans;
int main(){
    string o;
    string e;
    cin >> o >> e;
    int s_size = o.size() + e.size();
    for(size_t i = 1; i <= s_size; i++)
    {
        if(i%2==0){
            ans += e[(i-1)/2];
        }
        else ans += o[i/2];
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;

int main(){
  int N, K;
  cin >> N >> K;
  vector< int > books[10];

  for(int i = 0; i < N; i++){
    int a, b;
    cin >> a >> b;
    --b;
    books[b].push_back(a);
  }
  for(int i = 0; i < 10; i++){
    sort( books[i].rbegin(), books[i].rend());
  }
  int dp[2001];
  fill_n( dp, 2001, -1);
  dp[0] = 0;
  for(int i = 0; i < 10; i++){
    for(int j = K - 1; j >= 0; j--){
      if(dp[j] == -1) continue;
      int sum = 0;
      for(int k = 0; k < books[i].size() && j + k + 1 <= K; k++){
        sum += books[i][k];
        dp[j + k + 1] = max( dp[j + k + 1], dp[j] + sum + k * (k + 1));
      }
    }
  }
  cout << dp[K] << endl;
}

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

typedef long Int;

Int dp[100];

Int solve(Int n){
  Int rtn = 0;
  if(dp[n] != -1){
    rtn = dp[n];
  } else {
    if(n < 0){
      rtn = 0;
    } else if(n == 0){
      rtn = 1;
    } else {
      rtn = 0;
      rtn += solve(n-1);
      rtn += solve(n-2);
      rtn += solve(n-3);
    }
    dp[n] = rtn;
  }
  return rtn;
}


int main(void){
  memset(dp,-1,sizeof(dp));
  Int n;
  while(cin >> n , n){
    cout << solve(n)/10/365 + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
const int N=300000;
int a[N],n;
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	long long j=0,tmp=0,sum=0,num=0;
	for (long long i=1;i<=n;i++)
	{
		while(j<n&&(tmp^a[j+1])==(sum+a[j+1])) tmp^=a[++j],sum+=a[j];
 		tmp^=a[i];sum-=a[i];
		num+=j-i+1;
//		printf("%d %d/",i,j);
	}
	printf("%lld\n",num); 
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  vector<int> ans(n);
  rep(ri, 2) {
    { // solve R
      int cur = 0;
      rep(i, n) {
        if (s[i] == 'R') {
          cur++;
        } else {
          ans[i] += cur / 2;
          ans[i-1] += (cur + 1) / 2;
          cur = 0;
        }
      }
    }

    reverse(ans.begin(), ans.end());
    reverse(s.begin(), s.end());
    rep(i, n) {
      if (s[i] == 'R') s[i] = 'L';
      else s[i] = 'R';
    }
  }
  rep(i, n) cout << ans[i] << ' ';
  return 0;
}

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

#define lli long long int
#define endl "\n"

int main(){
	string a, b;
	cin >> a >> b;

	int n = a.size(), m = b.size();
	vector<vector<int> > dp(n+1, vector<int>(m+1, 0));

	for(int i = 1; i<= n ; i++){
		for(int j=1; j <= m; j++){
			if(a[i-1] == b[j-1])
				dp[i][j] = 1 + dp[i-1][j-1];

			else
				dp[i][j] = max(dp[i-1][j-1], max(dp[i][j-1], dp[i-1][j]));
		}
	}

	int i = n , j = m;
	string s = "";
	while(i >= 1 && j >= 1){
		if(dp[i][j] > dp[i-1][j-1] && dp[i][j] > dp[i-1][j] && dp[i][j] > dp[i][j-1]){
			s+= a[i-1];
			i--;
			j--;
		}
		else{
			if(dp[i][j] == dp[i-1][j-1]){
				i--;
				j--;
			}
			else if(dp[i][j] == dp[i-1][j])
				i--;

			else
				j--;
		}
	}

	reverse(s.begin(), s.end());

	cout << s << endl;

}

Measured memory_bytes: 35584
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;

int main()
{
	int h, w, k;
	cin>>h>>w>>k;
	string s[303];
	for(int i=0; i<h; i++){
		cin>>s[i];
	}
	int ans[303][303]={};
	int c=1;
	bool b[303]={};
	for(int i=0; i<h; i++){
		int cnt=0;
		for(int j=0; j<w; j++){
			ans[i][j]=c;
			if(s[i][j]=='#'){
				c++;
				cnt++;
			}
		}
		if(cnt) b[i]=1;
		for(int j=0; j<w; j++){
			if(ans[i][j]==c) ans[i][j]--;
		}
	}
	for(int i=1; i<h; i++){
		if(b[i]) continue;
		for(int j=0; j<w; j++) ans[i][j]=ans[i-1][j];
	}
	for(int i1=0; i1<h; i1++){
		if(b[i1]){
			for(int i=i1-1; i>=0; i--){
				for(int j=0; j<w; j++){
					ans[i][j]=ans[i+1][j];
				}
			}
			break;
		}
	}
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			cout<<ans[i][j]<<" ";
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1280
X, N = map(int, input().split())

exist = [False] * 101
p = list(map(int, input().split()))

for i in range(N):
    exist[p[i]] = True

for i in range(200):
    if X - i <= 0:
        print(X-i)
        exit()

    if not exist[X-i]:
        print(X-i)
        exit()

    if X + i > 100:
        print(X+i)
        exit()

    if not exist[X+i]:
        print(X+i)
        exit()


Measured memory_bytes: 9204
import numpy as np
n,w = map(int,input().split())
WV = [list(map(int,input().split()))for _ in range(n)]

dp = np.zeros(w+1,int)#w+1のint型配列
for i in range(n):
	W,V = WV[i]
	#print(str(dp)+":"+str(dp[W:])+":"+str(dp[:-W]))
	dp[W:] = np.maximum(dp[W:],dp[:-W]+V)
	#print(str(dp))

print(dp[-1])

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

int main () {

    string s;
    cin >> s;
     
  
    if (strcmp (s.c_str(), "Sunny") == 0) cout << "Cloudy" << endl;
    if (strcmp (s.c_str(), "Cloudy") == 0) cout << "Rainy" << endl;
    if (strcmp (s.c_str(), "Rainy") == 0) cout << "Sunny" << endl;


}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>

using namespace std;

int main()
{
    int a, b, k;
    cin >> a >> b >> k;
    for (int i=a; i<a+k; i++) {
        if (i > b) break;
        cout << i << '\n';
    }
    for (int i=b-k+1; i<=b; i++) {
        if (i < a+k) continue;
        cout << i << '\n';
    }
    
    return 0;
}

Measured memory_bytes: 3596
N, M, C = gets.split.map(&:to_i)
B = gets.split.map(&:to_i)

A = Array.new(N, Array.new(M))
for i in 0..(N-1) do 
    A[i] = gets.split.map(&:to_i)
end

ans = 0

for i in 0..(N-1) do 
    sum = 0
    for j in 0..(M-1) do
        sum += A[i][j] * B[j]
    end
    if sum + C > 0 then
        ans += 1
    end
end

puts ans

Measured memory_bytes: 1788
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
ll digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
ll countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}


int main() {
	IOS;
	int a, b;
	cin >> a >> b;
	int ans = a + (b - a) * 2;
	cout << ans << endl;
}



Measured memory_bytes: 256
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
		String s[]=bu.readLine().split(" ");
		int n=Integer.parseInt(s[0]),m=Integer.parseInt(s[1]),i;
		double tot=0,a[]=new double[n];;
		s=bu.readLine().split(" ");
		for(i=0;i<n;i++)
		{a[i]=Double.parseDouble(s[i]);
		tot+=a[i];}
		tot/=4.0*m;
		int c=0;
		for(i=0;i<n;i++)
		if(a[i]>=tot) c++;
		if(c>=m) System.out.print("Yes");
		else System.out.print("No");
	}
}

Measured memory_bytes: 21332
n = int(input())
a = input()

r = 0
for i in range(10):
  s = a.find(str(i))
  if s == -1:
    continue
  for j in range(10):
    s2 = a.find(str(j), s + 1)
    if s2 == -1:
      continue
    for k in range(10):
      if a.find(str(k), s2 + 1) != -1:
        r += 1
print(r)
  

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

int main(){
	int n,a,n1=0,n2=0,n4=0;
	cin>>n;

	while(n--){
		cin>>a;
		if(a%4==0)
			n4++;
		else if(a%2==0)
			n2++;
		else
			n1++;
	}

	int yes=0;

	if(n1==0)
		yes=1;
	else if(n2==0){
		if(n4>=n1-1)
			yes=1;
		else
			yes=0;
	}
	else if(n4>=n1)
		yes=1;
	else
		yes=0;
	//cout<<n1<<n2<<n4<<endl;
	//cout<<yes<<endl;
	yes?cout<<"Yes\n":cout<<"No\n";
}


Measured memory_bytes: 3532
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<queue>

using namespace std;


int state[100005];
pair<int, pair<int, int> > iii[200005];
int en[100005];
int es[100005];
int in[100005];

int main(){
  int n,m;cin>>n>>m;
  for(int i=0;i<m;i++){
    int r,l,d;cin>>r>>l>>d;
    r--;
    l--;
    iii[i] = make_pair(r, make_pair(l,d));
    in[l]++;
  }
  for(int i=0;i<n;i++) state[i] = -1;

  sort(iii,iii+m);
  en[iii[0].first] = 1;
  for(int i=1;i<m;i++){
    if(iii[i].first != iii[i-1].first){
      es[iii[i].first] = i;
    }
    en[iii[i].first]++;
  }

  //for(int i=0;i<m;i++){
  //  cout<<iii[i].first<<" "<<iii[i].second.first<<" "<<iii[i].second.second<<endl;
  //}

  bool flag = true;

  for(int i=0;i<n;i++)if(in[i] == 0){
      queue< pair<int,int> > q;
      q.push(make_pair(i,0));
      while(!q.empty()){
        pair<int,int> t = q.front();
        //cout<<t.first<<" dist:"<<t.second<<endl;
        q.pop();
        if(state[t.first] != -1){
          if(state[t.first] != t.second){
            //cout<<t.first<<" "<<" "<<state[t.first]<<" "<<t.second<<endl;
            flag = false;
            break;
          } else {
            continue;
          }
        }
        state[t.first] = t.second;
        for(int j=0;j<en[t.first];j++){
          //cout<<iii[es[t.first]+j].second.first<<" ";
          pair<int,int> pp = make_pair(iii[es[t.first]+j].second.first, t.second + iii[es[t.first]+j].second.second);
          q.push(pp);
        }//cout<<endl;
      }
      if(!flag) break;
  }

  bool loop = false;
  for(int i=0;i<n;i++){
    if(state[i] == -1){
      loop = true;
      //cout<<i<<endl;
    }
  }

  if(loop) cout<<"No"<<endl;
  else {
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }

}


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

using namespace std;

int main(){
  string a, b;
  cin >> a;
  cin >> b;

  if (a.size()>b.size()) cout << "GREATER" << endl;
  else if (a.size()<b.size()) cout << "LESS" << endl;
  else {
    for (int i = 0; i < a.size(); i++) {
      if ((int)a[i] < (int)b[i]) {
	cout << "LESS" << endl;
	return 0;
      }
      else if ((int)a[i] > (int)b[i]) {
	cout << "GREATER" << endl;
	return 0;
      }
    }
    cout << "EQUAL" << endl;
  }
  
  return 0;
}


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

int main()
{
	int N;
	cin >> N;
	vector<pair<int, int>> A( N );
	for( int i = 0; i < N; i++ ) {
		cin >> A[i].first;
		A[i].second = i;
	}
	vector<pair<int, int>> B( N );
	for( int i = 0; i < N; i++ ) {
		cin >> B[i].first;
		B[i].second = i;
	}

	sort( A.begin(), A.end() );
	sort( B.begin(), B.end() );
	string ans = "Yes";
	for( int i = 0; i < N; i++ ) {
		if( A[i].first > B[i].first ) {
			ans = "No";
			break;
		}
	}
	if( ans == "Yes" ) {
		int flag = 0;
		for( int i = 0; i < N - 1; i++ ) {
			if( A[i + 1].first <= B[i].first ) {
				flag = 1;
				break;
			}
		}
		vector<int> perm( N );
		for( int i = 0; i < N; i++ ) {
			perm[ A[i].second ] = B[i].second;
		}
		int cur = 0;
		int flag1 = 0;
		for( int i = 0; i < N; i++ ) {
			if( perm[cur] < 0 ) {
				flag1 = 1;
				break;
			}
			int next = perm[cur];
			perm[cur] = -1;
			cur = next;
		}
		if( flag == 0 && flag1 == 0 ) ans = "No";
	}
 
	cout << ans << endl;
}


Measured memory_bytes: 2176
#include<stdio.h>

int main(){

    int a,b,c,j;

    scanf("%d %d %d",&a,&b,&c);

    if(a > b){
        j = a;
        a = b;
        b = j;

    }

    if(a > c){
        j = a;
        a = c;
        c = j;
    }
    if(b > c){
        j = b;
        b = c;
        c = j;
    }

    printf("%d %d %d\n",a,b,c);






    return 0;
}



Measured memory_bytes: 2124
#include<iostream>
#include<cstring>
#include<algorithm>

const int N = 1e5+10;

typedef long long ll;

ll q[N];

using namespace std;

int main()
{
    ll n;
    ll max1 = 0,max2 = 0;

    cin >> n;

    for (int i = 0;i < n ; i ++ ) cin >> q[i];

    sort(q,q+n);

    int m = 1;

    ll s = q[n-1];


    for (int i = n-2; i >= 0 ; i --)
    {
        if(q[i] == s)
        {
            m++;
        }
        else
        {
            s = q[i];
            m = 1;
        }
        if(m >= 4)
        {
            if(max1 == s)
            {
                max2 = s;
                break;
            }
        }
        if(m >= 2 && max1 == 0)
        {
            max1 = s;
        }

        else if(m >= 2 && max1 != s)
        {
            max2 = s;
            break;
        }
    }

    cout << max1*max2 << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define all(x) begin(x), end(x)
#define range(x) begin(x), begin(x)
#define what(x) cout << #x << ": " << x << '\n'
#define print(x) for (auto &el: x) cout << el << ' '; cout << '\n'
using namespace std;
 
template<typename S, typename T>
ostream& operator <<(ostream &os, pair<S, T> &m) { 
    os << '[' << m.first << " " << m.second << ']'; 
    return os; 
}

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

    int n;
    cin >> n;
    cout << n + n * n + n * n * n << endl;
    

    return 0;
}

Measured memory_bytes: 3644
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
 
#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define ll long long int
#define sp ' '
#define intmax 2147483647
#define intmin -2147483647
#define llmax 9223372036854775807
using namespace std;
 
int n, a[100002], s;
 
int main(){
	cin >> n;
	a[0] = 0;
	s = 0;
	lp(n) {
		cin >> a[i + 1];
		s += abs(a[i + 1] - a[i]);
	}
	s += abs(a[n]);
	a[n + 1] = 0;
	lp(n)
		cout << s - abs(a[i + 1] - a[i]) - abs(a[i + 2] - a[i + 1]) + abs(a[i + 2] - a[i]) << endl;
	return 0;
}

Measured memory_bytes: 1664
//                          VIVEK UPADHYAY
//                          MANIT, BHOPAL(M.P)
/**********************************************************************************************/
/**********************************************************************************************/
//                        $$ JAB-TAK TODEGA NHI,
//                           TAB -TAK CHODEGA NHI :D
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
using namespace std;
#define F first
#define S second
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define LINE cout<<"\n" ;
#define ok cout<<"ok\n" ;
#define dbg(x) cout<<#x<<" = "<<(x)<<"\n";
#define fill(A, VAL) memset(A, VAL, sizeof(A))
#define sz(a) ((int) a.size())
typedef long long ll;
const int MAXN = 2*1e5 + 10;
const int MAX = 1e7 + 1 ;
double pi = 3.1415926535897932384626433832795;
const ll inf=1e18 ;
ll mod = 998244353 ;
ll powr(ll a , ll b){ if(b==0) return 1LL ; ll x = powr(a,b/2) ; x = (x*x)%mod ; if(b%2) return ((a%mod)*x)%mod ; return x ;}
ll gcd(ll a , ll b){if(a==0) return b ; return gcd(b%a,a);}
int main () {
    int N = 4 ;
    vector<int> a(N) ;
    for(int i =0 ; i <  4; i++) cin >> a[i] ;
    sort(a.begin(),a.end());
    if(a[0]==1 && a[1]==4 && a[2]==7 && a[3]==9) cout<<"YES\n";
    else cout<<"NO\n" ;
    
    return 0 ;
}


Measured memory_bytes: 256
import java.util.*


fun main(args: Array<String>) {
  val scanner = Scanner(System.`in`)
  val a = scanner.nextInt()
  val b = scanner.nextInt()
  val c = scanner.nextInt()

  println(if (a + b + c >= 22) {
    "bust"
  } else {
    "win"
  })
}

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

#整数値龍力　複数の入力
def input_multiple_number():
    return map(int, input().split())

A,B = input_multiple_number()

for i in range(10000):
    price = i+1
    eight = int(price * 0.08)
    ten = int(price * 0.1)
    if eight == A and ten == B:
        if(A > 100 or B > 100):
            print(-1)
            exit(0)
        print(price)
        exit(0)

print(-1)



Measured memory_bytes: 3060
#include <stdio.h>

int main(void) {
	int N;
	scanf("%d", &N);
	int A[200];
	for (int i = 0;i < N;i++) {
		scanf("%d", &A[i]);
	}

	int n = 0;
	int flag = 0;
	while (flag == 0) {
		for (int i = 0;i < N;i++) {
			if (A[i] % 2 != 0) {
				flag = 1;
			}
		}

		if (flag == 0) {
			for (int i = 0;i < N;i++) {
				A[i] /= 2;
			}

			n++;
		}
	}

	printf("%d\n", n);

	return 0;
}

Measured memory_bytes: 128
/**
*
* Author: Mouhanad
* Lang: GNU C++14
*
**/
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >
typedef long long ll;
const int inf = 1<<30;
const int N =100100;
int n , a[N] , q ;
char al[N];
int main ( ){
   scanf("%d",&n);
  scanf("%s",al);
  string s = al ;
    s.erase(unique(s.begin(),s.end()), s.end() );

  printf("%d",s.length());
return 0 ;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
int main()
{
  ll m,n;
  cin>>m>>n;
  vector< vector<char> >grid(m, vector<char>(n));
  for(ll i=0;i<m;i++)
  {
    string s;
    cin>>s;
    //cout<<s;
    for(ll j=0;j<n;j++)	
      grid[i][j]=s[j];
  }
  
  vector<ll>dp(n, 0);
  dp[0]=1;
  for(ll i=0;i<m;i++)
  {
    for(ll j=0;j<n;j++)
    {
      	if(grid[i][j]=='#')
          dp[j]=0;
		else if((j-1)>=0 && (i-1)>=0 && grid[i-1][j]=='.' && grid[i][j-1]=='.')
          dp[j]=(dp[j]+dp[j-1])%MOD;
      	else if((i-1)>=0 && grid[i-1][j]=='.')
          dp[j]=dp[j];
      	else if((j-1)>=0 && grid[i][j-1]=='.')
          dp[j]=dp[j-1];
      //cout<<dp[j]<<" ";
    }
    //cout<<"\n";
  }
  cout<<dp[n-1];
   
  return 0;
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

int dp[200005][2];

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

  REP(n,200005) {
    REP(d,2) {
      dp[n][d] = INF;
    }
  }

  dp[0][0] = 0;

  REP(n,S.size()) {
    if(S[n] == '.') {
      dp[n+1][0] = min(dp[n+1][0], dp[n][0]);
      dp[n+1][1] = min(dp[n+1][1], dp[n][0] + 1);
      dp[n+1][1] = min(dp[n+1][1], dp[n][1] + 1);
    } else {
      dp[n+1][0] = min(dp[n+1][0], dp[n][0] + 1);
      dp[n+1][1] = min(dp[n+1][1], dp[n][0]);
      dp[n+1][1] = min(dp[n+1][1], dp[n][1]);
    }
  }

  cout << min(dp[S.size()][0], dp[S.size()][1]) << endl;

  return 0;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define int               long long
#define fr                first
#define sc                second
#define vc                vector
#define endl              '\n'
#define pii               pair<int,int>
#define msi               map<string,int>
#define mii               map<int,int>
#define psi               pair<string,int>
#define pis               pair<int,string>
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define LSB(i)            ((i)&-(i))

template<typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 1e5 + 5;
int dp[N];
int a[N];
int n, k;

/*int dynamic(int pos)
{
    if (pos > n)
        return INT_MAX;
    if (pos == n)
        return 0;
    if (dp[pos] != -1)
        return dp[pos];
    int ans = INT_MAX;
    for (int i = 1; i <= k; i++)
    {
        ans = min(ans, dynamic(pos + i) + abs(a[pos + i] - a[pos]));
    }
    dp[pos] = ans;
    return ans;
}
*/
void solve()
{
    cin >> n >> k;
    for (int i = 1 ; i <= n; i++)
        cin >> a[i];
    for (int i = 1; i <= n; i++)
        dp[i] = INT_MAX;
    for (int i = 1; i <= k && i <= n; i++)
    {
        dp[i] = abs(a[i] - a[1]);
    }
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= k; j++)
        {
            if (i + j <= n)
                dp[i + j] = min(dp[i + j], dp[i] + abs(a[i] - a[i + j]));
        }
    }
    cout << dp[n];

}
signed main() {
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    //cin>>t;
    while (t--) solve();
    return 0;
}

Measured memory_bytes: 1792
import sys
readline = sys.stdin.readline
class Tree:
    __slots__ = ['id', 'p', 'depth', 'type', 'c']
    def __init__(self, id):
        self.id = id
        self.p = -1
        self.depth = -1
        self.type = "leaf"
        self.c = []
    def __str__(self):
        return f"node {self.id}: parent = {self.p}, depth = {self.depth}, {self.type}, {self.c}"
n = int(input())
li = tuple(Tree(i) for i in range(n))
for _ in range(n):
    id, k, *c = map(int, readline().split())
    if k != 0:
        li[id].type = "internal node"
        li[id].c = c
        for j in c:
            li[j].p = id
root = 0
while li[root].p != -1:
    root = li[root].p
li[root].type = "root"
li[root].depth = 0
def depth_check(id, d):
    d += 1
    for i in li[id].c:
        li[i].depth = d
        if li[i].type != "leaf":
            depth_check(i, d)
depth_check(root, 0)
print(*li, sep="\n")



Measured memory_bytes: 34520
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String c = sc.next();
        if(c.equals("a") || c.equals("e") || c.equals("i") || c.equals("o") || c.equals("u")) {
            System.out.println("vowel");
        }else {
            System.out.println("consonant");
        }
    }
}

Measured memory_bytes: 23124
#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;
	cin >> n;
	vector<int> h(n);
	rep(i,n) cin >> h[i];
	
	int res = 1;
	int high = h[0];
	
	rep(i,n-1){
		if(h[i+1] >= high){
			res++;
			high = h[i+1];
		}
	}
	
	cout << res << endl;
	
	return 0;
}

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

int main()
{
    int H, W;

    cin >> H >> W;
    vector<string> fld(H);
    vector<vector<int>> cost(H);
    for (int i = 0; i < H; i++)
    {
        string s;
        cin >> s;
        fld[i] = s;
    }


    cost[0] = vector<int>(W);
    cost[0][0] = 0;
    cost[0][0] += (fld[0][0] == '#') ? 1 : 0;
    for (int y = 1; y < W; y++)
    {
        int left;
        left = cost[0][y - 1];
        cost[0][y] = left;
        cost[0][y] += (fld[0][y] =='#' && ! (fld[0][y-1]=='#')) ? 1 : 0;
    }
    for (int t = 1; t < H; t++)
    {
        cost[t] = vector<int>(W);
        cost[t][0] = cost[t - 1][0];
        cost[t][0] += (fld[t][0] == '#' && ! (fld[t-1][0] == '#')) ? 1 : 0;
        for (int y = 1; y < W; y++)
        {
            int top, left;

            top = cost[t - 1][y];
            top += (fld[t][y] == '#' && ! (fld[t - 1][y] == '#')) ? 1 : 0;
            left = cost[t][y - 1];
            left += (fld[t][y] == '#' && ! (fld[t][y-1] == '#')) ? 1 : 0;
            cost[t][y] = min(top, left);
        }
    }
    cout << cost[H - 1][W - 1];
    return 0;
}

Measured memory_bytes: 256