akhauriyash/Code-Regression huggingface dataset:
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vc = vector<char>; using vvc = vector<vc>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;

int N;
vvi eg;

void dfs(vi& vis, int t, int x) {
  if (vis[x]>=0) return;
  vis[x] = t;

  for(int nx : eg[x]) {
    if (vis[nx]>=0) continue;

    dfs(vis, t+1, nx);
  }
}

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


  int V,U; cin>>N>>U>>V;
  U--;V--;
  eg = vvi(N);
  REP(i,N-1) {
    int A,B;cin>>A>>B;
    A--;B--;
    eg[A].push_back(B);
    eg[B].push_back(A);
  }

  vi vt = vi(N, -1);
  dfs(vt, 0, U);
  vi va = vi(N, -1);
  dfs(va, 0, V);

  int ans = 0;
  REP(i,N) {
    if (vt[i] < va[i]) {
      ans = max(ans, va[i]);
    }
  }
  if (ans==0) ans++;
  else ans--;

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 10368
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
	int n;
	cin >> n;
	n %= 10;
	if (n == 3) {
		cout << "bon\n";
	}
	else if (n == 0 || n == 1 || n == 6 || n == 8) {
		cout << "pon\n";
	}
	else {
		cout << "hon\n";
	}
}

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

int main(){
    string n;
    cin >> n;
    if(n[0] == n[2]) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

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

  vector<pair<int64_t, int64_t>> v;
  for (auto i : irange(0L, n)) {
    int64_t a, b;
    cin >> a >> b;
    v.emplace_back(a, b);
  }

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

  int64_t current = 0;
  for (auto p : v) {
    if (current < k && k <= current + p.second) {
      cout << p.first << endl;
      return 0;
    }

    current += p.second;
  }
}

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

using namespace std;

#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;
int N, A, B, T[1010];

int main()
{
	scanf("%d%d%d", &N, &A, &B);
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		scanf("%d", T + i);
		if (!(A <= T[i] && T[i] < B)) ++ans;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 764
# include <stdio.h>
# include <math.h>
double floor(double x);
int main(void){
	long N, a, b;
	scanf("%ld", &N);
	
	for(long int i=sqrt(N)+1;i>=1;i--){
		if(N%i==0){
			a = i;
			b = N/i;
			break;
		}
		
	}
	long int ans = a-1 + b- 1;
	printf("%ld", ans);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
#define int long long

//dp[i] stands for minimum cost for h
int dp[100005];

signed main()
{
    int h, n;
    cin>>h>>n;

    int b[n], a[n];
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }

    for(int i=1;i<=h;i++) dp[i] = 1000000000000000;

    for(int i=0;i<=h;i++){
        for(int j=0;j<n;j++){
            int pos = min(i+a[j], h);
            dp[pos] = min(dp[pos], dp[i] + b[j]);
        }
    }

    cout<<dp[h];
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )

#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

bool isNA( string str )
{
	sort( ALL( str ) );
	return str[0] == str.back();
}

int solve( string str )
{
	int res = 0;
	while ( str != "6174" )
	{
		res++;

		string l( str ), s( str );
		sort( ALL( l ), greater<char>() );
		sort( ALL( s ) );

		ISS issL( l ), issS( s );
		int iL, iS;
		issL >> iL;
		issS >> iS;
		int n = iL - iS;

		OSS oss;
		oss << setw( 4 ) << setfill( '0' );
		oss << n;
		str = oss.str();
	}
	return res;
}


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

	while ( true )
	{
		string str;
		cin >> str;

		if ( str == "0000" )
		{
			break;
		}

		if ( isNA( str ) )
		{
			cout << "NA" << endl;
		}
		else
		{
			cout << solve( str ) << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1256
#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;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define all(a) a.begin(),a.end()
#define println printf("\n");
#define readln(x) getline(cin,x);
#define pb push_back
#define endl "\n"
#define MOD 1000000007
#define mp make_pair
#define fastio cin.tie(0); cin.sync_with_stdio(0);

#define MAXN 3005

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef unordered_map<int,int> umii;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,pii> triple;
typedef int8_t byte;

ll gcd(ll a, ll b) {return b == 0 ? a : gcd(b, a % b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}

int num_coins;
double tails[MAXN],dp[MAXN][MAXN],res;

int main(){
    scanf("%d",&num_coins);
    for(int i=1; i<=num_coins; i++)
        scanf(" %lf",&tails[i]);
    dp[1][0] = tails[1], dp[1][1] = 1-tails[1];
    for(int i=2; i<=num_coins; i++){
        for(int k=0; k<=i; k++){
            dp[i][k] = dp[i-1][k]*tails[i]+dp[i-1][k-1]*(1-tails[i]);
        }
    }
    for(int i=(num_coins+1)/2; i<=num_coins; i++)
        res+=dp[num_coins][i];
    printf("%.9f\n",1-res);
}


Measured memory_bytes: 68992
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n;
int a[300010],b[300010],c[300010],S[300010],T[300010],ans[300010];

void solve(){
    cin >> n;
    rep(i,n){
        cin >> a[i];
        b[a[i]]+=1;
    }
    rep(i,n+1){
        c[b[i]]+=1;
    }
    rep(i,n){
        S[i+1]+=S[i]+c[i+1];
        T[i+1]+=T[i]+(i+1)*c[i+1];
    }
    vector<int> f;
    f.push_back(n);
    Rep(i,1,n+1){
        f.push_back((T[max(0,i-1)]+i*(S[n]-S[max(0,i-1)]))/i);
        //cout << f[i] << " ";
    }
    //cout << "" << endl;
    int l=n;
    Rep(k,1,n+1){
        while(k>f[l]){
            l--;
        }
        cout << l << endl;
    }
}

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

Measured memory_bytes: 8308
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<int, int> P;
constexpr auto INF = INT_MAX / 2;
constexpr auto LINF = 5000000000000000;
constexpr auto MOD = 1000000007;

int main() {

	int n, k;
	cin >> n >> k;
	vi d(k);
	rep(i, k)cin >> d[i];
	int ans = 0;

	for (int i = n;true;i++) {
		int ii = i;

		bool match = false;
		while (ii) {
			int j = ii % 10;
			rep(i, k)if (d[i] == j)match = true;
			ii /= 10;
		}
		if (match)continue;

		ans = i;
		break;

	}

	cout << ans << endl;

}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
old_a = -1
ans = 0

for i in a:
    if i == old_a+1:
        ans += c[old_a-1]
    ans += b[i-1]
    old_a = i

print(ans)

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

ll Stoi(string s){
  ll res=0;
  for(ll i=0;i<(int)s.size();i++)res=res*10+s[i]-'0';
  return res;
}

ll Pow(ll a,ll b){
  ll res=1;
  while(b--)res*=a;
  return res;
}

string n;
ll dp[20][2][10][10][10];

ll dfs(ll id,ll f,ll a,ll b,ll c){
  if(dp[id][f][a][b][c]!=-1)return dp[id][f][a][b][c];
  if(id==(int)n.size())return 0;
  ll r=9,res=0;
  if(!f)r=n[id]-'0';
  for(ll d=0;d<=r;d++){
    ll nf=f;
    if(d<r)nf=1;
    if(a==5&&b==1&&d==3){
      if(nf) res+=Pow(10,n.size()-id-1);
      else res+=Stoi(n.substr(id+1))+1;
    }
    else{
      res+=dfs(id+1,nf,b,c,d);
    }
  }
  return dp[id][f][a][b][c]=res;
}

int main(){
  cin>>n;
  memset(dp,-1,sizeof(dp));
  cout<<dfs(0,0,0,0,0)<<endl;
  return 0;
}


Measured memory_bytes: 3536
list1=list(map(int,input().strip().split()))[:2]
n,k=list1[0],list1[1]
dict1={}
for i in range(k):
	d=int(input())
	have=list(map(int,input().strip().split()))
	for i in have:
		if i in dict1:
			dict1[i]+=1
		else:
			dict1[i]=1
print(n-len(dict1))




Measured memory_bytes: 9196
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#define REP(i,n) for (int i=0;i<(n);i++)
using namespace std;

int main(){
    int a, b, ans = 0;
    cin >> a >> b;

    for(int i = a; i <= b; i++){
        int x = i / 10000;
        int y = (i / 1000) - x * 10;
        int z = i % 10;
        int n = (i % 100 - z) / 10;
        if(x == z && y == n) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int getValue(int n){
	if(n==4) return 5;
	return (n<4)? n:n+2;
}

void convert(int n){
	if(!n) return;
	convert(n/8);
	cout << getValue(n%8);
}

int main(void){
	int n;
	while(cin>>n, n){
		convert(n);
		cout << endl;
	}
	return 0;
}

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

int main()
{
  int c[3][3];
  rep(i,3)
  {
    rep(j,3)
    {
      cin >> c[i][j];
    }
  }
  bool ok = false;
  rep(i,101)
  {
    if ((c[0][1] == c[2][1] - c[2][0] + c[0][0]) && (c[0][1] == c[1][1] - c[1][0] + c[0][0])
       && (c[0][2] == c[1][2] - c[1][0] + c[0][0]) && (c[0][2] == c[2][2] - c[2][0] + c[0][0]))
  	{
    	ok = true;
    	break;
  	}
  }
  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define PUTS(x) cout << (x) << endl;
using Int = long long;
Int gcd(Int a, Int b) {
    Int M = max(a, b);
    Int m = min(a, b);
    while (true) {
        Int r = M % m;
        if (r == 0) break;
        M = m;
        m = r;
    }
    return m;
}
int main() {
    Int n, m;
    cin >> n >> m;
    Int g = gcd(n, m);
    Int L = n / g * m;
    Int d = L / g;
    string S, T;
    cin >> S >> T;
    for (Int i = 0;; i += d) {
        auto s = i * n / L;
        auto t = i * m / L;
        if (s >= n || t >= m) break;
        if (S[s] != T[t]) {
            puts("-1");
            return 0;
        }
    }
    PUTS(L);
}


Measured memory_bytes: 512
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    string s;cin>>s;
    if(s.size()==2)cout<<s<<endl;
    else{
        reverse(all(s));
        cout<<s<<endl;
    }
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a_arr[3]={1,2,3},A,B;
    vector<int> v(a_arr,end(a_arr));
    cin>>A;
    cin>>B;
    auto rema = remove_if(v.begin(),v.end(),[&](int value){return value==A;});
    auto remb = remove_if(v.begin(),v.end(),[&](int value){return value==B;});
    v.erase(rema,v.end());
    v.erase(remb,v.end());
    cout<<v[0]<<endl;
    return 0;
    }

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<cstring>
#include<set>
#include<queue>
#include<map>
#include<math.h>

#define ll long long
#define dd double
#define scl(n)        scanf("%lld",&n)
#define scd(n)        scanf("%lf",&n)
#define scc(n)        scanf("%c",&n)
#define scs(n)        scanf("%s",&n)
#define ptl(n)        printf("%lld",n)
#define ptd(n)        printf("%f",n)
#define ptc(n)        printf("%c",n)
#define pts(n)        printf("%s",n)
#define nline         printf("\n")
#define pb            push_back
#define FOR(i,a,b)    for(ll i=a;i<=b;i++)
#define FORr(i,a,b)   for(ll i=a;i<=b;i--)
#define pi            2*acos(0.0)
#define pii           pair<ll,ll>
#define uu            first
#define vv            second

using namespace std;
set<ll>st[2000005];
ll cnt[200005]={0};
void dfs(ll s,ll par)
{
    cnt[s]=1;
    for(ll i:st[s])
    {
        if(i==par)
            continue;
        if(!cnt[i])
        {
            dfs(i,s);
            cnt[s]+=cnt[i];
        }
    }
}
int main()
{
    ll n,m,x,y;
    scl(n);
    scl(m);
    FOR(i,1,m)
    {
        scl(x);
        scl(y);
        st[x].insert(y);
        st[y].insert(x);
    }
    FOR(i,1,n)
    {
        ll sz=st[i].size();
        if(sz>0&&cnt[i]==0)
        {
            dfs(i,0);
        }
    }
    ll maxi=0;
    FOR(i,1,n)
    {
        if(cnt[i]>maxi)
            maxi=cnt[i];
    }
    if(!maxi)
        maxi++;
    ptl(maxi);
    return 0;
}


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

#define ff first
#define ss second
#define PI acos(-1)
#define pb push_back
#define int long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int MOD = (1e9)+7;
const int N = 1e6+5;

int a,b;
int get(int i)
{
    int c = (a*i)/b - (a*(i/b));
    return c;
}

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        int n;
        cin>>a>>b>>n;
        int ans = get(min(n,b-1));
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <cassert>
using namespace std;

const int MAX_N = 1e5;
const long long MOD = 1e9 + 7;
int N;
long long A, B;
long long S[MAX_N + 1];

long long dp_x[MAX_N] = {};
long long dp_y[MAX_N] = {};
int x_last; // X の条件を満たす最大添え字+1
int y_last; // Y の条件を満たす最大添え字+1
int x_continue; // X のみで構成できる添え字の開始位置
int y_continue; // Y のみで構成できる添え字の開始位置

long long solve()
{
	dp_x[0] = 1;
	dp_y[0] = 1;
	x_last = 0;
	y_last = 0;
	x_continue = 0;
	y_continue = 0;

	for (int i = 1; i < N; ++i)
	{
		while (S[i] - S[x_last] >= A) ++x_last;
		while (S[i] - S[y_last] >= B) ++y_last;

		if (S[i] - S[i - 1] >= A)
			dp_x[i] = dp_x[i - 1];
		if (x_last >= y_continue)
			dp_x[i] = (dp_x[i] + dp_y[min(x_last, i-1)]) % MOD;

		if (S[i] - S[i - 1] >= B)
			dp_y[i] = dp_y[i - 1];
		if (y_last >= x_continue)
			dp_y[i] = (dp_y[i] + dp_x[min(y_last, i-1)]) % MOD;

		if (S[i] - S[i - 1] < A)
			x_continue = i;
		if (S[i] - S[i - 1] < B)
			y_continue = i;
	}

	return (dp_x[N - 1] + dp_y[N - 1]) % MOD;
}

int main()
{
	cin >> N >> A >> B;
	for (int i = 0; i < N; ++i)
	{
		cin >> S[i];
	}
	cout << solve() << endl;
}

Measured memory_bytes: 2688
n = int(input())
judge = {}
judge['AC'] = 0
judge['WA'] = 0
judge['TLE'] = 0
judge['RE'] = 0

for i in range(n):
    s = input()
    if s == 'AC':
        judge['AC'] += 1
    if s == 'WA':
        judge['WA'] += 1
    if s == 'TLE':
        judge['TLE'] += 1
    if s == 'RE':
        judge['RE'] += 1
for key, value in judge.items():
    print("{} x {}".format(key, value))
        


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

int main(void)
{
    double H,A;
    int ans;

    ans = 0;
    std::cin >> H >> A;

    while(H > 0){
        
        ans = ans + 1;
        H = H - A;
    }

    std::cout << ans;

    return 0;
}

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

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)
#define repj(i,j,n) for(i=j;i<n;i++)

#define PB(a,i) (a).push_back(i)
#define ALL(a) (a).begin(),(a).end()
#define SIZE(a,n) (a).resize(n)

#define OK(i) cout<<"OK "<<i<<endl
#define Yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl

using namespace std;

typedef long long int lli;
typedef long long ll;
typedef vector<int> vi;
typedef vector< vector<int> > Matrix;

int main() {
	string s;
	char a, b;
	int x, y,i;

	cin >> s;
	a = s[0];
	x = 0;
	y = -1;
	repj(i,1, 4) {
		if (s[i] != a) {
			b = s[i];
			y = 0;
			break;
		}
	}
	if (y == -1) {
		cout << "No";
		return 0;
	}
	rep(i, 4) {
		if (s[i] == a)x++;
		else if (s[i] == b)y++;
	}

	if (x == 2 && y == 2)cout << "Yes";
	else cout << "No";

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repk(i,k, n) for (int i = k; i < (int)(n); ++i)
#define MAX 500010
typedef long long int ll;

using namespace std;

ll N, ans, cnt;
string s;


int main() {
	cin >> N;

	repk(i, 1, 10) {
		repk(j, 1, 10) {
			if (i*j == N) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;

	return 0;
}

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

#define mod 1000000007
#define ll long long
#define ld long double
typedef vector< long long > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define pii pair<int,int>
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(x) x.begin(),x.end()
#define fill(a,b) memset(a,b,sizeof(a))
#define sp(x) setprecision(x)
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element) (find(all(container),element) != container.end())
#define deb(x) cout<<#x <<x <<endl
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output1.txt","w",stdout);
	#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
        ll k,a,b;
        cin>>k>>a>>b;
        if(a%k==0||(k-(a%k))<=b-a)
        	cout <<  "OK"<< '\n';
        else
        	cout<<"NG"<<endl;
}


Measured memory_bytes: 3612
#include<stdio.h>

int main(){
	int sx,sy,tx,ty,i;
	scanf("%d%d%d%d",&sx,&sy,&tx,&ty);
	for(i=0;i<ty-sy;i++)printf("U");
	for(i=0;i<tx-sx;i++)printf("R");
	for(i=0;i<ty-sy;i++)printf("D");
	for(i=0;i<=tx-sx;i++)printf("L");
	for(i=0;i<=ty-sy;i++)printf("U");
	for(i=0;i<=tx-sx;i++)printf("R");
	printf("DR");
	for(i=0;i<=ty-sy;i++)printf("D");
	for(i=0;i<=tx-sx;i++)printf("L");
	printf("U\n");
	return 0;
}

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

struct P
{
    int x,y;
    bool operator<(const P &a)const{
              return x>a.x;
    }
};

vector<int> v[11];
//bitset<4001000> b;
int a,c,i,b,k,n,d,e,m;//dy[15]={0,1,0,-1,-1,1,-1,1},dx[15]={1,0,-1,0,1,1,-1,-1};//
int l[331];
int o[303];
int j[331];
int dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1},dz[10]={0,0,0,0,1,-1};


long long x,y,mod=1000000007;
long long z;

P u[10];
stack<int> s;

//set<int> s;
queue<int> q;


//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
//map<int,int> p[100100];
//list<int> l;

string r;
//char r[1333];
//deque<int> de;
bool as(P a,P b)
{
    return a.y<b.y;
}

int main()
{
    long long d;
    scanf("%d %d %d %lld",&a,&b,&c,&d);
    if(d%2==0) printf("%d",a-b);
    else printf("%d",b-a);
}




Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
using ll = long;

ll n, k;

ll fun(ll n, ll x){
	if (n == 0)return (x <= 0 ? 0 : 1);
	ll p = (1LL << n) - 1;
	if (x <= 2*p)return fun(n - 1, x - 1);
	return p + 1 + fun(n - 1, x - 1 - 2*p);
}

int main(){
	cin >> n >> k;
	cout << fun(n, k) << endl;
}


Measured memory_bytes: 256
import sys

inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instr = lambda: sys.stdin.readline()
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
s = instr()

prev = s[0]
ans = 1

for i in range(1,n):
    if s[i] == prev:
        continue
    else:
        prev = s[i]
        ans += 1

print(ans)


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

int main()
{
  string s;
  cin >> s;
  int n = s.length();
  vector<vector<int64_t>> dp(n + 1, vector<int64_t>(13));
  dp[0][0] = 1;

  for (int i = 0; i < n; i++) {
    int c = s[i] == '?' ? -1 : s[i] - '0';
    for (int j = 0; j < 10; j++) {
      if (c != -1 && c != j) continue;
      for (int k = 0; k < 13; k++) {
        dp[i + 1][(k * 10 + j) % 13] += dp[i][k];
      }
    }
    for (int j = 0; j < 13; j++) {
      dp[i + 1][j] %= 1000000007;
    }
  }
  cout << dp[n][5] << endl;
}


Measured memory_bytes: 13696
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys

def T(k):
    orig_k = k
    sk = 0
    while k > 0:
        sk += k % 10
        k //= 10
    return orig_k / sk

d = {}
MAX = int(1e15) + 1e9
for i in range(1, 99999):
    t = i
    while t < MAX:
        d[t] = T(t)
        t = t * 10 + 9

keys = sorted(list(d.keys()))

# for k in keys:
#     print(k, d[k])

mn = None
ans = []
for k in reversed(keys):
    if mn == None:
        ans.append(k)
        mn = d[k]
    else:
        if mn >= d[k]:
            ans.append(k)
            mn = min(mn, d[k])

ans.reverse()

K = int(input())
ans = ans[:K]
for a in ans:
    print(a)


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

#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/2;
const ll MOD = 1e9+7;

ll N,M;
vll g[100010];
ll dep[100010];
ll dfs(ll v,ll p,ll d){
  if(dep[v])return 0;
  dep[v]=d;
  ll cnt=0;
  for(ll u:g[v])if(u!=p){
    if(dep[u]&&dep[u]<dep[v]){
      cout<<v+1<<" "<<u+1<<endl;
      cnt++;
    }else{
      cnt+=dfs(u,v,d+1);
    }
  }
  if(p>=0){
    if(cnt&1){
      cout<<v+1<<" "<<p+1<<endl;
      return 0;
    }else{
      cout<<p+1<<" "<<v+1<<endl;
      return 1;
    }
  }
  return 0;
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>N>>M;
  for(ll i=0;i<M;i++){
    ll A,B;cin>>A>>B;A--;B--;
    g[A].push_back(B);
    g[B].push_back(A);
  }
  if(M&1)cout<<-1<<endl;
  else dfs(0,-1,1);
  return 0;
}


Measured memory_bytes: 17024
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <deque>
using namespace std;

#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(elem, _list) for(auto& (elem) : (_list))
#define debug(_list) foreach(e, _list){ cout << e << sp; } cout << next
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define ALL(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e);
#define INF 1e+8
#define PI acos(-1)
#define TAU PI * 2
using ll = long long;
using ull = unsigned long long;
const ll MOD = 1000000007;

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

    // 初期値
    int ans = size(s);

    // 最初に使う色(0 or 1)
    for(int i = 0; i < 2; ++i){
        int cnt = 0;
        for(int j = 0; j < size(s); ++j){
            // iを最初に使った時に変えなかれば行けないタイルの数

            // i == 0のとき
            // 黒白黒白....

            // 偶数番目文字が黒(i == 0)ではなかった時
            if(j % 2 == 0 && s[j] != (char)(i + '0')){
                cnt++;
            }

            // 奇数番目の文字が白(i == 0)の時
            if(j % 2 == 1 && s[j] == (char)(i + '0')){
                cnt++;
            }
        }

        ans = min(ans, cnt);
    }

    println(ans);
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
#include <set>
#include <random>
using namespace std;
int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 0; i < 262144; i++) {
	  int tmp   = i;
	  int num   = 0;
	  bool flag = true;
	  bool c[4] = { };
	  while (tmp > 0) {
		  if (tmp % 4 == 0) {
			  flag = false;
			  break;
			}
		  c[tmp % 4] = true;
		  num        = 10 * num + 2 * (tmp % 4) + 1;
		  tmp       /= 4;
		}
	  if (flag && c[1] && c[2] && c[3] && num <= N) {
		  ans++;
		}
	}
  cout << ans << endl;
  return 0;
}


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


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.Int();
            long[] L = in.Long(N);
            Arrays.sort(L);

            int ans = 0;
            for (int i = 0; i < N; i++) {
                for (int j = i + 1; j < N; j++) {
                    for (int k = j + 1; k < N; k++) {
                        long a = L[i];
                        long b = L[j];
                        long c = L[k];
                        if (a == b || b == c) continue;
                        if (a < b + c && b < a + c && c < a + b) ans++;
                    }
                }
            }
            out.println(ans);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

        public long Long() {
            return Long.parseLong(next());
        }

        public long[] Long(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = Long();
            }
            return a;
        }

    }
}



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

int main() {
	int h,w; cin>>h>>w;
	vector<string> a(h);
	rep(i,h) cin >> a[i];

	vector<bool> row(h,false);
	vector<bool> col(w,false);
	rep (i,h) {
		rep (j,w) {
			if (a[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}

	rep(i,h) {
		if (row[i]) {
			rep(j,w) {
				if (col[j]) cout << a[i][j];
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 256
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
 
S = [[0]*M for i in range(N)]
for i in range(N):
    S[i] = list(map(int, input().split()))
 
b = 0
 
for i in range(N):
    a = 0
    for ii in range(M):
        a += S[i][ii] * B[ii]
    a += C
    if a > 0:
        b += 1
 
print(str(b))

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc=new Scanner(System.in);
        sc.next();
        int ans[]=new int[26];
        for(char c:sc.next().toCharArray())
             ans[c-'a']++;
        long a=1;
        for(int i=0;i<26;i++)a=(a*(ans[i]+1))%1000000007;
        System.out.println(a-1);
    }
}


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

int main(){
    int W,H,n;
    while(~scanf("%d%d%d",&W,&H,&n)){
        int l=0,r=W,b=0,t=H;
        while(n--){
            int x,y,a;
            scanf("%d%d%d",&x,&y,&a);
            switch(a){
                case 1:
                    l=max(l,x);
                    break;
                case 2:
                    r=min(r,x);
                    break;
                case 3:
                    b=max(b,y);
                    break;
                default:
                    t=min(t,y);
            }
        }
        int ans;
        if(l>r||b>t)
            ans=0;
        else
            ans=(r-l)*(t-b);
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 3228
while True:
    n, x = map(int, input().split())
    if n == x == 0:
        break
    cnt = 0
    for i in range(1, n + 1):
        for j in range(i + 1, n + 1):
            for k in range(j + 1, n + 1):
                if i + j + k == x:
                    cnt += 1
    print(cnt)


Measured memory_bytes: 5596
#include <stdio.h>
int main(void){
    // Here your code !
    int a,b;
    scanf("%d %d",&a,&b);
    
    if(a == 2){
        a = -1;
    }else if(a == 4 || a == 6 || a == 9 || a == 11){
        a = -2;
    }else{
        a = -3;
    }
    if(b == 2){
        b = -1;
    }else if(b == 4 || b == 6 || b == 9 || b == 11){
        b = -2;
    }else{
        b = -3;
    }
    if(a == b){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}


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

using namespace std;

#define REP(i, n) for (int i=0; i<(n); ++i)
#define RREP(i, n) for (int i=(int)(n)-1; i>=0; --i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)
#define RFOR(i, a, n) for (int i=(int)(n)-1; i>=(a); --i)

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;

template<class T>
ostream &operator<<(ostream &os, const vector <T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair <T, U> &p) {
    return os << "(" << p.first << " " << p.second << ")";
}

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

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int W; cin >> W;
    vector<int> a(W);
    REP(i, W) cin >> a[i];

    vector<int> ma(W);

    {
        vector<int> dp(W+1);
        RREP(i, W) {
            if (a[i] == 0) {
                dp[i] = INF;
            }
            if (a[i] < 0) {
                dp[i] = min(dp[i+1] - 1, abs(a[i]));
            }
            if (a[i] > 0) {
                dp[i] = dp[i+1] - 1;
            }
        }
        REP(i, W) chmax(ma[i], dp[i]);
    }
    {
        vector<int> dp(W+1);
        REP(i, W) {
            if (a[i] == 0) {
                dp[i+1] = INF;
            }
            if (a[i] < 0) {
                dp[i+1] = min(dp[i] - 1, abs(a[i]));
            }
            if (a[i] > 0) {
                dp[i+1] = dp[i] - 1;
            }
        }
        REP(i, W) chmax(ma[i], dp[i+1]);
    }
    ll ans = 0;
    REP(i, W) {
        if (a[i] > 0) {
            ans += min(a[i], ma[i]);
        }
    }
    cout << ans << endl;

    return 0;
}



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

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

    string S, T;
    cin >> S >> T;
    if ((S.size() + 1) == T.size() && T.substr(0, S.size()) == S) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
int main(){

  int i,array[100],a;

  scanf("%d",&a);
  for(i=0;i<a;i++){
    scanf("%d",&array[i]);
  }
  printf("%d",array[i-1]);
   for(i=i-2;i>=0;i--){
    printf(" %d",array[i]);
  }
   puts("");
   return 0;
}

Measured memory_bytes: 1036
def main():
    N = int(input())

    if N == 1:
        print(1)
        return

    ans = 0
    for b in range(1, N):
        for p in range(2, N):
            n = b ** p
            if n <= N:
                ans = max(ans, n)
            else:
                break
    print(ans)

main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	ll ans=INF;
	for(ll i=1;i<=sqrt(n);i++){
		if(n%i==0){
			ans=min(ans,n/i+i-2);
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct _OMAZINAI_ { _OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } __omazinai_instance__;
#define INF (1LL<<61 + 1<<29)
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
#define OddEven(x) {std::cout << ((x)%2?"Odd":"Even") << std::endl;}
#define ODDEVEN(x) {std::cout << ((x)%2?"ODD":"EVEN") << std::endl;}
typedef long long int ll;
void _INPUT_IMPL_() {};
template <class T, class... Args> void _INPUT_IMPL_(T& dest, Args&... args) { cin >> dest; _INPUT_IMPL_(args...); }
void _OUTPUT_IMPL_() {};
template <class T, class... Args> void _OUTPUT_IMPL_(T dest, Args... args) { cout<< dest << (sizeof...(Args)?" ":""); _OUTPUT_IMPL_(args...); }
#define in(type, ...) type __VA_ARGS__; _INPUT_IMPL_(__VA_ARGS__)
#define in_v(type, name, cnt) vector<type> name(cnt); loop(i, cnt) cin >> name[i];
#define out(...) _OUTPUT_IMPL_(__VA_ARGS__)

int main() {
	in(string, s);
	YesNo(s[0] == s[2]);
}

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

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextInt();
            var a = cin.ArrayInt(n);

            var ans = 0;
            for (int i = 0; i < n; i++)
            {
                var num = i + 1;
                var v = a[i];

                var numb = num % 2 == 1;
                var vb = v % 2 == 1;
                if (numb && vb) ans++;
            }
            Console.WriteLine(ans);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 27516
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
sum = 0
a = 100
for i in A:
    sum += B[i-1]
    if i-1 == a:
        sum += C[i-2]
    a = i

print(sum)

Measured memory_bytes: 3064
import java.io.InputStream;
import java.util.LinkedList;
import java.util.Scanner;

/**
 * @author kumar1
 * 
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		InputStream in = System.in;
		Scanner scanner = new Scanner(in);
		LinkedList<String> ans = new LinkedList<String>();
		// DPでとく
		int[] map = new int[1000001];
		for(int i=0; i < map.length; i++)
			map[i] = 1000001;
		int[] mapodd = new int[map.length];
		for(int i=0; i < mapodd.length; i++)
			mapodd[i] = 1000001;
		for(int n=0; ; n++) {
			int pollock = n * (n + 1) * (n + 2) / 6;
			if(pollock > 1000000)
				break;
			map[pollock] = 1;
			for(int i=0; i < 1000001; i++) {
				if(i - pollock < 0)
					continue;
				map[i] = Math.min(map[i], map[i - pollock] + 1);	
			}
			if(pollock % 2 == 1) {
				mapodd[pollock] = 1;
				for(int i=0; i < 1000001; i++) {
					if(i - pollock < 0)
						continue;
					mapodd[i] = Math.min(mapodd[i], mapodd[i - pollock] + 1);	
				}
			}
		}
		
		while (true) {
			int x = scanner.nextInt();
			if (x == 0)
				break;
			ans.add(map[x] + " " + mapodd[x]);
		}
		scanner.close();
		for (String a : ans) {
			System.out.println(a);
		}
	}


}

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

int main(){
    int N,total=0,x=0,y;
    cin >> N;
    repr(i,1,N+1){
        y=i;
        while(y!=0){
            y/=10;
            x++;
        }
        if(x%2==1) total++;
        x=0;
    }
    cout << total << endl;
    return 0;
}

Measured memory_bytes: 256
#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 ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<double> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<VS> VSS;  
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;
int main(){
    ll b=0,c=0,d=0,n,min=100000,k,ans=0;
    string s,s2;
    cin >> n >> d >> k;
    VI a(n);
    rep(i,n) { cin >> a[i]; } 
    rep(i,n){
        int m=1;
        c = a[i];
        while(c+1 <= d){
            m+=1;
            c += a[i];
        }
        ans += m;
    }
    cout << ans+k <<endl; 
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 36

typedef struct{
  
  char suit;
  int number;
  
}Card;

main(){
  int i,j,n,mini;
  Card b[N],s[N],a1,a2;
  char S[3];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",&S);
    b[i].suit=S[0];
    b[i].number=S[1]-'0';
    //    scanf("%c&d",&b[i].suit,&b[i].number);
  }
  for(i=0;i<n;i++){
    s[i]=b[i];
  }

  for(i=0;i<n-1;i++){
    for(j=n-1;j>i;j--){
      if(b[j].number<b[j-1].number){
	a1=b[j];
	a2=b[j-1];
	b[j]=a2;
	b[j-1]=a1;
      }
    }
  }

  for(i=0;i<n;i++){
    mini=i;
    for(j=i+1;j<=n-1;j++){
      if(s[j].number<s[mini].number){
	mini=j;
      }
    }
    a1=s[i];
    a2=s[mini];
    s[i]=a2;
    s[mini]=a1;
  }

  for(i=0;i<n-1;i++){
    printf("%c%d ",b[i].suit,b[i].number);
  }
  printf("%c%d\n",b[n-1].suit,b[n-1].number);
  printf("Stable\n");

  for(i=0;i<n-1;i++){
    printf("%c%d ",s[i].suit,s[i].number);
  }
  printf("%c%d\n",s[n-1].suit,s[n-1].number);
  
  int flag=0;
  for(i=0;i<=n-1;i++){
    if(b[i].suit!=s[i].suit){
      flag=1;
    }
  }

  if(flag==1) printf("Not stable\n");
  else printf("Stable\n");

  return 0;
}

Measured memory_bytes: 608
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
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;}
const long long INF=1LL<<60;

//入力
int N,W;
long long w[100010];
long long v[100010];

//dpテーブル
long long dp[110][100010];

int main(){
    int N,W;
    cin>>N>>W;
    for(int i=0;i<N;i++){
        cin>>w[i]>>v[i];
    }
    for(int i=0;i<N;i++){
        for(int sum_w=0;sum_w<=W;sum_w++){
            //i番目のを含む場合
            if(sum_w-w[i]>=0){
                chmax(dp[i+1][sum_w],dp[i][sum_w-w[i]]+v[i]);
            }
            //i番目を含まない場合更新
            chmax(dp[i+1][sum_w],dp[i][sum_w]);

        }
    }
    cout<<dp[N][W]<<endl;


    
}
  
  



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

int main() {
    long long a,b,x;
    cin >> a >> b >> x;
    if(a == 0) {
        cout << b/x+1 << endl;
    }
    else {
        cout << b/x-(a-1)/x<< endl;
    }
}



Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n;
    scanf("%d", &n);
    int b[n-1];
    for(int i=0; i<n-1; i++){
        scanf("%d", &b[i]);
    }
    int a[n];
    a[0]=b[0];
    a[n-1]=b[n-2];

    for(int i=0; i<n-2; i++){
        if(b[i]>=b[i+1]){
            a[i+1]=b[i+1];
        }else{
            a[i+1]=b[i];
        }
    }
int s = 0;
    for(int i=0; i<n; i++){
        s = s + a[i];
    }

    printf("%d\n", s);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
using namespace std;
int main(){
  	double D,T,S;
  	cin>>D>>T>>S;
  	if(((double)D/(double)S)<=T){
    	cout<<"Yes";
    }
  	else{
    	cout<<"No";
    }
  	return 0;
}

Measured memory_bytes: 3684
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		int n = int.Parse(Console.ReadLine());
    string[] strings = new string[n];   
    for(int i = 0; i < n; i++)//それぞれの行
    {
    	strings[i] = Console.ReadLine();
    }
    int answer = -1;
    int answerMemo = 0;
    Queue<int> que = new Queue<int>();
    int[] vertexNums = new int[n];//各頂点の番号
    bool answerExist = true;

    for(int i = 0; i < n; i++)//全ての頂点
    {
      for(int j = 0; j < n; j++)
      {
        vertexNums[j] = -1;
      }
      vertexNums[i] = 1;
      answerMemo = 1;
      que.Enqueue(i);
      answerExist = true;

      while(que.Count > 0)
      {
        int topMemo = que.Peek();
        que.Dequeue();

        for(int j = 0; j < n; j++)
        {
          if(strings[topMemo][j] == '1')//辺でつながっている頂点ならば
          {
            //Console.WriteLine(i+" a"+j+" "+topMemo);
            if(vertexNums[j] == -1)
            {
              vertexNums[j] = vertexNums[topMemo]+1;
              answerMemo = vertexNums[topMemo]+1;
              que.Enqueue(j);
            }else if(vertexNums[j] != vertexNums[topMemo]-1 && vertexNums[j] != vertexNums[topMemo]+1)
            {
              //Console.WriteLine(i+" "+j);
              answerExist = false;
              while(que.Count > 0)
              {
                que.Dequeue();
              }
              break;
            }
          }
        }
      }

      if(answerExist) answer = Math.Max(answer, answerMemo);
    }

		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 13268