akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int main() {
    int64_t N;
    cin >> N;
    vector<int64_t> a(N);
    for (int64_t& A : a) {
        cin >> A;
    }

    int64_t ans = 0;
    for (int64_t i = 0; i < N; i++) {
        if (i % 2 == 0 && a[i] % 2 == 1) {
            ans++;
        }
    }
    cout << ans << endl;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    string S;
    cin >> S;

    bool Nflag = false;
    bool Sflag = false;
    bool Wflag = false;
    bool Eflag = false;
    rep (i, S.size()) {
        if (S[i] == 'N') {
            Nflag = true;
        }
        if (S[i] == 'S') {
            Sflag = true;
        }
        if (S[i] == 'W') {
            Wflag = true;
        }
        if (S[i] == 'E') {
            Eflag = true;
        }
    }

    if (Nflag == Sflag && Wflag == Eflag) {
        Yes;
    } else {
        No;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>

using namespace std;

struct node{
    int key;
    int parent, left, right;
    node(){ parent=-1; left=-1; right=-1; }
};

vector<node> tree;
int root=-1;

void print_pre(int id)
{
    if(id==-1){ return; }
    printf(" %d", tree[id].key);
    print_pre(tree[id].left);
    print_pre(tree[id].right);
}

void print_in(int id)
{
    if(id==-1){ return; }
    print_in(tree[id].left);
    printf(" %d", tree[id].key);
    print_in(tree[id].right);
}

void insert(int z)
{
    int y=-1;
    int x=root;
    while(x!=-1){
        y=x;
        if(tree[z].key<tree[x].key){
            x=tree[x].left;
        } else{
            x=tree[x].right;
        }
    }
    tree[z].parent=y;
    if(y==-1){
        root=z;
    } else if(tree[z].key<tree[y].key){
        tree[y].left=z;
    } else{
        tree[y].right=z;
    }
}

int find(int key)
{
    int x=root;
    while(x!=-1){
        int k=tree[x].key;
        if(key==k){
            return x;
        } else if(key<k){
            x=tree[x].left;
        } else{
            x=tree[x].right;
        }
    }
    return -1;
}

void delete_(int z)
{
    auto which=[](int z){
        auto p=&tree[tree[z].parent];
        if(p->left==z){
            return &p->left;
        } else{
            return &p->right;
        }
    };

    if(tree[z].left!=-1 && tree[z].right!=-1){
        int x=tree[z].right;
        while(tree[x].left!=-1){
            x=tree[x].left;
        }
        tree[z].key=tree[x].key;
        z=x;
    }

    if(tree[z].left==-1 && tree[z].right==-1){
        if(tree[z].parent!=-1){
            *(which(z))=-1;
        } else{
            root=-1;
        }
    } else if(tree[z].left!=-1){
        if(tree[z].parent!=-1){
            *(which(z))=tree[z].left;
        } else{
            root=tree[z].left;
        }
        tree[tree[z].left].parent=tree[z].parent;
    } else{
        if(tree[z].parent!=-1){
            *(which(z))=tree[z].right;
        } else{
            root=tree[z].right;
        }
        tree[tree[z].right].parent=tree[z].parent;
    }
}

int main()
{
    int m;
    scanf("%d", &m);
    tree=vector<node>(m);
    int n=0;
    for(int i=0; i<m; i++){
        char buf[8]; scanf("%s", buf);
        if(*buf=='i'){
            int k; scanf("%d", &k);
            tree[n].key=k;
            insert(n);
            n++;
        } else if(*buf=='f'){
            int k; scanf("%d", &k);
            printf("%s\n", find(k)!=-1 ? "yes" : "no");
        } else if(*buf=='d'){
            int k; scanf("%d", &k);
            int id=find(k);
            if(id!=-1){
                delete_(id);
            }
        } else{
            print_in(root);
            printf("\n");
            print_pre(root);
            printf("\n");
        }
    }
    return 0;
}

Measured memory_bytes: 9960
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define dunk(a) cout << (a) << endl
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;

int main() {
	int n, m; cin >> n >> m;
	int ac = 0;
	int pn = 0;
	vector<vector<string>> res(n);
	rep(i, m) {
		int ind;
		string jud;
		cin >> ind >> jud;
		res[ind - 1].push_back(jud);
	}

	rep(i, n) {
		bool a = false;
		bool b = false;
		int s = res[i].size();
		int wa = 0;
		rep(j, s) {
			if (res[i][j] == "AC") {
				a = true;
				break;
			}
			else if (res[i][j] == "WA") {
				b = true;
				wa++;
			}
		}
		if (a) ac++;
		if (a && b) pn += wa;
	}

	dunk(ac);
	dunk(pn);
	return 0;
}


Measured memory_bytes: 10368
#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 fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

vector<int> vec;
int freq[100001];
vi a;
vi inv;
bool visited[100001];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, m, q;
	cin >> n >> m >> q; vec.resize(q);
	for(int i = 0; i < q; i++)
	{
		cin >> vec[i]; vec[i]--;
	}
	freq[0] = n;
	reverse(vec.begin(), vec.end());
	for(int i = 0; i < q; i++)
	{
		if(!visited[vec[i]])
		{
			visited[vec[i]] = 1;
			a.pb(vec[i]);
		}
	}
	for(int i = 0; i < m; i++)
	{
		if(!visited[i]) a.pb(i);
	}
	//cerr << a.size() << ' ' << n << '\n';
	inv.resize(m);
	for(int i = 0; i < m; i++)
	{
		inv[a[i]] = i;
	}
	
	for(int i = 0; i < q; i++)
	{
		int f = inv[vec[i]];
		if(freq[f])
		{
			freq[f]--; freq[f+1]++;
		}
		/*
		else
		{
			cout << "No"; return 0;
		}
		*/
	}
	int idx = 0;
	for(int i = 0; i <= m; i++)
	{
		if(freq[i])
		{
			idx = i; break;
		}
	}
	for(int i = idx; i < m - 1; i++)
	{
		if(a[i] >= a[i+1]) {cout << "No"; return 0;}
	}
	cout << "Yes"; return 0;
}


Measured memory_bytes: 2040
I=lambda:list(map(int,input().split()))
n,m=I()
*s,p=eval('I(),'*-~m)
a=0
r=range
for i in r(1<<n):
 c=[0]*m
 for j in r(n):
  for k in r(m):c[k]+=i>>j&(j+1in s[k][1:])
 a+=all(j==i%2for i,j in zip(c,p))
print(a)

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

using namespace std;
typedef long long int LL;
const int INF=2e9+1e8;
const int maxn=1e6+100;

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
	int odd=0,even=0;
	int n,p;
	scanf("%d%d",&n,&p);
	for(int i=0;i<n;i++)
	{
	    int x;
		scanf("%d",&x);
		if(x&1) odd++;
		else even++;
	}
	LL tot=(1LL<<n);
	LL ans;
	ans=(1LL<<(odd-1))*(1LL<<even);
	if(p&1)
	{
		printf("%lld\n",ans);
	}
	else 
	{
	    printf("%lld\n",tot-ans);
	}
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define LINF 1e18
#define INF 1e9
using namespace std;

#define pow_calc(a) (a*a*a*a*a)


int main(){
    ll x;
    cin >> x;
    ll a = 1,b = 0;


    while(pow_calc(a) <= 1e18){
        b = 0;

        while(pow_calc(a) - pow_calc(b) > 0){
            if(pow_calc(a) - pow_calc(b) == x){
                cout << a << " " << b << endl;
                return 0;
            }
            b++;
        }
        
        b = 0;
        while(pow_calc(a) - pow_calc(b) <= x){
            if(pow_calc(a) - pow_calc(b) == x){
                cout << a << " " << b << endl;
                return 0;
            }
            b--;
        }

        a++;
    }

    
 
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(998244353)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e18 + 3)
template<class T> bool chmax(T &a,  T b) {if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a,  T b) {if(a>b){a=b; return 1;} return 0;}
bool Add(int &a,int b){a = (a + b) % MOD;}
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}


llong bek(llong a,llong x){
    llong res = 1;
    llong tmp = a;
    while(x > 0){
        if(x & 1) res *= tmp; res %= MOD;
        tmp *= tmp;
        tmp %= MOD;
        x >>=1;
    }
    return res;
}

signed main(){
    int n;
    cin >> n;
    int zentai = 1;
    REP(i,n){
        zentai *= 3;
        zentai %= MOD;
    }
    int beki = 1;
    REP(i,n/2){
        beki *= 2;
        beki %= MOD;
    }


    int hidari, migi;
    hidari = 1;
    migi = 0;
    int ans = 0;
    int beki2 = 1;
    int gyaku2 = bek(2,MOD - 2);
    FOR(i,1,n / 2 + 1){
        int huga = hidari * beki2;
        huga %= MOD;
        migi += huga;
        migi %= MOD;

        beki2 *= 2;
        beki2 %= MOD;

        hidari *= n / 2 + 1 - i;
        hidari %= MOD;
        hidari *= bek(i,MOD - 2);
        hidari %= MOD;
       
        beki *= gyaku2;
        beki %= MOD;
        int hoge = migi * hidari;
        hoge %= MOD;
        hoge *= beki;
        hoge %= MOD;
        ans += hoge;
        ans %= MOD;
    }

    cout << (zentai + 2 * MOD - 2 * ans ) % MOD << endl;


}

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


int main() {
    long long int n, k;
    cin >> n >> k;
    long long int p[n];
    long long int sum[n+1];
    for(int i=0; i<n; i++)cin >> p[i];
    sum[0] = 0;
    for(int i=0; i<n; i++)sum[i+1] = sum[i]+p[i];
    long long int max = 0;
    for(int i=0; i<=n-k; i++){
        long long val = sum[k+i] - sum[i];
        if (max < val) max = val;
    }
    double ans = ((max + k) / 2.0);
    printf("%.16f", ans);
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  int n;
  scanf("%d",&n);
  ll d[n];
  ll sum=0;
  for(int i=0;i<n;i++){
    ll a;
    scanf("%lld",&a);
    sum+=a;
    d[i]=a;
  }
  ll x=0;
  int k=1;
  for(int i=0;i<n;i++){
    x+=(k*d[i]);
    k*=-1;
  }
  cout<<x<<" ";
  for(int i=0;i<n-1;i++){
    x=d[i]-x/2;
    x*=2;
    cout<<x<<" ";
  }
  
} 

Measured memory_bytes: 2048
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


X = I()

print('Yes' if X >= 30 else 'No')

Measured memory_bytes: 61912
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  string s;
  cin >> s;
  int n=s.size();
  int a[n]={};
  bool R=true;
  int start=0;
  int midR=0;
  int cnt[2]={};
  for(int i=0;i<n;i++){
    if(!R && s[i]=='L'){
      cnt[(i-start)%2]++;
      R=false;
    }
    if(R && s[i]=='R'){
      cnt[(i-start)%2]++;
    }
    if(R && s[i]=='L'){
      cnt[(i-start)%2]++;
      midR=i;
      R=false;
    }
    if(!R && (s[i]=='R' || i==n-1)){
      a[midR]=cnt[(midR-start)%2];
      a[midR-1]=cnt[(midR-start+1)%2];
      start=i;
      cnt[0]=1;
      cnt[1]=0;
      R=true;
    }
  }
  for(int i=0;i<n;i++){
    cout << a[i] << ' ';
  }
  cout << endl;
return 0;}

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


long long int **dp;


long long int score(long long int a[],long long int low,long long int high)
{
	if(dp[low][high])
		return dp[low][high];
	if(low==high)
	{
		dp[low][high]= a[low];
		return dp[low][high];
	}
	else if(low+1==high)
	{
		dp[low][high]= max(a[low],a[high]);
		return dp[low][high];
	}
	
	
	long long int x=0,y=0;
	x=(a[low]+min(score(a,low+2,high),score(a,low+1,high-1)));
	y=(a[high]+min(score(a,low+1,high-1),score(a,low,high-2)));
	dp[low][high]= max(x,y);
	return dp[low][high];
}



int main()
{
	long long int n,i,j;
	cin>>n;
	long long int a[n],sum=0;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	dp=new long long int* [n];
	for(i=0;i<n;i++)
		dp[i]=new long long int [n];
	
	cout<<2*score(a,0,n-1)-sum;
	
	
	
}

Measured memory_bytes: 46592
from collections import deque
k = int(input())
lst = []
cnt = 0
Q = deque()
for i in range(1,10):
    Q.append(str(i))
while cnt < k:
    s = Q.popleft()
    x = int(s[-1])
    lst.append(int(s))
    cnt += 1
    if x != 0:
        Q.append(s+str(x-1))
    Q.append(s+str(x))
    if x != 9:
        Q.append(s+str(x+1))

lst.sort()
print(lst[k-1])

Measured memory_bytes: 74588
//   __                    .__              ________ .________ ________   ______  
//  |  | __  ____    ______|  |__   __ __  /  _____/ |   ____//   __   \ /  __  \ 
//  |  |/ /_/ __ \  /  ___/|  |  \ |  |  \/   __  \  |____  \ \____    / >      < 
//  |    < \  ___/  \___ \ |   Y  \|  |  /\  |__\  \ /       \   /    / /   --   \
//  |__|_ \ \___  >/____  >|___|  /|____/  \_____  //______  /  /____/  \______  /
//       \/     \/      \/      \/               \/        \/                  \/ 

#include<bits/stdc++.h>
#define range 100005
#define mod 1000000007
#define eps 1e-9
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define _ <<" "<<

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;
typedef vector<iii> viii;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//freopen("test.txt","r",stdin);
	int a,b;
	cin>>a>>b;
	int numof = 0 ;
	int count = 1;
	while(count<b){
		count-=1;
		count+=a;
		numof+=1;
	}
	cout<<numof;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>

#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;


const int mod = 1000000007;
int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	vector<vector<long long int>> v(n, vector<long long int> (61, 0));
	for (int i = 0; i < n; i++) {
		long long int t;
		cin >> t;
		for (int j = 0; j < 61; j++) {
			v[i][j] += t % 2;
			t /= 2;
		}
	}
	long long int res = 0;
	long long int base = 1;
	for (int i = 0; i < 61; i++) {
		long long int c = 0;
		long long int ones = 0;
		long long int zeros = 0;
		for (int j = 0; j < n; j++) {
			if (v[j][i] == 1) {
				ones++;
				c += zeros;
			}
			else {
				c += ones;
				zeros++;
			}
			c %= mod;
		}
		// cout << c << " ";
		c %= mod;
		res += c * base % mod;
		res %= mod;
		base *= 2;
		base %= mod;
	}
	cout << res << endl;
}


Measured memory_bytes: 154624
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    menu = [int(input()) for _ in range(5)]

    ans = 0
    min_m = 10
    for m in menu:
        ans += (m + 9) // 10 * 10
        if m % 10 > 0:
            min_m = min(min_m, m % 10)
    if min_m > 0:
        ans += min_m - 10
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
using namespace std;

const long long mod = 1e9 + 7;

long long r1, r2, c1, c2;

long long power(long long m, long long k) {
	m %= mod;
	int res = 1;
	while (k) {
		if (k & 1) res = res * m % mod;
		m = m * m % mod;
		k >>= 1;
	}
	return res;
}

long long check(long long n, long long m) {
	if (n < m)
		return 0;

	long long res = 1;
	for (int i = 1; i <= m; i++)
		res = res * (n - i + 1) % mod * power(i, mod - 2) % mod;
	return res;
}

int main() {
	cin >> r1 >> c1 >> r2 >> c2;

	r2++, c2++;
	cout << (((check(r2 + c2, c2) - check(r1 + c2, c2) - check(r2 + c1, c1) + check(r1 + c1, c1)) % mod + mod) % mod) << endl;

	return 0;
}


Measured memory_bytes: 256
A,B,C = map(int,input().split())

if A == 5 or A == 7:
  if B == 5 or B == 7:
    if C == 5 or C == 7:
      if A + B + C == 17:
        print('YES')
      else:
        print('NO')
    else:
      print('NO')
  else:
  	print('NO')
else:
  print('NO')

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int t;
  t=1;
  while(t--){
  long long r,l,n,i,c=0;
  cin>>l>>r>>n;
  for(i=l;i<=r;i++)
  {
    if(i%n==0)
    {
      c++;
    }
  }
  cout<<c<<endl;
  }

}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
typedef long long ll;
typedef pair<int, int> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll MOD = 1000000007;
int INF = 1001001001;

void solve()
{
    int n; cin >> n;
    int ans = INF;
    reps(a, n/2)
    {
        int b = n - a;
        string as = to_string(a);
        string bs = to_string(b);
        int tmp = 0;
        rep(i, sz(as))tmp += as[i]-'0';
        rep(i, sz(bs))tmp += bs[i]-'0';
        chmin(ans, tmp);
    }
    cout << ans << endl;
    return;
}

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


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int X1,X2,X3,X4,X5;
   scanf("%d %d %d %d %d",&X1,&X2,&X3,&X4,&X5);
   if(X1==0)
   printf("%d\n",1);
   else if(X2==0)
   printf("%d\n",2);
   else if(X3==0)
   printf("%d\n",3);
   else if(X4==0)
   printf("%d\n",4);
   else if(X5==0)
   printf("%d\n",5);
   return 0;
}


Measured memory_bytes: 1700
//#include <bits/stdc++.h>
#include<iostream>
#include <iosfwd>
#include<limits.h>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <limits>
#include<stdio.h>
#include <queue>
#include <stack>
#include <math.h>
#include<string.h>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include<vector>
#include <chrono>
#include <random>
using namespace std;
using namespace std::chrono;
#define fr(i,j,n)   for(lli i=j;i<(n);++i)
#define bk(i,j,n)   for(lli i=j;i>=n;--i)
#define pb push_back
#define m_p make_pair
#define Fs first
#define Sc second
#define endl "\n"
#define MOD 2147483647
#define present(c,x)    ((c).find(x) != (c).end())
#define run ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update>
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define mem(p,v) memset(p,(lli)v,sizeof p);
#define ub upper_bound
#define lb lower_bound
typedef long long int lli;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<lli> vl;
typedef pair<lli,lli> pl;
inline lli max(lli a,lli b){ return a>b?a:b;}
inline lli min(lli a,lli b){ return a<b?a:b;}
void show(vector<lli> v)
{
    fr(i,0,v.size())
    cout<<v[i]<<" ";
    cout<<endl;
}
void show(vector<int> v)
{
    fr(i,0,v.size())
    cout<<v[i]<<" ";
    cout<<endl;
}
void show(int a[], int arraysize)
{
    for (int i = 0; i < arraysize; ++i)
        cout << a[i] << " ";
    cout<<endl;
}
void show(lli a[], lli arraysize)
{
    for (lli i = 0; i < arraysize; ++i)
        cout << a[i] << " ";
    cout<<endl;
}
void show(unordered_set<int> s)
{
    for (auto it = s.begin(); it != s.end(); it++)
    {
        cout << *it << " ";
    }
    cout<<endl;
}
void show(unordered_map<int,int> mp)
{
    for (auto it = mp.begin(); it != mp.end(); it++)
    {
        cout << it->first << " "<<it->second<<endl;
    }
    cout<<endl;
}
int main()
{
    lli t,n,m;
    t=1;
    while(t)
    {
        char c;
        cin>>c;
        if(c>='a'&&c<='z')
        {
            cout<<"a"<<endl;
        }
        else
            cout<<"A"<<endl;
        t--;
    }
    return 0;
}





Measured memory_bytes: 3636
import java.io.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n,m,x;
		n = s.nextInt();
		m = s.nextInt();
		x = s.nextInt();
		int [][] cost = new int[n][m+1];
		for(int i=0;i<cost.length;i++) {
			for(int j=0;j<m+1;j++) {
				cost[i][j] = s.nextInt();
			}
		}
		int global_min = Integer.MAX_VALUE;
		
		for(int mask = 0; mask<1<<n; mask++) {
			int [] understanding = new int[m];
			int sum = 0;
			for(int i=0;i<cost.length;i++) {
				int bit = 1<<i;
				if((mask & bit)!=0) {
					sum+=cost[i][0];
					for(int j=0;j<m;j++) {
						understanding[j] += cost[i][j+1];
					}
				}
			}
			boolean flag = true;
			for(int a:understanding) {
				if(a<x) {
					flag = false;
				}
			}
			if(flag) {
				global_min = Math.min(global_min, sum);
			}
		}
		if(global_min==Integer.MAX_VALUE) {
			System.out.println(-1);
		}
		else {
		System.out.println(global_min);
		}

	}

}


Measured memory_bytes: 37364
from fractions import gcd
N,K=map(int,input().split(' '))
A=sorted(list(map(int,input().split(' '))))
G=A[0]
for i in A[1:]:
    G=gcd(G,i)
if A[-1] >= K and K%G==0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 16296
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		if((1 <= A) && (A <= 9) && (1 <= B) && (B <= 9)) {
			System.out.println(A * B);
		}else {
			System.out.println(-1);
		}
		sc.close();
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1000000000;
const long INF64 = 1000000000000000ll;
const int MOD = 1000000007;
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
int main(){
	string s;
	std::cin >> s;
	int le=s.size();
	int counter=0;
	rep(i,le-1)if(s[i]!=s[i+1])counter++;
	std::cout << counter << std::endl;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main()
{ 
int a,b,c,d,e,f,g,h,i,j,k,l,m,n;
cin >> a >> b;
c = a%10;
d = (a%100-a%10);
e = (a%1000-a%100);
f = (a%10000-a%1000);
g = (a%100000-a%10000);
h = b%10;
i = (b%100-b%10);
j = (b%1000-b%100);
k = (b%10000-b%1000);
l = (b%100000-b%10000);
if(g+f+e+f/100+g/10000-a >=0){m=(g+f+e)/100-100;}
else{m=(g+f+e)/100-99;}
if(b-(l+k+j+k/100+l/10000) <0){n=1000-(l+k+j)/100;}
else{n=999-(l+k+j)/100;}
printf ("%d",900-m-n);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

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

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文

int main() {
	int n;
	cin >> n;
	if (n % 2 == 0) dump(n) else dump(n * 2);
}


Measured memory_bytes: 256
S = input()
for i in range(1, len(S)+1):
    tmp_S = S[:-i]
    if len(tmp_S) % 2 != 0:
        continue
    center = int(len(tmp_S) / 2)
    if tmp_S[:center] == tmp_S[center:]:
        print(len(tmp_S))
        break

Measured memory_bytes: 9112
while True:
    HW = input()
    H, W = map(int, HW.split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        if i % 2 == 0:
            if W % 2 == 0:
                print('#.' * (W // 2))
            else:
                print('#.' * (W // 2) + '#')
        else:
            if W % 2 == 0:
                print('.#' * (W // 2))
            else:
                print('.#' * (W // 2) + '.')
    print()


Measured memory_bytes: 5612
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    string S[200010];
    rep(i,0,N) cin >> S[i];
    map<string,ll> mp;
    rep(i,0,N) mp[S[i]]++;
    print(mp.size());
    

}

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

///////////////////////////////////////////
const long long int INF = 1000000000000000000LL;
using ll = long long int;
using vi = vector<int>;
using Vi = vector<long long int>;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return 1; } return 0; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return 1; } return 0; }
template<class T>T sqar(T x){ return x*x; }
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
///////////////////////////////////////////

int main(){
    int num;cin>>num;
    bool xxx = false;
    rep(i,26){
        if((num-4*i)<0)continue;
        if((num-4*i)%7==0){
            xxx=true;
           // cout<<i<<endl;
        }
    }
    if(xxx){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}












Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n,k;
    cin>>n>>k;
    vector<int> a(200001);
    int cnt=0,m;
    rep(i,n){
        cin>>m;
        a[m]++;
        if(a[m]==1) cnt++;
    }
    sort(all(a));
    int ans=0,i=0;
    rep(i,200001){
        if(cnt<=k) break;
        if(a[i]!=0){
            ans+=a[i];
            cnt--;
        }
    }
    cout<<ans;
}

Measured memory_bytes: 4048
//is there any case of -1 or any special corner cases ?
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define all(v) v.begin(),v.end()
#define zeros(arr) memset(arr,0,sizeof(arr));
#define precise(num)  cout<<fixed; cout << std::setprecision(num)
#define nl cout<<"\n";
#define test int t;cin>>t;while(t--) 
const int maxx  = 1e6+1 , limit = 9*1e18 , MOD=1e9+7;
string binary(int n){bitset<60>b(n) ;string p =b.to_string();return p;}
int decimal(string n) { int dec_value = 0;  int base = 1;  for (int i = n.size() - 1; i >= 0; i--) { if (n[i] == '1') 
dec_value += base; base = base * 2; } return dec_value; } 
bool isPrime(int n){if (n <= 1) return false; if (n <= 3) return true;if (n % 2 == 0 || n % 3 == 0) return false;
for (int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; }
int pow (int x, int n,int mod) {if (n == 0) return 1; int res = pow (x, n / 2,mod);res = (res * res) % mod;if (n % 2) res = (res * x ) % mod;return res;}

#define boost  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n';

int32_t main(){
    int x,n;
    cin>>x>>n;
    int cn[1000];
    zeros(cn);
    for(int i = 0 ; i < n; i++ ){
        int x1;cin>>x1;
        cn[x1]++;
    }
    
    int res = 1;
    int minn =1e9 ;
    for(int i=-10 ; i <=1000 ; i++ ){
        if(cn[i] == 0){
            int val = abs(i-x);
            if(val < minn){
                minn = val;
                res=i;
            }
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
                Out.Flush();
            }
        }
    }

    public class Solve
    {
        static List<string> lis = new List<string>();
        static long N;

        public static void Answer()
        {
            var s = ReadLine();
            int ng = s.Where(c => c == 'x').Count();
            IO.WriteLineYES_or_NO(ng < 8);
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

Measured memory_bytes: 18504
A = []
while True:
  e = list(map(int,input().split()))
  if e == [0,0]:
    break
  A.append(e)

for [n,x] in A:
  c=0
  for i in range(n):
    rem = x-i-1
    for j in range(n-i):
      if j+i+3 <= rem-(j+i+2) <=n:
        c +=1
  print(c)


Measured memory_bytes: 5600
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
ans = 0

for bit in range(60):
    m = 1 << bit
    # bit桁目のbitが立っている時の数
    c = sum(a&m for a in A) >> bit
    # bit桁目の1の合計
    ans += (c*(N-c))<<bit
    # 繰り上がりのない足し算
    ans %= mod
print(ans)

Measured memory_bytes: 118396
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

typedef priority_queue<int,vector<int>,greater<int>> minpq;

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    int a[n], best = 1000000000;
    for (auto &ai:a) cin >> ai;
    for (size_t t=0; t<n; t++) {
        int y = a[t];
        minpq chosen;
        for (int i=0; i<n; i++) {
            minpq buf;
            for ( ; y <= a[i] && i < n; i++)
                if (i != (int)t)
                    buf.push(a[i]);
            int len = (int)buf.size();
            for (int j=0; j<len-k+1; j++) {
                chosen.push(buf.top());
                buf.pop();
            }
        }
        int x = y;
        for (int i=0; i<q-1; i++) {
            if (chosen.empty()) {
                x = -1;
                break;
            } else {
                x = chosen.top();
                chosen.pop();
            }
        }
        if (x != -1)
            best = min(best, x-y);
    }
    cout << best << '\n';
    return 0;
}

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

typedef struct{
	char m;
	int num;
	int index;
}card;

int partition(card A[], int p, int r);
void quicksort(card A[], int p, int r);
int isStable(card A[], int n);

int partition(card A[], int p, int r){
	int i,x,j;
	card tmp;

	x = A[r].num;
	i = p-1;

	for (j = p; j <= r; j++) {
		if (A[j].num <= x) {
			i++;
			tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
		}
	}
	return i;
}

void quicksort(card A[], int p, int r){
	int q;
	if (p < r) {
		q = partition(A, p, r);
		quicksort(A, p, q - 1);
		quicksort(A, q + 1, r);

	}
}

int isStable(card A[], int n)
{
	int i;
	for (i = 0; i < n - 1; i++) {
		if (A[i].num == A[i + 1].num&&A[i].index > A[i + 1].index) return 0;
	}
	return 1;
}

int main() {
	int r, n, i;

	card *Card;
	Card = (card *)malloc(sizeof(card) * 100000);

	scanf("%d", &n);
	r = n-1;

	for (i = 0; i < n; i++) { scanf("%1s %d", &Card[i].m, &Card[i].num); Card[i].index = i; }
	quicksort(Card, 0, r);
	if (isStable(Card,n))puts("Stable"); else puts("Not stable");

	for (i=0; i < n; i++) {
    printf("%c %d\n", Card[i].m,Card[i].num);
  }
  
	free(Card);

  return 0;
}



Measured memory_bytes: 2520
#include <bits/stdc++.h>
using namespace std;
#define null NULL
#define mp make_pair
#define pb(a) push_back(a)
#define sz(a) ((int)(a).size())
#define all(a) a.begin() , a.end()
#define fi first
#define se second
#define relaxMin(a , b) (a) = min((a),(b))
#define relaxMax(a , b) (a) = max((a),(b))
#define SQR(a) ((a)*(a))
#define PI 3.14159265358979323846
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

int n;
vector<pii> in;
vi out;

int GetIdx(int pos, int bad){
  if(bad > pos) return pos;
  else return pos - 1;
}

int main(){
  scanf("%d", &n);
  in.resize(n);
  out.resize(n);

  for(int i = 0;i < n;++i) in[i].se = i;
  for(auto& e : in) scanf("%d", &e.fi);

  sort(all(in));

  int mid = (n - 1) / 2;
  for(int i = 0;i < n;++i){
    for(int j = max(0, mid - 10);j < min(n, mid + 10);++j)
      if(j != i && GetIdx(j, i) == mid)
       out[in[i].se] = in[j].fi;
  }

  for(int i = 0;i < n;++i)
    printf("%d\n", out[i]);

  return 0;
}


Measured memory_bytes: 4480
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    long long A,V,B,W,T;
    cin>>A>>V>>B>>W>>T;
    if(W>=V){
        cout << "NO" << endl;
        return 0;
    }
    long long dist = abs(A-B);
    long long sp = V-W;
    if(sp*T>=dist){
        cout << "YES" << endl;
        return 0;
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        string s0 = Console.ReadLine();
        string s1 = Console.ReadLine();
        string s2 = Console.ReadLine();
        Console.WriteLine("" + s0[0] + s1[1] + s2[2]);
    }

}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int LCM(int a, int b)
    {
        int c = a * b;
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int Cin()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
}


Measured memory_bytes: 9044
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
#define REP(i,n)for(int i=0;i<(int)n;++i)
int main(){int n;while(cin>>n,n){int a[n+1];a[0]=0;REP(i,n)cin>>a[i+1];double b,r,v,e,f,tt[10001];cin>>b>>r>>v>>e>>f;tt[0]=0;REP(x,10001)tt[x+1]=tt[x]+1/(v-(x>=r?e*(x-r):f*(r-x)));vector<double>dp(n+1,1<<29);dp[0]=0;REP(i,n)for(int j=i+1;j<n+1;++j)dp[j]=min(dp[j],dp[i]+tt[a[j]-a[i]]+(i?b:0));printf("%.12f\n",dp[n]);}}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
#define PI 3.14159265358979323846264338327950L;
const int INF2 = 1001001001;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;


int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

	int find(int x)
	{
		if (par[x] == x)return x;
		else return find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};

const int MAX_N = 110000;

int memo[MAX_N];

int rec(int n) {
	if (n == 0)return 0;
	if (memo[n] != -1)return memo[n];

	int res = n;

	for (int pow6 = 1; pow6 <= n; pow6 *= 6)res = min(res, rec(n - pow6) + 1);

	for (int pow9 = 1; pow9 <= n; pow9 *= 9)res = min(res, rec(n - pow9) + 1);

	return memo[n] = res;
}

int calc(int x) {
	int ret = 0;
	while (x % 2 == 0) {
		x /= 2;
		ret++;
	}

	return ret;
}

int a[12][12];
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;

	cin >> n;

	int ans = n % 10;

	switch (ans) {
		case 2:
		case 4:
		case 5:
		case 7:
		case 9:
			cout << "hon" << endl;
			break;
		case 0:
		case 1:
		case 6:
		case 8:
			cout << "pon" << endl;
			break;
		case 3:
			cout << "bon" << endl;
			break;


	}
	
	

	
		
	



}
	

Measured memory_bytes: 3660
n,m = map(int,input().split())
a = []
b = []
for i in range(n):
    a.append(input())
for i in range(m):
    b.append(input())
OKFlag = False

#起点を管理するループ
for i in range(n * n):
    startRow,startColumn = divmod(i,n)
    maxRow,maxColumn = startRow + (m - 1),startColumn + (m - 1)
    if maxRow <= (n - 1) and maxColumn <= (n - 1):

        for j in range(m * m):
            moveRow,moveColumn = divmod(j,m)
        
            if a[startRow + moveRow][startColumn + moveColumn] == b[moveRow][moveColumn]:
                if moveRow == (m - 1) and moveColumn == (m - 1):
                    OKFlag = True
                continue
            else:
                break
    else:
        continue

print("Yes" if OKFlag else "No")

Measured memory_bytes: 3064
// D.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <cstdio>


using lolo=long long;
using namespace std;
using vec=vector<lolo>;
using vvec=vector<vec>;
using vecb=vector<bool>;
#define FOR(i,n) for (lolo i=0; i<n; ++i)
#define FORN(i,a,b) for (lolo i=a; i<b; ++i)
#define REV(i,a,b) for (lolo i=a; i>b; --i)
#define ALL(x) x.begin(), x.end()

int main()
{
	lolo N;
	cin >> N;
	//vec U(N-1), V(N - 1), W(N - 1);
	//vvec Childs(N+1);
	vector<vector<  pair<lolo,lolo> > > Childs(N + 1);
	FOR(i, N - 1)
	{
		lolo u, v, w;
		cin >> u >> v >> w;
		if ( u > v )
			swap(u, v);
		Childs[u].push_back(make_pair(v, w));
		Childs[v].push_back(make_pair(u, w));
	}
	queue<pair<lolo,lolo>> q;// iver, color
	q.push(make_pair(1,0));
	vec Ans(N+1, -1);
	vector<bool> visited(N + 1, false);
	while ( !q.empty() )
	{
		auto v = q.front();
		q.pop();

		Ans[v.first] = v.second;
		visited[v.first] = true;

		auto vchild = Childs[v.first];
		for ( auto c : vchild )
		{
			if ( visited[c.first] ) continue;

			if ( c.second % 2 == 1 )
			{
				q.push(make_pair(c.first, static_cast<lolo>(!v.second)));

			} else
			{
				q.push(make_pair(c.first, static_cast<lolo>(v.second)));

			}
		}
	}
	FORN(i, 1, N + 1)
	{
		cout << Ans[i] << endl;
	}
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 8704
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <cassert>
#include <vector>
#include <array>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <numeric>
#define ALL(c) (c).begin(), (c).end()
using ll = long long;
using namespace std;
using pii = pair<int, int>;
using pdi = pair<double, int>;

int N, K;
vector<int> a;

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++)
	{
		int tmpa;
		cin >> tmpa;
		a.push_back(tmpa);
	}

	vector<ll> b;
	for (int i = 0; i < N; i++)
	{
		ll tmpb = 0;
		for (int j = i; j < N; j++)
		{
			tmpb += a[j];
			b.push_back(tmpb);
		}
	}

	const int m = 40;
	vector<vector<bool>> boola(N*(N + 1) / 2, vector<bool>(m, 0));
	for (int i = 0; i < N*(N + 1) / 2; i++)
	{
		ll tmpa = b[i];
		for (int j = 0; j < m; j++)
		{
			boola[i][j] = tmpa & 1;
			tmpa = tmpa >> 1;
		}
	}

	unordered_set<int> us;
	for (int i = 0; i < N * (N + 1) / 2; i++)
	{
		us.insert(i);
	}
	vector<bool> boolans(40);
	for (int j = m - 1; j >= 0; j--)
	{
		unordered_set<int> tmpus;
		int cnt = 0;
		for (const int &i : us) {
			if (boola[i][j]) {
				cnt++;
				tmpus.insert(i);
			}
		}
		if (cnt >= K) {
			boolans[j] = true;
			us = tmpus;
		}
		else {
			boolans[j] = false;
		}
	}

	ll ans = 0;
	for (int j = m - 1; j >= 0; j--)
	{
		ans *= 2;
		if (boolans[j]) {
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}


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

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

    int ans=0;
    ans += max(a, b);
    if(a>b) a--;
    else b--;
    ans += max(a, b);
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 256