akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);  cin.tie(0) ; cout.tie(0);
#define debug(x) cout << #x << " : " << x << endl;
#define pi 3.14159265359
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
using ll = long long int;
using db = double;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
const int MOD = 1e9+9;

void solve()
{
    string a , b;
     cin >> a >> b;
     int c = 0;
     for(int i = 0 ; i < a.size();i++)
     {
         if(a[i] != b[i])
            c++;
     }
     cout << c<< endl;
    
}

int main()
{
    fastio;

    // ll t;
    // cin >> t;
    // while(t--)
       solve();
    return 0;
}

Measured memory_bytes: 3800
#include<bits/stdc++.h>
 
#define mp make_pair
#define pb push_back
#define f first
#define s second 
#define sz(s) (int)s.size()
#define int long long
#define all(s) s.begin(), s.end()
#define forn(i, x, y) for(int i = x; i <= y; i++)
#define forev(i, y, x) for(int i = y; i >= x; i--)
 
using namespace std;
 
const int maxn = (int)2e5 + 100;
const int mod = (int)1e9 + 7;
const int P = (int)1e6 + 7;
const int inf = (int)1e9 + 7;
 
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef long double ld;
 
int n, m, ans;
set<int> can;
pii a[maxn];
main () {
    cin >> n >> m;
    forn(i, 1, n) cin >> a[i].s >> a[i].f;
    sort(a + 1, a + n + 1);
    reverse(a + 1, a + n + 1);
    forn(i, 0, m) can.insert(i);
    forn(i, 1, n){
        auto it = can.upper_bound(m - a[i].s);
        if(it == can.begin()) continue;
        --it;
        can.erase(it);
        ans += a[i].f;
    }
    cout << ans;
}

Measured memory_bytes: 6528
s=input()
t=input()

if len(s) < len(t):
  print("UNRESTORABLE")
  exit()

c=len(s)-len(t)

flg=False
while True:
  if c<0:
    break
  
  flg2=True
  for i in range(len(t)):
    if s[c+i]!=t[i] and s[c+i]!="?":
      flg2=False
  if flg2:
    flg=True
    break
  c-=1
#print(c)



if flg:
  print((s[:c]+t+s[c+len(t):]).replace("?","a"))
else:
  print("UNRESTORABLE")


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 1005;
int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n,a[105],b[105],ans=0;
	cin>>n;
	for(int i=1;i<=n-1;i++) cin>>a[i];
	b[1]=a[1];
	b[2]=a[1];
	for(int i=2;i<n;i++)
	{
		b[i]=min(b[i],a[i]);
		b[i+1]=max(b[i],a[i]);
	}
	for(int i=1;i<=n;i++) ans+=b[i];
	cout<<ans<<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;
typedef long long ll;

int main(){
    int s;cin >> s;
    int ans =0;

    rep(i,3){
        if(s%10 ==1){
            ans++;
        }
        s/=10;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for( int i=a; i<b; i++ )
#define REP(i,n) rep(i,0,n)
 
 
void displayVector(vector<string> v)
{
	int n = v.size();
	REP(i,n){
		cout << v[i] << " " ;
	}
	cout << endl;
}
 
int main(){
	double a,b,h,m;
	cin >> a >> b >> h >> m;
	double gamma_deg = abs(30*h+0.5*m - 6*m);
	// if(gamma_deg>180.0){ gamma_deg-=180.0;}
	double gamma = gamma_deg * M_PI / 180.0;
	double c = sqrt( a*a + b*b - 2*a*b*cos(gamma) );
	cout << std::setprecision(10) << c << endl;
	return 0;
}

Measured memory_bytes: 4216
import sys

input = sys.stdin.readline

def main():
    ans = []
    N = int(input())
    for i in range(1, int(N**0.5)+1):
        if N%i == 0:
            ans.append(i+N//i-2)
    print(min(ans))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <set>

using namespace std;

typedef long long ll;

ll n;
ll ans;
multiset<ll> se;

int main()
{
    scanf("%lld", &n);
    for(ll i = 0; i < n; i++)
    {
        ll t;
        scanf("%lld", &t);
        se.insert(t);
    }
    while(!se.empty()) {
        ll x = *se.rbegin();
        ll y;
        auto t = se.find(x);
        se.erase(t);
        for(ll i = 32; i >= 0; i--)
        {
            if((1 << i) > x) y = (1 << i) - x;
        }
        auto t2 = se.find(y);
        if(t2 != se.end()) se.erase(t2), ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 9600
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <random>
#include <tuple>
#include <iomanip>
#include <cstring>

using namespace std;

typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n-1); i >= 0; i--)
#define pb push_back
#define f first
#define s second
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD  = 998244353;
vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};

ll kai_mod(ll x){
  if(x == 0) return 1;
  return x * kai_mod(x-1) % MOD;
}

/*
//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}
*/
int main(){
  ll N;
  cin >> N;
  vector<pair<ll, ll>> A;
  rep(i, N){
    ll a;
    cin >> a;
    A.pb({a, 1});
  }
  rep(i, N){
    ll a;
    cin >> a;
    A.pb({a, 2});
  }
  sort(A.begin(), A.end());
  ll ans = 1;
  ll p = 0, d = 0;
  rep(i, 2 * N){
    if(A[i].s == 1){
      if(p != 0){
        ans *= p;
        ans %= MOD;
        p--;
      }else{
        d++;
      }
    }else{
      if(d != 0){
        ans *= d;
        ans %= MOD;
        d--;
      }else{
        p++;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 6512
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define MOD 1000000007
#define pb push_back
#define cy cout<<"Yes\n"
#define cn cout<<"No\n"
typedef unsigned long long int ull;
typedef long long int ll;

int a[500005];
const int M=1e4;
ll cnt[M];
int main()
{
    int n,m,a,b,c,x,y;
    ll sum,ans=0;
    sum=0;
    string s;
    cin>>s;
    for(int i=0;i<3;i++)
    {
        if(s[i]=='R')
        {
            ans++;
        }
        else
            ans=0;
        sum=max(ans,sum);
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3544
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
const int INF = 1e9 + 5;
bool comp(const int a , const int b) {
	return a < b;
}
int main() {
	int n,k;
	cin>>n;
	vector<int> dp[2];
	dp[0].resize(3);
	dp[1].resize(3);
	for(int i=1;i<=n;i++) {
		int a, b, c;
		cin>>a>>b>>c;
		dp[i&1][0] = max(dp[(i-1)&1][1], dp[(i-1)&1][2]) + a;
		dp[i&1][1] = max(dp[(i-1)&1][0], dp[(i-1)&1][2]) + b;
		dp[i&1][2] = max(dp[(i-1)&1][0], dp[(i-1)&1][1]) + c;
	}
	int ans = max(max(dp[n&1][0], dp[n&1][1]),dp[n&1][2]);
	cout<<ans<<endl; 
	return 0;
}

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

const int MAX_N = 100;
int N;
int L[MAX_N];

void solve();

int main(){

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

    solve();

    return 0;
}

void solve(){

    int ans = 0;

    std::sort(L, L + N);

    for(int i=0; i<N-2; i++){
        for(int j = i+1; j<N-1; j++){
            if(L[i] == L[j]){
                continue;
            }
            for(int k = j+1; k<N; k++){
                if(L[i]==L[k] || L[j] ==L[k]){
                    continue;
                }
                if(L[i] + L[j] > L[k]){
                    ans++;
                }

            }
        }
    }

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

}

Measured memory_bytes: 1724
#include<iostream>
//#include <bits/stdc++.h>
using namespace std;
#include<algorithm>
#include<map>
#include<vector>
#include <iomanip>
#include <set>
#include<cmath>
#define F first
#define S second
#define pii pair<int,int>
#define pb push_back
#define ll long long
#define mp make_pair
void sp(double y,int x){cout<<fixed<<setprecision(x)<<y;}
int inf=1e9+10;
int const M=2e5+10;
int const M2=1e6+10;
int const M3=1e3+10;
int mod=1e9+7;
int sa(int x,int y){if(x%y==0)return x/y;return x/y+1;}
int binp(int x,int y){int ans=1;int t=x;while(y!=0){if(y%2==1){ans*=t;ans;}y/=2;t*=t;t;}return ans;}
int main(){
	ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
	int n;
	cin>>n;
	int tmp=1;
	while(tmp*2<=n)
        tmp*=2;
    cout<<tmp;
}


Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, atan2
from operator import mul
from functools import reduce
sys.setrecursionlimit(10**8)

INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


def main():
    n = I()
    for i in range(1, 10):
        for j in range(1, 10):
            if i * j == n:
                return 'Yes'
    else:
        return 'No'



print(main())

Measured memory_bytes: 39664
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    int f = sc.nextInt();
    int maxA = 0;
    int maxB = 0;
    double max = 0;
    for(int i=0;i<=30;i++)
      for(int j=0;j<=30;j++)
        for(int k=0;k<=1000;k++)
          for(int l=0;l<=1000;l++){
            if(i+j==0)continue;
            int s = 100*a*i+100*b*j;
            int t = c*k+d*l;
            if((a*i+b*j)*e>=c*k+d*l&&s+t<=f){
              double per = (double)(100*t)/(s+t);
              if(per>=max){
                max = per;
                maxA = s+t;
                maxB = t;
              }
            }
          }
    System.out.println(maxA+" "+maxB);
  }
}

Measured memory_bytes: 21844
import sys
import numpy as np

n=int(sys.stdin.readline())
v=np.array(sys.stdin.readline().split(),dtype='int64')
v=np.sort(v)


for i in range(n):
    if i==0:
        ans=v[i]/(2**(n-i-1))
    else:
        ans+=v[i]/(2**(n-i))

print(ans)


Measured memory_bytes: 12504
#include<bits/stdc++.h>
#define MAX 17
#define inf 1<<29
#define linf (1e16)
#define eps (1e-5)
#define Eps (1e-12)
#define mod 1000000007
#define pi acos(-1.0)
#define phi (1.0+sqrt(5.0))/2.0
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define pld(a) printf("%.10Lf\n",(ld)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define Unique(v) v.erase(unique(all(v)),v.end())
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<pii> vpi;

class Point{
public:
  double x,y;
  Point(double x=0,double y=0):x(x),y(y){}

  Point operator+(Point p){ return Point(x+p.x,y+p.y);}
  Point operator-(Point p){ return Point(x-p.x,y-p.y);}
  Point operator*(double k){ return Point(x*k,y*k);}
  Point operator/(double k){ return Point(x/k,y/k);}
  bool operator<(Point p)const{ 
    return equals(x,p.x) ? y-p.y<-eps : x-p.x<-eps; }
  bool operator==(Point p)const{ 
    return fabs(x-p.x)<eps && fabs(y-p.y)<eps;}

  double abs(){ return sqrt(norm());}
  double norm(){ return (x*x+y*y);}
};
typedef Point Vector;
typedef vector<Point> Polygon;

class Segment{
public:
  Point p1,p2;
  Segment(Point p1=Point(),Point p2=Point()):p1(p1),p2(p2){}
};
typedef Segment Line;

double norm(Vector a){ return (a.x*a.x+a.y*a.y);}
double abs(Vector a){ return sqrt(norm(a));}
double dot(Vector a,Vector b){ return (a.x*b.x+a.y*b.y);}
double cross(Vector a,Vector b){ return (a.x*b.y-a.y*b.x);}

double getDistanceLP(Line l,Point p){
  return abs(cross(l.p2-l.p1,p-l.p1)/abs(l.p2-l.p1));
}

double getDistanceSP(Segment s,Point p){
  if(dot(s.p2-s.p1,p-s.p1)<-eps)return abs(p-s.p1);
  if(dot(s.p1-s.p2,p-s.p2)<-eps)return abs(p-s.p2);
  return getDistanceLP(s,p);
}

int n;
vector<Point> s,t;
double a[MAX];
bool dp[(1<<MAX)];

bool check(int bit,int i){
  Segment seg = Segment(s[i],t[i]);
  FOR(j,0,n){
    if(i==j)continue;
    if(bit & (1<<j)){
      if(getDistanceSP(seg,t[j])-(a[i]+a[j])<-eps)return false;
    }
    else {
      if(getDistanceSP(seg,s[j])-(a[i]+a[j])<-eps)return false;
    }
  }
  return true;
}

int solve(){
  fill(dp,dp+MAX,false);
  dp[0] = true;
  FOR(bit,0,1<<n){
    if(!dp[bit])continue;
    FOR(i,0,n){
      if(bit & (1<<i))continue;
      if(check(bit,i))dp[bit|(1<<i)] = true;
    }
  }
  int ans = 0;
  FOR(bit,0,1<<n)
    if(dp[bit])
      ans = max(ans,__builtin_popcount(bit));
  return ans;
}

int main()
{
  cin>>n;
  s.resize(n);
  t.resize(n);
  FOR(i,0,n){
    cin>>a[i];
    cin>>s[i].x>>s[i].y;
    cin>>t[i].x>>t[i].y;
  }
  cout<<solve()<<endl;
  return 0;
}


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

using namespace std;

#ifdef DGC
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
#define F first
#define S second



int main()
{
	#ifdef DGC
		//freopen("a.in", "r", stdin);
		//freopen("b.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	int n;
	cin >> n;
	vector<point> a(n);
	for (auto &i : a)
	{
		int x, y;
		cin >> x >> y;
		i = { x, y };
	}

	vector<int> p(n);
	iota(p.begin(), p.end(), 0);

	ld ans = 0;

	do
	{
		point last = a[p[0]];
		for (auto i : p) ans += abs(a[i]-last), last = a[i];
	} while (next_permutation(p.begin(), p.end()));

	for (int i = 1; i <= n; ++i)
		ans /= i;

	cout.precision(15);
	cout << fixed << ans << "\n";

	return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main(){

  int n,A[31],i,j;
  for(i=0;i<31;i++)A[i]=i;
  for(i=0;i<31;i++){
    scanf("%d",&n);
    for(j=0;j<31;j++)if(n==j)A[j]=0;
  }
  for(i=0;i<31;i++){
    if(A[i]!=0)printf("%d\n",A[i]);
		 }
  return 0;
}

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

int main() {
    int X, A, B;
    std::cin >> X >> A >> B;
    
    if (A-B >= 0) std::cout << "delicious" << std::endl;
    else if (B-A <= X) std::cout << "safe" << std::endl;
    else std::cout << "dangerous" << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
    string s;
    cin >> s;
    vector<int>abc(3);
    for(int i=0; i<s.size(); i++){
        if(s[i]=='a') abc[0]++;
        if(s[i]=='b') abc[1]++;
        if(s[i]=='c') abc[2]++;
    }
    sort(abc.begin(),abc.end());
    if(abc[2]-abc[0]<=1){
        puts("YES");
    }else{
        puts("NO");
    }
    return 0;
}

Measured memory_bytes: 3700
#include <stdio.h>
                                                                                                
  
int main(void){
                                                                                                
   
    long long n, x, i;
   
    long long a[100000];

    long long k = 0;
   
      
    scanf("%lld %lld", &n, &x );
   
    for( i = 0 ; i < n ; i = i + 1 ){
   
         scanf("%lld", &a[i] );

         }
   

    if( a[0] > x ){

           k = a[0] - x;

           a[0] = x;

           }


    for( i = 0 ; i < n - 1 ; i = i + 1 ){

         if( a[i+1] + a[i] > x ){

             k += a[i+1] + a[i] - x;

             a[i+1] += -( a[i+1] + a[i] - x );

             }

         }


    printf("%lld\n", k );


    return 0;
                                                          
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define PI 3.14159265359
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
const ll INF=1e9+7;
void input(ll *a,ll n){
    for(ll i=1;i<=n;i++)
        cin>>a[i];
}
ll lcm(ll a,ll b)
{
    return (a*b)/__gcd(a,b);
}
bool isprime(ll n){
    if(n==1){
        return false;
    }
    if(n==2 || n==3){
        return true;
    }
    for(ll i=2;i<=sqrt(n);i++){
        if(n%i==0)
            return false;
    }
    return true;
}

//ll x[100001]={0};
//ll p[100001]={0};
ll a[100001]={0};
//vector<pair<ll,ll> > adj[100001];
//ll dist[100001]={0};


void sieve(ll n,bool *a)
{
    for (ll p=2; p*p<=n; p++){
        if (!a[p]){
            for (ll i=p*p;i<=n;i+=p)
                a[i]=true;
        }
    }
}

ll fact(ll n){
    ll res=1;
    for(ll i=1;i<=n;i++)
        res*=i;
    return res;
}

/*ll distance(ll x1,ll y1,ll x2,ll y2){
    return (ll)ceil(sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)));
}*/

/*void dfs(ll curr,ll prev,ll weight,bool found){

    if(weight>n)
        return;

    for(u:adj[curr]){
        if(u.first!=prev){
            if(u.second==d || found)
                dfs(u.first,curr,weight+u.second,true);
            else
                dfs(u.first,curr,weight+u.second,false);
        }
    }
    cout<<weight<<" "<<found<<endl;
    if(weight==n && found){
        ans+=1;
        ans=ans%INF;
    }
}*/

void solve(){
    /*ll n,k;
    cin>>n>>k;
    input(a,n);
    vector<ll> v;
    ll j=1;
    v.push_back(1);
    for(ll i=0;i<n;i++){
        j=a[j];
        v.push_back(j);
    }

    for(x:v){
        cout<<x<<" ";
    }
    cout<<v[k%v.size()];*/

    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll cards=0;
    cards+=min(a,k);
    k-=min(a,k);

    if(k>0){
        k-=min(b,k);
    }
    if(k>0){
        cards-=min(k,c);
    }
    cout<<cards;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //sieve(100001,c);
    ll t=1;
    //cin>>t;
    for(ll i=0;i<t;i++){
        solve();
    }
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
 
using namespace std;
 
using i64 = long long;
#define forn(a, e) for (i64 a = 0; a < (i64)(e); a++)
#define forr(a, s, e) for (i64 a = s; a < (i64)(e); a++)
#define fore(e, a) for (auto& e : a)
 
#ifdef LOCAL
#define logv(a) {cerr << #a << " = "; fore(e, a) {cerr << e << " ";} cerr << "\n";}
#define logvp(a) {cerr << #a << " = "; fore(e, a) {cerr << "(" << e.first << ", " << e.second << ") ";} cerr << "\n";}
#define logvv(a) {cerr << #a << " = \n"; fore(r, a) { fore(e, r) {cerr << e << " ";} cerr << "\n";} }
#define logvf(a, field) {cerr << #a"."#field << " = \n"; fore(e, a) { cerr << e.field << " ";} cerr << "\n"; }
#define logvff(a, f1, f2) {cerr << #a".{"#f1 << ", "#f2 << "} = \n"; fore(e, a) { cerr << "(" << e.f1 <<", " << e.f2 << ") ";} cerr << "\n"; }
#define logs(a) cerr << #a << " = " << (a) << "\n";
#define logss(a, b) cerr << #a << " = " << (a) << ", " << #b << " = " << (b) << "\n";
#define logp(a) cerr << #a << " = " << "(" << a.first << ", " << a.second << ")" << "\n";
#define cond(pred, stmt) if (pred) { stmt }
#else
#define logv(a)
#define logvp(a)
#define logvv(a)
#define logvf(a, field)
#define logvff(a, f1, f2)
#define logs(a)
#define logss(a, b)
#define logp(a)
#define cond(pred, stmt)
#endif
 
using iip = pair<int, int>;
using llp = pair<i64, i64>;
using ivec = vector<int>;
using llvec = vector<i64>;
using svec = vector<string>;
template<typename T> using vec = vector<T>;
 
template<typename T, typename Dim>
auto make_vec(T value, Dim dim) { return vector<T>(dim, value); }
template<typename T, typename Dim1, typename... Dim>
auto make_vec(T value, Dim1 dim1, Dim... dims) { return make_vec(make_vec(value, dims...), dim1); }
 
template<typename T>
bool uax(T& v, const T& newv) { if (v < newv) { v = newv; return true; } else return false; }
template<typename T>
bool uin(T& v, const T& newv) { if (v > newv) { v = newv; return true; } else return false; }
 
template<typename T>
istream& operator>>(istream& is, vector<T>& c) { for (auto& e : c) is >> e; return is; }
template<typename T, size_t N>
istream& operator>>(istream& is, array<T, N>& c) { for (auto& e : c) is >> e; return is; }
 
template<typename ...T>
istream& read(T&... args) { return (cin >> ... >> args); }
 
static mt19937 rande(123123);
template<typename T>
T rand_int(T from, T to) { uniform_int_distribution<T> distr(from, to); return distr(rande); }
 
constexpr int INF = 1e9;
constexpr int MXB = 20;
using bin = bitset<MXB>;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    rande.seed(chrono::steady_clock::now().time_since_epoch().count());
    
    i64 n;
    while (read(n)) {
        string ans;
        while (n) {
            n--;
            char c = n % 26;
            n /= 26;
            ans += 'a' + c;
        }
        reverse(ans.begin(), ans.end());
        cout << ans << endl;
    }

}

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

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

    string ab(a + b);
    auto num = static_cast<double>(atol(ab.c_str()));
    auto sqrt_num = static_cast<int>(sqrt(num));
    if (sqrt_num * sqrt_num == num)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }

    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n, a, b;
    std::cin >> n >> a >> b;
    int p1 = 0, p2 = 0, p3 = 0;
    for (int i = 0; i < n; i++) {
        int p;
        std::cin >> p;
        if (p <= a) p1++;
        else if (p <= b) p2++;
        else p3++;
    }

    std::cout << std::min({p1,p2,p3}) << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;


int main()
{
   FAST/**/
   set<ll> st;
   ll n,m;
   cin>>n>>m;
   
   map<ll,ll> pen;
   ll fin = 0;
   rep(m)
   {
       ll a;
       string s;
       cin>>a;
       cin>>s;
       
       if(s == "AC")
       {
           if(st.find(a) == st.end())
           {
               st.insert(a);
               fin+=pen[a];
           }
           
           else
                continue;
       }
       
       else
           pen[a]++;
   }
   
   cout<<st.size()<<" "<<fin;
   
   return 0;        
}  
   

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

int mod = 1000000007;

int64_t gcd(int64_t p, int64_t q)
{
    if (p < q)
        swap(p, q);

    if (p % q == 0)
        return q;
    else
        return gcd(q, p % q);
}

int main()
{
    int N, ans, tmp;
    cin >> N >> ans;
    for (int i = 0; i < N - 1; i++)
    {
        cin >> tmp;
        ans = gcd(ans, tmp);
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

constexpr int dx[4] = {1, -1, 0, 0};
constexpr int dy[4] = {0, 0, 1, -1};

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

    int N, W;
    cin >> N >> W;
    vector<int> dp(W + 1, -1);
    dp[0] = 0;
    for(int i = 0; i < N; ++i){
        int v, w;
        cin >> v >> w;
        for(int j = W - w; j >= 0; --j){
            if(dp[j] == -1) continue;
            chmax(dp[j + w], dp[j] + v);
        }
    }
    cout << *max_element(dp.begin(), dp.begin() + W + 1) << endl;
}


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

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

Measured memory_bytes: 256
def main():
    h,w=map(int,input().split())
    a = [list(input()) for _ in range(h)]
    b = []
    for i in a:
        if i.count(".") != w:
            b.append(i)
    for i in list(range(w))[::-1]:
        for j in b:
            if j[i] == "#":
                break
        else:
            for j in range(len(b)):
                del b[j][i]
    for x in b:
        print("".join(x))

if __name__ == "__main__":
    main()

Measured memory_bytes: 9056
N, K = gets.chomp.split.map(&:to_i)
S = gets.chomp.split('')

def replace(s, k)
  if s[k - 1] == 'A'
    s[k - 1] = 'a'
  elsif s[k - 1] == 'B'
    s[k - 1] = 'b'
  else
    s[k - 1] = 'c'
  end
end

replace(S, K)

puts S.join

Measured memory_bytes: 1788
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
using namespace std;
typedef pair<ll, ll> pll;



ll n;
ll a[2002];
ll ans;
vector< pll > e;
vector< pll > o;
void dos(vector<ll> &a , ll p)
{
        sort(a.begin(), a.end());
        set<ll> s(a.begin(), a.end());
        //cout << endl;
        //for(auto j : s) cout << j << endl;
        //cout << endl;
        ll rmd = 0;
        vector<ll> ret; ret.clear();
        for(ll i=a[0]+2;i<a.back();i += 2){
                if(i%2 == p && s.find(i) == s.end()) {
                        ret.pb(i - rmd);
                        rmd += 2;
                }
        }
        ll st = a[0];
        ll ed = a.back()-rmd;
        ll sz = n - rmd;
        //cout << st << " **** " << ed << endl;
        for(ll i=1;i<st;i++) {
                ret.pb(1);
                sz--;
        }
        for(ll i=st+1;i<ed;i+=2){
                ret.pb(2); sz -= 2;
        }
        while(sz>1){
                ret.pb(sz); sz--;
        }
        cout << ret.size() << endl;
        for(auto &j : ret) cout << j << endl;

}
int main()
{
        cin >> n;
        for(ll i=1;i<=n;i++) {
                cin >> a[i];
        }
        ans = -1e16;
        for(ll i=1;i<=n;i+=2) o.pb(make_pair(a[i], i));
        for(ll i=2;i<=n;i+=2) e.pb(make_pair(a[i] , i));
        ll ae = -1e16;
        ll ao = -1e16;
        sort(o.rbegin(), o.rend());
        vector< ll > odds;
        odds.pb(o[0].second);
        ao = o[0].first;
        for(ll i=1;i<o.size();i++) {
                if(o[i].first < 0){
                        break;
                }
                ao += o[i].first;
                odds.pb(o[i].second);
        }
        sort(e.rbegin(), e.rend());
        vector< ll > eve;
        eve.pb(e[0].second);
        ae = e[0].first;
        for(ll i=1;i<e.size();i++) {

                if(e[i].first < 0) {
                        break;
                }
                ae += e[i].first;
                eve.pb(e[i].second);
        }
        ans = max(ae, ao);
        cout << ans << endl;
        if(ae > ao){
                dos(eve, 0);
        }else {
                dos(odds, 1);
        }
        return 0;
        /*vector<ll> ret; ret.clear();
        ll rm = n;
        for(ll i=1;i<st;i++) {
                ret.pb(1); rm--;
        }
        for(ll i=st+1;i<ed;i+=2) {
                ret.pb(2); rm -= 2;
        }
        while(rm>1){
                ret.pb(rm); rm--;
        }
        cout << ret.size() << endl;
        for(auto i : ret) cout << i << endl;
        return 0;*/
}


Measured memory_bytes: 256
N = int(raw_input())
A = map(int,raw_input().split())
print ' '.join(map(str,A))
for i in xrange(1,N):
    v = A[i]
    j = i - 1
    while j >=0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print ' '.join(map(str,A))

Measured memory_bytes: 4220
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define VPII vector<pair<int,int> >
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
const LL MOD = 1e9+7;
const int INF = 1<<30;
int MAXN = 1e5+2;
const double eps = 1e-13;

int main(){
	string s;
	cin>> s;
	if(s.length()<4){puts("No");return 0;}
	if(s[0]!='Y'){puts("No");return 0;}
	if(s[1]!='A'){puts("No");return 0;}
	if(s[2]!='K'){puts("No");return 0;}
	if(s[3]!='I'){puts("No");return 0;}
	puts("Yes");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
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; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    map<ll, ll> ans;
    ll n;
    cin >> n;
    rept(i,1,100){
        rept(j,1,100){
            rept(k,1,100){
                ll tmp=i*i+j*j+k*k+i*j+i*k+j*k;
                if(i==j && j==k){
                    ans[tmp]+=1;
                }
                else if(i!=j && i!=k){
                    ans[tmp]++;
                }
                else{
                    ans[tmp]++;
                }
            }
        }
    }
    for(int i=1; i<=n; i++){
        cout << ans[i] << endl;
    }
}

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

using namespace std;

const long long MOD = 1000000007;

void solve() {
    int N;
    cin >> N;
    vector<long long> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    vector<long long> a_sum(N, 0);
    for (int i = N-2; i >= 0; i--)
    {
        a_sum[i] = (a_sum[i+1] + A[i+1]) % MOD;
    }
    long long ans = 0;
    for (int i = 0; i < N-1; i++)
    {
        ans = (ans + (A[i] * a_sum[i]) % MOD) % MOD;
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 6340
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main(){
 int n,k;
 cin>>n>>k;
 int a[n];
 for(int i=0;i<n;i++)cin>>a[i];
 ll ans=1;
 for(int i=0;i<k;i++){
   ans*=a[i];
 }
 int j=0;
 for(int i=k;i<n;i++){
   if(a[i]>a[j]){
     cout<<"Yes\n";
	 ans/=a[j];
	 j++;
	 ans*=a[i];
   }
   else{
     cout<<"No\n";
	 ans/=a[j];
	 j++;
	 ans*=a[i];
   }
 }
}


Measured memory_bytes: 4420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> vp;
typedef pair<ll, ll> pi;
typedef set<ll> si;
typedef set<char> sc;
typedef set<double> sd;
typedef map<ll, ll> mi;
#define pb push_back
#define mp make_pair
#define FI first
#define SE second

int main()
{
    ll n, m;
    cin >> n >> m;
    set <pair<int, string>> vis1;
    map<pair<int, string>, int> m1;
    ll acnt, pcnt; acnt = pcnt = 0;
    for(int i = 0; i < m; i++){
        int x; string k;
        cin >> x >> k;
        pair<int, string> p;
        pair<int, string> p2;
        p.second = "AC";
        p.first = x;
        p2.first = x;
        p2.second = "WA";
        vis1.insert(p);
        if(k == "AC" && m1[p] == 0){
            m1[p]++;
            acnt++;
        }
        if(k == "WA" && m1[p] == 0){
            m1[p2]++;
        }
    }
    for(auto it = vis1.begin(); it != vis1.end(); it++){
        pair<int, string> ps = *it;
        pair<int, string> ps2;
        ps2.first = ps.first;
        ps2.second = "WA";
        if(m1[ps]) pcnt += m1[ps2];
    }
    cout << acnt << " " << pcnt << endl;
    return 0;
}


Measured memory_bytes: 28416
#include <bits/stdc++.h>
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using namespace std;
namespace mp = boost::multiprecision;


int main() {
  int n;
    cin>>n;
    
    vector<long long> vec(n);
    rep(i,n) {
     cin>>vec.at(i);
    }
    bool zero = false;
    rep(i,n) {
     if(vec.at(i) == 0) {
      zero = true;
     }
    }
    
    if(zero == false) {
    mp::int256_t seki = 1;
    rep(i,n) {
     seki *= vec.at(i);
     if(seki > 1000000000000000000) {
     seki = -1;
        
     break;
     }
    }
    
    cout << seki;
    }
    
    else {
     cout << 0;}
  }


Measured memory_bytes: 4076
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pii pair <ll,ll>
#define vl vector <ll>
#define vp vector <pair<ll,ll>>
#define sort(x) sort(x.begin(), x.end())
using namespace std;
ll c[1000001]={0},m=1e9+7;
vector <ll> v[1000001];
ll power(ll a, ll b, ll m)
{
    if(b == 0)
        return 1;
    ll x = power(a,b/2,m);
    x = (x*x)%m;
    if(b%2 == 1)
        x = (x*a)%m;
    return x;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,i,ans=0,j;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++)
        cin>>a[i];
    for(i=2;i<=1000000;i++)
    {
        if(v[i].size() == 0)
        {
            for(j=1;i*j<1000001;j++)
                v[i*j].pb(i);
        }
    }
    for(i=0;i<n;i++)
    {
        ans = (ans + power(a[i],m-2,m))%m;
        ll cnt =0,x;
        x = a[i];
        for(j=0;j<v[a[i]].size();j++)
        {
            cnt = 0;
            while(x%v[a[i]][j]==0)
            {
                cnt++;
                x /= v[a[i]][j];
            }
            c[v[a[i]][j]] = max(c[v[a[i]][j]],cnt);
        }
    }   
    for(i=1;i<=1000000;i++)
    {
        ans = (ans*power(i,c[i],m))%m;
    }
    cout<<ans;
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	ll n;
	cin>>n;
	if(n == 0){
		cout<<0<<endl;
	}
	string ret = "";
	while(n != 0){
		if(n%2 != 0){
			ret += '1';
			n = (1 - n)/2;
		}else{
			ret += '0';
			n = -n/2;
		}
	}
	reverse(ret.begin(), ret.end());
	cout<<ret<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <math.h>
#include <bitset>
#include <algorithm>
#include <iomanip>
#define ll long long int
#define add push_back

using namespace std; 

int main() {

    ios::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);

    int T;  
    // cin >> T;
    T = 1;
    while(T--){
        int n; cin >> n;
        if(n == 0)
            cout << 1 << endl;
        else 
            cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 3644
#! python3

def main():
    n = int(input())
    alist = [int(i) for i in input().split()]
    count = 0
    for u in range(n):
        uu = alist[u]
        while True:
            if uu % 2 == 0:
                uu = uu//2
                count += 1
            else:
                break
    print(count)

main()

Measured memory_bytes: 4140
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define PI 3.1415926535897932384626433
#define mod 1000000007
 
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
 
int lcm(int a, int b) { return a * b / gcd(a, b); }
 
int main(){
    int n, x;
    cin >> n >> x;
    int kid[n];
    for (int i = 0; i < n; i++){
        cin >> kid[i];
    }
    
    sort(kid, kid + n);

    int cnt = 0;
    for (int i = 0; i < n; i++){
        x -= kid[i];
        if (x < 0){
            cout << cnt << endl;
            return 0;
        }
        cnt++;
    }
    if(x != 0){
        cout << cnt - 1 << endl;
        return 0;
    }
    cout << cnt << endl;
    return 0;
}

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

public class Main {
	public static void main(String[] args) {
		int n = 0;
		
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			n = Integer.parseInt(br.readLine());
		} catch (IOException e) {
			return;
		}
		
		System.out.println(n > 999 ? "ABD" : "ABC");
	}
}


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

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

const int lim = 1000000007;

ll func(ll a, ll b){
    ll val = 1;
    rep(i, b){
        val = (val * a) % lim;
    }
    return val;
}

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

    ll ans = (func(10, N) - func(9, N) - func(9, N) + func(8, N));
    ans %= lim;
    ans = (ans + lim) % lim;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define rep(i, k, n) for(int i = (int)(k);i < (int)(n);i++)
#define ll long long
int main() {
  int N, W;cin >> N >> W;
  vector<vector<ll>> dp(N+1, vector<ll>(W+1, 0));
  vector<int> w(N+1), v(N+1);
  rep(i, 1, N+1) cin >> w[i] >> v[i];
  rep(i, 1, N+1) rep(j, 1, W+1) {
    if(j < w[i]) dp[i][j] = dp[i-1][j];
    else dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]]+v[i]);
  }
  cout << dp[N][W] << endl;
}

Measured memory_bytes: 83184
#include<iostream>
#include<math.h>
using namespace std;
long number[101];
long numbers[101][21][50];
int N;
int last;
int main(void){

   
  cin >> N;
  N-=1;
  for (int i=0;i<N;i++){
    cin >> number[i];
  }
  cin >> last;
  numbers[0][number[0]][0]=1;
  for(int k=0;k<50;k++){
    for(int i=1;i<N;i++){
      for(int j=0;j<=20;j++){
	if(j+number[i]>=0 && j+number[i] <=20 && numbers[i-1][j][k]!=0){
	  numbers[i][j+number[i]][k]+=numbers[i-1][j][k]%1000000;
	  numbers[i][j+number[i]][k+1]+=numbers[i-1][j][k]/1000000;
	  // cout << i <<" " << j+number[i]<<" "<< j << " " <<numbers[i-1][j][k]<< endl;
	}
	if(j-number[i]>=0 && j-number[i] <=20 && numbers[i-1][j][k]!=0){
	  numbers[i][j-number[i]][k]+=numbers[i-1][j][k]%1000000;
	  numbers[i][j-number[i]][k+1]+=numbers[i-1][j][k]/1000000;
	  // cout << i <<" " << j-number[i]<<" "<< j << " " <<numbers[i-1][j][k]<< endl;
	}
      }
    }
  }
  int checker=0;
  int value;
  for(int k=50;k>=0;k--){

    if(numbers[N-1][last][k]!=0){
      for(int i=1;i<=6;i++){
	value=( (numbers[N-1][last][k]%1000000)+(numbers[N-1][last][k-1]/1000000))%(long)pow(10,7-i)/(long)pow(10,6-i);
	if(checker==1||value!=0){
	cout << value;
	checker=1;
	}
      }
      //  cout << (numbers[N-1][last][k]%1000000)+(numbers[N-1][last][k-1]/1000000);
      /*	if(numbers[N-1][last][k-1]%1000000<10000 && k!=0)// && k-1==0)
	  {
	  	cout << 0 ;
	  }  
      */
 }
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 2008
#include <cstdio>
#define MAX 10000
#define NIL -1

struct Node{int parent, left, right;};

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u, int d)
{
    if (u == NIL)
        return;
    D[u] = d;
    setDepth(T[u].left, d + 1);
    setDepth(T[u].right, d + 1);
}

int setHeight(int u)
{
    int h1 = 0, h2 = 0;
    if (T[u].left != NIL)
        h1 = setHeight(T[u].left) + 1;
    if (T[u].right != NIL)
        h2 = setHeight(T[u].right) + 1;

    //左右の子で深いほうの深さを選択
    return H[u] = (h1 > h2 ? h1 : h2);
}


//節点uの兄弟を返す
int getSibling(int u)
{
    //親がないとき(rootのとき)
    if(T[u].parent==NIL)return NIL;
    //親の左子がuではない かつ 親の左子がNILでない
    //-->uが子　かつ　右子である　
    if(T[T[u].parent].left!=u && T[T[u].parent].left!=NIL)
        return T[T[u].parent].left;
    //uが子　かつ　左子である　
    if(T[T[u].parent].right!=u && T[T[u].parent].right!=NIL)
        return T[T[u].parent].right;

    return NIL;
}

void print(int u)
{
    printf("node %d: ",u);
    printf("parent = %d, ",T[u].parent);
    printf("sibling = %d, ",getSibling(u));
    //degree : 各頂点 (vertex) の次数（各頂点に出入りする辺の数）
    int deg=0;
    //子がいるときdeg++
    if(T[u].left != NIL)deg++;
    if(T[u].right!=NIL)deg++;

    printf("degree = %d, ",deg);
    printf("depth = %d, ",D[u]);
    printf("height = %d, ",H[u]);

    if(T[u].parent == NIL)
    {
        printf("root\n");
    }
    else if(T[u].left==NIL && T[u].right==NIL)
    {
        printf("leaf\n");
    }
    else
    {
        printf("internal node\n");
    }
}

int main()
{
    //v: node ID
    //l: left child node ID
    //r:right child node ID
    int v,l,r,root=0;
    scanf("%d",&n);

    for(int i=0;i<n;i++)T[i].parent=NIL;

    //入力からnodeのchild&parentを設定
    for(int i=0;i<n;i++)
    {
        scanf("%d %d %d",&v,&l,&r);
        T[v].left=l;
        T[v].right=r;
        //子が存在するとき、vの子であることを設定
        if(l!=NIL)T[l].parent=v;
        if(r!=NIL)T[r].parent=v;
    }

    //全nodeからroot nodeを探索
    for(int i=0;i<n;i++)
    {
        if(T[i].parent==NIL) root=i;
    }

    setDepth(root,0);
    setHeight(root);

    for(int i=0;i<n;i++) print(i);

    return 0;
}







Measured memory_bytes: 2744
#include<bits/stdc++.h>
#define ll  long long
//#define int long long
#define inf 0x3f3f3f3f
#define fi first
#define se second
#define pb push_back
#define pa pair<int,int>
#define mkp(a,b) make_pair(a,b)
const int N=2e5+10;
const int mod=998244353;
using namespace std;


struct Point
{
   int x,y;
   Point(){}
   Point(int x,int y):x(x),y(y){}
};
typedef Point Vector;
inline int cross(Vector a,Vector b){return a.x*b.y-a.y*b.x;}
inline int dot(Vector a,Vector b){return a.x*b.x+a.y*b.y;}
int x[5],y[5];
int32_t main()
{
   //ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
   int q; scanf("%d",&q);
   while(q--)
   {
   	  for(int i=1;i<=4;i++) scanf("%d%d",&x[i],&y[i]);
   	  if(max(x[1],x[2])<min(x[3],x[4])||min(x[1],x[2])>max(x[3],x[4])||max(y[1],y[2])<min(y[3],y[4])||min(y[1],y[2])>max(y[3],y[4])) 
   	  {
   	  	puts("0");
   	  	continue;
   	  }	
   	  ll p1=cross(Point(x[3]-x[1],y[3]-y[1]),Point(x[2]-x[1],y[2]-y[1])); 
   	  ll p2=cross(Point(x[4]-x[1],y[4]-y[1]),Point(x[2]-x[1],y[2]-y[1]));
   	  ll p3=cross(Point(x[1]-x[3],y[1]-y[3]),Point(x[4]-x[3],y[4]-y[3]));  
   	  ll p4=cross(Point(x[2]-x[3],y[2]-y[3]),Point(x[4]-x[3],y[4]-y[3]));   
   	  if(p1*p2<=0&&p3*p4<=0) puts("1");
   	  else puts("0");
   }
return 0;
}
/*

*/



Measured memory_bytes: 3156
# 動的計画法

n, m = map(int, input().split())

ban = [False] * (n+1)

for i in range(m):
    a = int(input())
    ban[a] = True

# dpテーブル
dp = [0] * (n+1)
dp[0] = 1

# 貰うdp
for i in range(n):
    # ban[i] が　True ならば dp[i] = 0
    if (ban[i]):
        dp[i] = 0
    
    if (i + 1) <= n:
        dp[i+1] += dp[i]
    if (i + 2) <= n:
        dp[i+2] += dp[i]

mod = 10**9 + 7
print(dp[n] % mod)

Measured memory_bytes: 463476
fn main() {
    let n = read::<u32>();
    let a = n % 10;
    let b = (n / 10) % 10;
    let c = (n / 100) % 10;
    let d = (n / 1000) % 10;

    yn((a == b && b == c) || (b == c && c == d));
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main { 
	public static void main(String[] args){
		String str;
        int i1, i2;;
 
        Scanner scan = new Scanner(System.in);
 
        str = scan.next();
        i1 = Integer.parseInt(str);
         
        str = scan.next();
        i2 = Integer.parseInt(str);

        if     (i1<i2)
        	System.out.println("a < b");
        else if(i1>i2)
        	System.out.println("a > b");
        else
        	System.out.println("a == b");
	}
}

Measured memory_bytes: 17120
#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(){
   int n; cin>>n;
   vector<int> a(n);
   vector<int> b(n);
   vector<int> c(n-1);
   rep(i,n) cin>>a[i];
   rep(i,n) cin>>b[i];
   rep(i,n-1) cin>>c[i];
   int ans=b[a[0]-1];
   for(int i=1;i<n;i++){
      ans+=b[a[i]-1];
      if(a[i]==a[i-1]+1){
         ans+=c[a[i-1]-1];
      }
   }
   cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 256