akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vl vector<long long>
#define fin(ar,k,n) for(int i=k;i<n;i++) cin>>ar[i]
#define fout(ar,k,n) for(int i=k;i<n;i++) cout<<ar[i]<<' '
#define vs vector<string>
#define mx INT_MAX
#define mn INT_MIN
#define all(z) z.begin(),z.end()
#define mcc 1000000007
#define mcf 998244353
#define mi map<int,int>
#define mem(a,n) memset(a,n,sizeof(a))
using namespace std;

//ll maxl(ll a,ll b) {return (a>b)? a:b;}
//ll minl(ll a,ll b) {return (a<b)? a:b;}
//ll gcdl(ll a,ll b) {return b ? gcdl(b,a%b):a;}


void solve()
{
    int a,b,c;
    cin>>a>>b>>c;
    cout<<c<<' '<<a<<' '<<b;
}


#if 1
int main()
{
    #ifdef __WIN32
    freopen("input.txt","r",stdin);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}
#endif

//------------------------Google-------------------
#if 0
int main()
{
    #ifdef __WIN32
    freopen("input.txt","r",stdin);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t,ct=0;
    cin>>t;
    while(t--)
    {
        cout<<"Case #"<<++ct<<": ";
        solve();
    }
    return 0;
}
#endif


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 200001;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N, K, x;
    cin >> N >> K;
    map<int, int> mp;
    for (int i = 0; i < N; i++) {
        cin >> x;
        mp[x]++;
    }
    vector<int> a;
    for (auto itr = mp.begin(); itr != mp.end(); itr++) {
        a.push_back(itr->second);
    }
    sort(a.begin(), a.end());
    int cnt = (int)a.size() - K;
    int ans = 0;
    for (int i = 0; i < cnt; i++) { ans += a[i]; }
    cout << ans << '\n';
}


Measured memory_bytes: 10748
#include<cmath>
#include<iostream>
#include<vector>
#include<string>
#include<sstream>
#include<chrono>
#include<algorithm>
#include<functional>
#include<cstdlib>
#include<numeric>
#include<omp.h>
#include<queue>
#include<stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
constexpr double PI = 3.14159265358979323846;
int memo_fib[std::numeric_limits<short>::max() - 1];

int main()
{
	double R = 0.0;
	cin >> R;
	std::cout << 2 * R * PI << std::endl;
	
}


Measured memory_bytes: 3784
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };
struct move2{
	char c;
	int m;
};

int main() {
	float n;
	while (cin >> n, n){
		int px = 10, py = 10;
		bool field[21][21];
		REP(i, 21)
			REP(j, 21)
			field[i][j] = false;
		REP(i, n){
			int x, y;
			cin >> x >> y;
			field[x][y] = true;
		}

		int mn;
		cin >> mn;
		REP(i, mn){
			char c;
			int m;
			cin >> c >> m;
			REP(j, m){
				if (c == 'N')py++;
				if (c == 'E')px++;
				if (c == 'S')py--;
				if (c == 'W')px--;
				field[px][py] = false;
			}
		}
		int count = 0;
		REP(i,21){
			REP(j,21){
				if (field[i][j]){
					count++;
				}
			}
		}
		cout << (count==0 ? "Yes" : "No") << endl;
	}
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
#define N 500009
using namespace std;

int n,m,q[N];
struct node{ double x,y,z; }a[N];
int main(){
	scanf("%d%d",&n,&m);
	int i,k,head=1,tail=0; double now=0,ans=0;
	for (i=1; i<=n; i++){
		scanf("%lf%lf",&a[i].x,&a[i].y);
		ans+=a[i].x*a[i].y;
		a[i].z=now=now+a[i].y;
		for (; head<=tail && a[k=q[head]].z<=now-m; head++)
			ans-=a[k].x*a[k].y;
		ans-=a[k].x*a[k].y;
		a[k].y=a[k].z-(now-m);
		ans+=a[k].x*a[k].y;
		for (; head<=tail && a[k=q[tail]].x>a[i].x; tail--){
			a[i].x=(a[i].x*a[i].y+a[k].x*a[k].y)/(a[i].y+a[k].y);
			a[i].y+=a[k].y;
		}
		q[++tail]=i;
		printf("%.10f\n",ans/m);
	}
	return 0;
}


Measured memory_bytes: 24192
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

struct item_t {
  ll w, v;
  item_t(ll w, ll v):w(w),v(v){}
  item_t():w(0),v(0){}
  void operator+=(const item_t &r) {
    w += r.w;
    v += r.v;
  }
  bool operator<(const item_t &r) const { return w < r.w; }
};

vector<item_t> rekkyo(vector<item_t> item) {
  vector<item_t> a(1, item_t(0,0));
  for (auto i : item) {
    vector<item_t> b = a, c;
    for (auto &e : b) {
      e += i;
    }
    std::merge(a.begin(), a.end(), b.begin(), b.end(), std::back_inserter(c));
    a = c;
  }
  return a;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  cin >> n;
  vector<item_t> item(n+1); //1-indexed
  rep(i,n) cin >> item[i+1].v >> item[i+1].w;
  int q;
  cin >> q;
  while(q--) {
    int v, L;
    cin >> v >> L;
    vector<item_t> A;
    while(v > 0) {  
      A.emplace_back(item[v]);
      v /= 2;
    }
    int m = A.size();
    auto a = rekkyo({A.begin(), A.begin() + m/2});
    auto b = rekkyo({A.begin() + m/2, A.end()});
    ll maxv = 0;
    for (auto&& x : b) {
      chmax(maxv, x.v);
      x.v = maxv;
    }
    reverse(all(a));
    ll ans = 0;
    auto itr = b.begin();
    for (auto&& x : a) {
      while(next(itr) != b.end() && x.w + (*next(itr)).w <= L) {
        itr = next(itr);
      }
      if (x.w + (*itr).w > L) continue;  
      chmax(ans, x.v + (*itr).v);
    }
    cout << ans << "\n";
  }
  return 0;
}

Measured memory_bytes: 7372
#include <iostream>
#include<bits/stdc++.h>
#define ll long long int
#define lld long double
#define F first
#define S second
#define f(i,a,b) for(int i=a;i<=b;i++)
#define g(i,a,b) for(int i=a;i>=b;i--)
#define pb push_back
#define mh make_heap
#define ph push_heap
#define pq priority_queue
#define bits(x) __builtin_popcountll(x)
#define op(x) cout<<"Case #"<<x<<": "
#define op1(x) cout<<"Scenario #"<<x<<": "
#define endl "\n"
using namespace std;
const ll mod = 1000000007;
const ll INF = 1e18;
const int N = 20;


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

#define policy tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
*/


void solve(int t)
{

	ll k;
	cin >> k;

	ll val = 0;
	for (int i = 0; i <= k; i++)
	{
		val = ((val * 10 ) % k + 7) % k;
		if (val == 0)
		{
			cout << i + 1 << endl;
			return;
		}

	}

	cout << -1 << endl;


}

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



	int t = 1;
	//cin >> t;


	for (int i = 1; i <= t; i++)
	{
		solve(i);

	}
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define int long long
int N,K;
string S;
signed main(){
  cin >> N >> K >> S;
  if(S[K-1]=='A') S[K-1]='a';
  else if(S[K-1]=='B') S[K-1]='b';
  else if(S[K-1]=='C') S[K-1]='c';
  cout << S << endl;

  return 0;
}


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

long long int changeCount(long long int*, int, int);

int main(void){
	/*
	サイズnの入力
	*/
	int n;
	if(scanf("%d\n", &n) < 1){
		exit(1);
	}

	/*
	a_1,a_2, ... a_nの入力
	*/
	long long int *a;
	a = (long long  int*) malloc ( n * sizeof(long long int));
	int i;
	for(i=0; i<n-1; i++){
		if(scanf("%lld ", &a[i]) < 1){ //scanfの戻り値は、成功した変数の数、もしくは-1である
			//printf(stderr, "error: ill-formed fraction.\n");
			exit(1);
		}
	}
	if(scanf("%lld", &a[n-1]) < 1){
		//printf(stderr, "error: ill-formed fraction.\n");
		exit(1);
	}

	long long int evenchangeCount = changeCount(a, n, 0); //何回変更するのかのカウント
	long long int oddchangeCount = changeCount(a, n, 1); //何回変更するのかのカウント
	
	if(evenchangeCount <= oddchangeCount){
		printf("%lld", evenchangeCount);
	}else{
		printf("%lld", oddchangeCount);
	}	
	return 0;
}



long long int changeCount(long long int *a, int n, int oddPositive){
	/*
	temp_1はa[0]〜a[i-1]までの和
	temp_2はa[0]〜a[i]までの和
	*/
	long long int temp_1=0;
	long long int temp_2=0;
	long long int changeCount = 0; //何回変更するのかのカウント

	int i;
	for(i=0; i < n; i++){
		temp_2 = temp_1 + a[i];

		if(i%2 == 1){ /*iが奇数の時*/
			if(oddPositive == 1){//合計が正でなければいけないとき
				if(temp_2 <= 0){//正でないなら
					changeCount += -temp_2 + 1;
					temp_2 = 1;
				}
			}else{//合計が負でなければいけないとき
				if(temp_2 >= 0){//負でないなら
					changeCount += temp_2 + 1;
					temp_2 = -1;
				}
			}

		}else{/*iが偶数の時*/
			if(oddPositive == 0){//合計が正でなければいけないとき
				if(temp_2 <= 0){//正でないなら
					changeCount += -temp_2 + 1;
					temp_2 = 1;
				}
			}else{//負でなければいけないとき
				if(temp_2 >= 0){//負でないなら
					changeCount += temp_2 + 1;
					temp_2 = -1;
				}
			}
		}
		temp_1 = temp_2;
	}
	return changeCount;
}

Measured memory_bytes: 896
#include <stdio.h>

int main(void){

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

  if (a < c && c < b) {
    printf("Yes\n");
  } else if (b < c && c < a) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }

  return 0;
}

Measured memory_bytes: 128
import java.util.*;
import static java.lang.System.*;
import java.math.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] c = sc.next().toCharArray();
		String ans = "Yes";
		
		for(int i =0; i < c.length; i++) {
			if(i % 2 == 0) {//奇数
				if(c[i] == 'L') {
					ans = "No";
					break;
				}				
			} else {
				if (c[i] == 'R') {
					ans = "No";
					break;
				}
			}
		}
		out.println(ans);
		
	}
}

Measured memory_bytes: 22868
// abc147_b
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(int argc, char *argv[])
{
  string s;
  int cnt = 0;
  cin >> s;
  for (int i=0,j=(int)s.size()-1; i<(int)s.size()/2; ++i, --j) {
    if(s[i] != s[j]) cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int memo[10001];
bool isPrime(int x) {
  if(memo[x]>=0) return memo[x];
  for(int i=2; i*i<=n; i++) {
    if(x % i == 0) return memo[x] = 0;
  }
  return memo[x] = 1;
}

int main() {
  fill(memo, memo+10000, -1);
  while(cin >> n && n) {
    int mx = 5;
    for(int i=2; i<=n-2 ; i++) {
      if((isPrime(i)&isPrime(i+2)) == 1) {
	mx = i;
      }
    }
    cout << mx << ' ' << mx+2 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1200
S = input()
 
def ispalindrome(s):
    h = int(len(s) / 2)
    for a, b in zip(s[:h], reversed(s[h+1:])):
        if a != b: return 0
    return 1
 
index = int((len(S) - 1) / 2)
 
if ispalindrome(S) == 1:
  if ispalindrome(S[:index]) == 1:
    if len(S[:index]) >= 3:
      print("Yes")
    else:
      if len(S[:index]) == 1 and S[0] == S[2]:
        print("Yes")
      else:
        print("No")
  else:
    print("No")
else:
  print("No")

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
void rev(char *s){
    int l=strlen(s),i;
    for(i=0;i<l/2;i++){
        char t=s[i];
        s[i]=s[l-1-i];
        s[l-1-i]=t;
    }
}
char T[4][8]={"dream","dreamer","erase","eraser"};
int main(){
    int i,c=0,l;
    char s[100001];
    for(i=0;i<4;i++)rev(T[i]);
    scanf("%s",s);
    l=strlen(s);
    rev(s);
    for(;c<l;){
        int k=-1;
        for(i=0;i<4;i++){
            if(strncmp(s+c,T[i],strlen(T[i]))==0){
                k=strlen(T[i]);
                break;
            }
        }
        if(k<0){
            puts("NO");
            return 0;
        }
        c+=k;
    }
    puts("YES");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int
const int MAX = 510000;


using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<ll> Pr;

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    ll a[n];
    Pr A;
    rep(i, n) {
        cin >> a[i];
        A.push(a[i]);
    }
    ll ans = 0;
    //sort(a, a + n);
    //reverse(a, a + n);
    rep(i, m){
        ll s = A.top();
        s /= 2;
        A.pop();
        A.push(s);
    }
    while(!A.empty()){
        ll k = A.top();
        ans += k;
        A.pop();
    }
    cout << ans << endl;
}

Measured memory_bytes: 1912
#include <cstdio>
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int main(void)
{
    long long N, M;
    while( ~scanf("%lld%lld", &N, &M) )
    {
        if((M - 2*N) >= 4)
            printf("%lld\n", (M - 2*N) / 4 + N);
        else if(M >= 2*N)
            printf("%lld\n", N);
        else if(N >= M)
            printf("%lld\n", M/2);
    }
    return 0;
}


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

using namespace std;

int main(){
  int N, tmp, sums;
  vector<int> length;
  cin >> N;
  for (int i=0; i<N; i++){
    cin >> tmp;
    length.push_back(tmp);
  }
  
  sort(length.begin(), length.end());
  sums = accumulate(length.begin(), length.end() - 1, 0);
  if (sums <= length.back()) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
a, b = map(int, input().split())
cnt = 0

if b == 1:
    cnt = 0
elif b <= a:
    cnt = 1
else:
    cnt = 1 + (b-a)//(a-1)
    if (b-a) % (a-1) > 0:
        cnt+=1

print(cnt)

Measured memory_bytes: 3060
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
 
ll power(ll x, ll y); 
#define repp(I, A, B) for(int I = A; I <= B; I++)
#define rep(I, A, B) for(int I = A; I < B; I++)
#define rrep(I, B, A) for(int I = B; I >= A; I--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define mem(A, B) memset(A, B, sizeof(A));
#define mem0(A) memset(A, 0, sizeof(A));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define bitcount(n) __builtin_popcountll(n)
#define in_edges(M) repp(I, 1, M){int A, B; cin >> A >> B; v[A].pb(B), v[B].pb(A);}
#define in_edges2(M) repp(I, 1, M){int A, B; cin >> A >> B; v[A].pb(B);}
#define endl "\n"

const ll MOD = 1000000007;
 
int main() //PointBlank's code ¯\_(ツ)_/¯
{
    ll a, b, x;
    cin >> a >> b >> x;
    ll res = b/x - a/x;
    if(a % x == 0) res++;
    cout << res;
}

ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}

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

int main(void){
    string a, b, c;
    cin >> a >> b >> c;
    int count = 0;
    if(a==b)
        count++;
    if(b==c)
        count++;
    if(c==a)
        count++;
    if(count == 0)
        cout << '3' << endl;
    else if(count == 3)
        cout << '1' << endl;
    else
        cout << '2' << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;


int main(){
    ll N, M; cin >> N >> M;
    ll u, v;
    vector<vector<ll>> G(3*N);
    for (ll i = 0; i < M; i++) {
        cin >> u >> v; u--; v--;
        G[3*u].push_back(3*v+1);
        G[3*u+1].push_back(3*v+2);
        G[3*u+2].push_back(3*v);
    }

    ll S, T; cin >> S >> T; S--; T--;
    queue<ll> que;
    vector<ll> d(3*N, INF);
    que.push(3*S);
    d[3*S] = 0;

    ll node;
    while(!que.empty()){
        node = que.front(); que.pop();
        for (ll next : G[node]){
            if(d[next] != INF) continue;
            d[next] = d[node] + 1;
            que.push(next);
        }
        if(d[3*T] != INF) break;
    }

    if(d[3*T] == INF){
        printf("-1\n");
    }
    else{
        printf("%lld\n", d[3*T]/3);
    }

}


Measured memory_bytes: 18944
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1;
	while (b) {
		if (b & 1) { res = res * a%MOD; }
		a = a * a%MOD;
		b >>= 1;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑


long long aa, bb;
int main() {
	int a, b, c, d;
	cin >> a >> b;
	for (int i = 0; i < a; ++i) {
		cin >> c;
		aa += c;
	}

	for (int i = 0; i < b; ++i) {
		cin >> d;
		bb += d;
	}

	cout << aa * bb << endl;
}


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

int main()
{
    int n, k;
    cin >> n >> k;
    set<int> a;
    for (int i = 0; i < k; i++) {
        int d;
        cin >> d;
        for (int i = 0; i < d; i++) {
            int h;
            cin >> h;
            a.insert(h);
        }
    }
    int cnt = 0;
    for (int i = 1; i <= n; i++) cnt += a.count(i);
    cout << n - cnt << "\n";
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;



void solve()
{
  int n;
  cin >> n;

  const ll INF = 1LL << 60;
  ll dp[100010];  
  fill(dp, dp + 100010, INF);
  dp[0] = 0;

  vector<int> yen { 1 };

  int num = 6;
  while(num <= n)
  {
    yen.emplace_back(num);
    num *= 6;
  }

  num = 9;
  while(num <= n)
  {
    yen.emplace_back(num);
    num *= 9;
  }

  sort(yen.rbegin(), yen.rend());

  for(int i = 0; i <= n; ++i)
  {
    for(const auto& y : yen)
    {
      if (i + y > n) continue;
      dp[i + y] = min(dp[i + y], dp[i] + 1);
    }
  }

  cout << dp[n];
}

int main()
{
  fastio;
  solve();

  return 0;
}

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

class UnionFind {
  vector<int> parent;
  vector<int> size;
  vector<int> rank;
  int num_group;

public:
  UnionFind(int n) {
    parent.assign(n, 0);
    size.assign(n, 1);
    rank.assign(n, 0);
    num_group = n;
    for (int i = 0; i < n; i++) {
      parent[i] = i;
    }
  }

  int find_root(int x) {
    return parent[x] == x ? x : parent[x] = find_root(parent[x]);
  }

  void unite(int x, int y) {
    int rx = find_root(x);
    int ry = find_root(y);
    if (rx == ry)
      return;
    if (rank[rx] > rank[ry]) {
      parent[ry] = rx;
      size[rx] += size[ry];
    } else if (rank[rx] < rank[ry]) {
      parent[rx] = ry;
      size[ry] += size[rx];
    } else {
      parent[ry] = rx;
      rank[rx]++;
      size[rx] += size[ry];
    }
    num_group--;
  }

  bool is_same_group(int x, int y) { return find_root(x) == find_root(y); }

  int get_group_size(int x) { return size[find_root(x)]; }

  int get_num_of_groups() { return num_group; }
};

int main() {
  int n, m;
  cin >> n >> m;
  auto uf = UnionFind(n);
  int x, y, z;
  for (int i = 0; i < m; i++) {
    cin >> x >> y >> z;
    x--;
    y--;
    uf.unite(x, y);
  }
  cout << uf.get_num_of_groups() << endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h> 
#define int long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define mc map<char, int>
#define ms map<string, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
//#define mod 1000000007LL
#define mod 998244353 
using namespace std;
int power(int x, int y) ;
int gcd(int a, int b) ;
#define pi 3.141592653589


signed main() {
    quickie     
    string s ;
    cin >> s ;
    set<char> a ;
    map<char, int> m ;
    rep(i, 0, 4) {
        a.insert(s[i]) ;
        m[s[i]]++ ;
    }
    if(a.size() != 2) cout << "No\n" ;
    else {
        for(auto i : a) {
            if(m[i] != 2) {
                cout << "No\n" ;
                return 0 ;
            }
        }
        cout << "Yes\n" ;
    }
}

int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}
 
int gcd(int a,int b){
    if(a==0) return b;
    return gcd(b%a,a);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    string S;
    cin >> S;
    
    //Sの長さをNとする
    int N = S.size();
    
    //条件を満たす文字列を入れる配列を作る
    vector<string> ans_candidate;
    
    //配列の中に条件を満たす文字列を入れる
    for (int i = 0; i < N; i++){
        for (int j = 1; j <= N - i; j++){
            string part = S.substr(i, j);
            bool flag = true;
            for (int k = 0; k < part.size(); k++){
                if (part[k] == 'A') continue;
                else if (part[k] == 'C') continue;
                else if (part[k] == 'G') continue;
                else if (part[k] == 'T') continue;
                else flag = false;
            }
            if (flag) ans_candidate.push_back(part);
        }
    }
    
    //配列の中で一番長い文字列を返す
    string ans = "";
    for (int i = 0; i < ans_candidate.size(); i++){
        if (ans.size() < ans_candidate[i].size()){
            ans = ans_candidate[i];
        }
    }
    
    cout << ans.size() << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<atcoder/all>
using namespace std; 
using namespace atcoder;
  
int find(int X,vector<int> &U){
  if(U.at(X)<0){
    return X;
  }
  return U.at(X)=find(U.at(X),U);
}

void unite (int X,int Y,vector<int> &U){
  X=find(X,U);
  Y=find(Y,U);
  if(X==Y){
    return;
  }
  if(U.at(X)<U.at(Y)){
    swap(X,Y);
  }
  U.at(Y)+=U.at(X);
  U.at(X)=Y;
  return;
}

int main(){
  int N,M,count=-1;
  cin >> N >> M;
  vector<int> U(N,-1);
  for(int i=0;i<M;i++){
    int A,B;
    cin >> A >> B;
    A--;
    B--;
    unite(A,B,U);
  }
  for(int i=0;i<N;i++){
    if(U.at(i)<0){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3820
#include<bits/stdc++.h>
using namespace std;
vector<long long> arr;
#define mod 1000000007
int main(){
	long long n;
	cin>>n;
	long long sum=0;
	while(n--){
		long long a;
		cin>>a;
		arr.push_back(a);
	
	}
  	sum=arr[0];
	long long ans=0;
	for(long long x=1;x<arr.size();x++){
		long long temp=(sum*arr[x])%mod;
		ans=(ans+temp)%mod;
		sum=(sum+arr[x])%mod;
	}
	
		
	cout<<ans<<endl;

}

Measured memory_bytes: 5272
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  ll a, b, c, d;
  scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
  printf("%lld\n", MAX(a * b, c * d));
  return 0;
}

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

ll n,k,a[20],r=LINF;

int main(){
    cin>>n>>k;rep(i,n)cin>>a[i];
    rep(b,1<<n){
        if (b%2==0||__builtin_popcount(b)!=k)continue;
        ll c=a[0]-1,t=0;
        rep(i,n){
            if (b&(1<<i)){
                if(c>=a[i])c++,t+=c-a[i];
                else c=a[i];
            }
            else c=max(c,a[i]);
        }
        r=min(r,t);
    }
    cout<<r<<'\n';
}

Measured memory_bytes: 3636
import java.util.HashSet;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		HashSet<Integer> list = new HashSet<Integer>();
		list.add(0);
		for(int i = 0; i < N; i++) {
			int l = sc.nextInt();
			if(!list.contains(l)) {
				list.add(l);
			}else{
				break;
			}
		}
		if(list.size() == N+1)System.out.println("YES");
		else System.out.println("NO");
	}
}

Measured memory_bytes: 103308
#include "iostream"
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

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

    if (N % 2 != 0) {
        std::cout << 0 << endl;
        return 0;
    }
    long long ans = 0;

    N /= 2;
    while(N){
        ans += N / 5;
        N /= 5;
    }

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

Measured memory_bytes: 256
s = input()
s_list = list(s)
s_set = set(s)
ans = "Yes"
if len(s_set) == 2:
    for i in range(len(s_list)):
        if s_list.count(s_list[i]) != 2:
            ans = "No"
            break
else:
    ans = "No"
print(ans)

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

const double PI = acos(-1);
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
typedef pair<int,int> P;

#define REP(i,n) for (int i = 0; i < (n); i++)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second

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

  int a,b,c;
  cin >>a>>b>>c;
  if (a == b) cout << c;
  else if (a==c) cout << b;
  else cout << a;
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m;
int a[10],b[10];
int main(){
	cin>>n>>m;
	bool p=true;
	for(int i=0;i<m;i++)
	{
		int h,g;
		cin>>h>>g;
		b[h]++;
		if(h==1&&g==0&&n>1)
		p=false;
		if(b[h]==1)
		{
			a[h]=g;
		}
		else
		{
			if(a[h]!=g)
			{
				p=false;
			}
		}
	}
	if(a[1]==0&&p==true&&n>1)
	a[1]=1;
	if(p)
	{
		for(int i=1;i<=n;i++)
		cout<<a[i];
	}
	else
	{
		cout<<-1;
	}
} 

Measured memory_bytes: 256
#include <cstdio>

int N;
int C[500], S[500], F[500];

int main() {
	scanf("%d", &N);
	for (int i = 0; i < N - 1; i++) {
		scanf("%d %d %d", &C[i], &S[i], &F[i]);
	}
	for (int i = 0; i < N; i++) {
		int t = 0;
		for (int j = i; j < N-1; j++) {
			if (t < S[j]) {
				t = S[j];
			}
			else if (t % F[j] == 0) {
				// do nothing
			}
			else {
				t += F[j] - (t % F[j]);
			}
			t += C[j];
		}
		printf("%d\n", t);
	}
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	string s;
	ll k;
	cin>>s>>k;
	ll ocnt = 0;
	while(s[ocnt] == '1')
		ocnt++;
	if(ocnt>=k)
	{
		cout<<"1\n";
	}
	else
	{
		cout<<s[ocnt]<<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 REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int N;
    string S;
    cin >> N >> S;
    int ans = 0;

    for(int i = 0; i < N; i++){
        if(S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C'){
            ans++;
            i+=2;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
let [| h; w; k |] = stdin.ReadLine().Split(" ") |> Array.map int

let f = 
    [| 0 .. (h - 1) |]
    |> Array.map (fun row -> 
      stdin.ReadLine().ToCharArray() 
      |> Array.indexed 
      |> Array.map (fun (col, cell) -> (row, col, string cell)))
    |> Array.reduce Array.append


let rec toMaskIndex num indexes mask = 
  let d = pown 2 num
  let next = num - 1
  match num with
    | -1 -> indexes
    | num -> if mask >= d then toMaskIndex next (num::indexes) (mask - d) else toMaskIndex next indexes mask


let countBlack field (row, col) =
  let rows = toMaskIndex h [] row
  let cols = toMaskIndex w [] col
  let isUse (r, c, _) =
    let hasRow = List.exists (fun elem -> elem = r) rows
    let hasCol = List.exists (fun elem -> elem = c) cols
    hasRow && hasCol
  let isBlack (_, _, cell) = cell = "#"
  field 
  |> Array.filter isUse
  |> Array.filter isBlack
  |> Array.length

[
  for k in 0 .. ((pown 2 h) - 1) do
    for j in 0 .. ((pown 2 w) - 1) -> (k, j)
] 
|> List.map (countBlack f)
|> List.filter (fun x -> x = k)
|> List.length
|> printfn "%d"

Measured memory_bytes: 39328
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define MAX 300005
#define INF 1000005
#define endl "\n"
string arr[10];
char temp[10][10];
lli f[4];
int h,w,k;
string c[] = {"AC", "WA", "TLE", "RE"};
int find(bitset <6> row, bitset <6> col){
    for(int i = 0; i<h; i++){
        for(int j = 0; j<w; j++){
            temp[i][j] = arr[i][j];
        }
    }
    for(int i = 0; i<6; i++){
        if(row[i]){
            for(int j = 0; j<w; j++){
                temp[i][j]  = '0';
            }
        }
    }
    for(int i = 0; i<6; i++){
        if(col[i]){
            for(int j = 0; j<h; j++){
                temp[j][i]  = '0';
            }
        }
    }
    int ctr = 0;
    for(int i = 0; i<h; i++){
        for(int j = 0; j<w; j++){
            if(temp[i][j] == '#')
                ctr++;
        }
    }
    return ctr;
}
int main(){
    
    cin>>h>>w>>k;
    for(int i = 0; i<h; i++)
        cin>>arr[i];
    lli count = 0;
    for(int i = 0; i<(1<<h); i++){
        bitset <6> row(i);
        for(int j = 0; j<(1<<w); j++){
            bitset<6> col(j);
            if(find(row,col) == k){
              
                count++;
            }
            
        }
    }
    cout<<count<<endl;
}


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

using namespace std;

int main(){
  char S[111];
  cin >> S;
  int N = 0;
  while(S[N]) N++;
  bool x = true;
  int i;
  for(i=0;i<=N-1;i++)
    if(S[i] != S[N-1-i]) x = false;
  if(N>=4){
  for(i=0;i<=(N-3)/2;i++)
    if(S[i] != S[(N-3)/2 - i]) x = false;
  for(i=(N+1)/2;i<=N-1;i++)
    if(S[i] != S[N-1-i]) x = false;
    }
  if(x) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	int N; cin >> N;

	int A[200005];

	for (int i = 0;i < N;i++){
		cin >> A[i];
		A[i] -= i+1;
	}

	sort(A,A+N);

	int b = A[N/2];

	ll ans = 0;

	for (int i = 0;i < N;i++){
		ans += abs(A[i] - b);
	}

	cout << ans << endl;

	return 0;

}


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

using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b&&a==c){cout<<"1";}
    else if((a==b&&a!=c)||(a==c&&a!=b)||(b==c&&b!=a)){cout<<"2";}
    else{cout<<"3";}

    return 0;
}


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

struct Edge
{
    int to;
};


void dfs( vector<Edge>* G, vector<int>& dist, int i, int parent = -1 )
{
    if( parent != -1 ) dist[i] = dist[parent] + 1;
    for( auto edge: G[i] )
    {
        if( edge.to != parent ) dfs( G, dist, edge.to, i );
    } 
}

int main()
{
    int N;
    cin >> N;
    vector<Edge> G[100001];
    for( int i = 1; i < N; ++i ){
        int x, y;
        cin >> x >> y;
        G[x].push_back( (Edge){ y } );
        G[y].push_back( (Edge){ x } );
    }


    vector<int> distFromOne(N+1), distFromN(N+1);
    dfs( G, distFromOne, 1 );
    dfs( G, distFromN, N );

    int numBlack = 0;
    for( int i = 1; i <= N; ++i ){
        if( distFromOne[i] <= distFromN[i] ) ++numBlack;
    }

    if( numBlack >= N/2+1 ) cout << "Fennec" << endl;
    else cout << "Snuke" << endl;

    return 0;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define Boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

void Crack() {
	long n,a;
    cin >> n;
    vector <long> A(n);
    for(int i=0;i<n;i++) cin >> A[i];
    long long ans = 0;
    sort(A.begin(),A.end());
    for(int i=0;i<n;i++) {
        for(int j=i+1;j<n;j++) {
            for(int k=j+1;k<n;k++) {
                if(A[i]!=A[j] && A[i]!=A[k] && A[j]!=A[k] && A[i]+A[j]>A[k]) ans++;
            }
        }
    }
    cout << ans << endl;
}

int main() {
	Boost;
    Crack();
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);
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; }

int main () {
  string s;
  cin >> s;
  string sl = s.substr(0,2), sr = s.substr(2);
  if ("01" <= sl && sl <= "12" && "01" <= sr && sr <= "12") puts("AMBIGUOUS");
  if (!("01" <= sl && sl <= "12") && "01" <= sr && sr <= "12") puts("YYMM");
  if ("01" <= sl && sl <= "12" && !("01" <= sr && sr <= "12")) puts("MMYY");
  if (!("01" <= sl && sl <= "12") &&!("01" <= sr && sr <= "12")) puts("NA");
  return 0;
}

Measured memory_bytes: 256
// 2011/07/07 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int X, Y;
		cin >> X >> Y;
		if(X==0&&Y==0)
			break;

		if(X<Y){
			int tmp = X;
			X = Y;
			Y = tmp;
		}

		int cnt = 0;
		do{
			X = X%Y;

			int tmp = X;
			X = Y;
			Y = tmp;

			cnt++;
		}while(Y!=0);

		cout << X << ' ' << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
	static final int COIN = 500;

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		sc.close();
		System.out.println(countCoin(x, y));
	}

	static String countCoin(int x, int y) {
		if (COIN * x >= y) {
			return "Yes";
		}
		return "No";
	}
}

Measured memory_bytes: 21716
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cerr << v[a][b] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	int n,tme = 0;
	double ans = 0;
	
	cin >> n;
	
	vector<int> t(n);
	vector<int> v(n+1);
	
	REP(i,n)
	{
		cin >> t[i];
		tme += t[i];
	}
	REP(i,n)
	{
		cin >> v[i];
	}
	v[n] = 0;
	
	
	double nowv = 0,nowt = 0;
	
	while(nowt < tme)
	{
		double tmp = 0;
		int flag = 0,cou = 0;
		REP(i,n)
		{
			tmp += t[i];
			if(nowt >= tmp)
			{
				cou++;
				continue;
			}
			
			double han = tmp - nowt - (nowv - v[i+1]);
			if(han >= 1)continue;
			else if(han >= 0.5)
			{
				flag = 1;
				continue;
			}
			else
			{
				flag = 2;
				break;
			}
		}
		
		if(flag == 0 && v[cou] > nowv)
		{
			ans += (nowv*2 + 0.5) * 0.25;
			nowv += 0.5;
		}
		else if(flag == 2)
		{
			ans += (nowv*2 - 0.5) * 0.25;
			nowv -= 0.5;
		}
		else
		{			
			ans += nowv * 0.5;
		}
		
		nowt += 0.5;
		//printf("%5f %5f\n",nowv,ans);
	}
	
	printf("%.6f\n",ans);
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>
      
int par[100000];
      
void init(int);
int dep(int);
int inp(void);
     
char *p;
char in[1500000];
int tree[100000][15],idx[100000];
     
int main(){
  int n,i,j,id,k,c;
     
  fread(in,sizeof(in),1,stdin);  
  p = in;
     
  n = inp(); init(n);
  for(i = 0 ; i < n ; i++){
    id = inp();
    k = inp();
    for(j = 0 ; j < k ; j++){
      c = inp();
      par[c] = id;
      tree[id][idx[id]++] = c;
    }
  }
      
  for(i = 0 ; i < n ; i++){
    printf("node %d: parent = %d, depth = %d, "
           ,i,par[i],dep(i));
         
    if(par[i] == -1){
      printf("root, [");
    }else if(!idx[i]){
      printf("leaf, [");
    }else{
      printf("internal node, [");
    }
     
    for(j = 0 ; j < idx[i] ; j++){
      printf("%d",tree[i][j]);
      if(j < idx[i]-1) printf(", ");
    }
    puts("]");
  }
  return 0;
}
     
void init(int n){
  int i;
  for(i = 0 ; i < n ; i++){
    par[i] = -1;
  }
}
     
int dep(int x){
  if(par[x] == -1) return 0;
  return dep(par[x]) + 1;
}
     
int inp(){
  int v = 0;
  while(!isdigit(*p)) ++p;
  v = *p++&15;
  while(isdigit(*p)){
    v = (v<<3)+(v<<1)+(*p++&15);
  }
  return v;
}

Measured memory_bytes: 4056
#include<bits/stdc++.h>
using namespace std;
#define LL long long

int main(){
	// sengen
	int n;
	// nyuryoku
	cin >> n;
	LL ans = 0;
	// keisan
	for(int i=1;i*i<=n;i++){
		LL add = 0;
		LL up;
		if(n%i == 0){
			up = n/i - 1;
		}else{
			up = n/i;
		}
		if(up >= i+1){
			add += (up - i)*2;
		}
		if(i*i < n){
			add += 1;
		}
		ans += add;
	}
	// syutsuryoku
	cout << ans << endl;
}

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

int main() {
	string input;
	int i, sum = 0;
	cin >> input;
	for (i = 0; i < input.length(); i++) {
		sum += input[i] - '0';
	}
	if (sum % 9 == 0) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 3708
N, A, B, K = map(int, input().split())
mod = 998244353
# AとBの組み合わせと、(A+B)と0の組み合わせが可換
# 順番というよりは個数の組み合わせがどうなるかの問題？
# 赤と青の個数の組み合わせは、(無色も含める？)


def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル


for i in range(2, N + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod//i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)
ans = 0
for i in range(N+1):
    D = (K - A*i)
    if D % B == 0 and D//B <= N:
        ans += cmb(N, i, mod) * cmb(N, D//B, mod)
        ans %= mod

print(ans)


Measured memory_bytes: 38948
/*
    If they say
    Who cares if one more light goes out?
    In a sky of a million stars
    It flickers, flickers
    Who cares when someone's time runs out?
    If a moment is all we are
    We're quicker, quicker
    Who cares if one more light goes out?
    Well I do
*/

#include<bits/stdc++.h>
using namespace std;

#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) ((a) / gcd(a,b)) * (b)
#define all(x)  x.begin(),x.end()

#define ll long long
#define ull unsigned long long
#define VI vector<int>
#define VLL vector<ll>
#define VS vector<string>
#define MPII map<int, int>
#define SET set<int>
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795
#define INF (int)1e9
#define MEM(a, b) memset(a, (b), sizeof(a))
#define fast_io   ios_base::sync_with_stdio(false);cin.tie(0),cout.tie(0);

ll MOD = 1e9+7;

ll add(ll a, ll b)
{
    a+=b; a%=MOD;
    if(a<0) a+=MOD;
    return a;
}
ll mult(ll a, ll b)
{
    if(a>MOD) a%=MOD;
    if(b>MOD) b%=MOD;
    ll ans=(a*b)%MOD;
    if(ans<0) ans+=MOD;
    return ans;
}
ll pw(ll a, ll b)
{
    ll r=1;
    while(b){
        if(b&1) r=mult(r,a);
        a=mult(a,a);
        b>>=1;
    }
    return r;
}

void solve(){
    ll a,b;
    cin>>a>>b;
    string tmp="",s;
    for(int i=0;i<b+2;i++)tmp+="#";
    tmp+='\n';
    for(int i=0;i<a;i++){
        cin>>s;
        tmp+="#"+s+"#"+'\n';
    }
    for(int i=0;i<b+2;i++)tmp+="#";
    cout<<tmp<<endl;
}

int main(){
    fast_io;
    ll t, k=0;
    t=1;
    while(t--){
        //k++;
        //cout<<"Case "<<k<<": ";
        solve();
    }
}



Measured memory_bytes: 3636
/*
 * Author:  heyuhhh
 * Created Time:  2020/5/12 16:31:40
 */
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <assert.h>
#define MP make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << std::endl; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
  template <template<typename...> class T, typename t, typename... A> 
  void err(const T <t> &arg, const A&... args) {
  for (auto &v : arg) std::cout << v << ' '; err(args...); }
#else
  #define dbg(...)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 1e5 + 5, MOD = 1e9 + 7;

int mu[N], sum[N], p[N];
bool chk[N];
void init() {
    mu[1] = 1;
    int cnt = 0;
    for(int i = 2; i < N; i++) {
        if(!chk[i]) p[++cnt] = i, mu[i] = -1;
        for(int j = 1; j <= cnt && i * p[j] < N; j++) {
            chk[i * p[j]] = 1;
            if(i % p[j] == 0) {
                mu[i * p[j]] = 0; 
                break;
            }
            mu[i * p[j]] = -mu[i];
        }
    }
    for (int i = 1; i < N; i++) {
        sum[i] = sum[i - 1] + mu[i];
    }
}

int n, k;

int qpow(ll a, ll b) {
    ll res = 1;
    while (b) {
        if (b & 1) res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}

int f(int k) {
    int ans = 0;
    for (int l = 1, r; l <= k; l = r + 1) {
        r = min(k, k / (k / l));
        ans = ((ll)ans + 1ll * (sum[r] - sum[l - 1]) * qpow(k / l, n) % MOD + MOD) % MOD;
    }
    return ans;
}

void run() {
    cin >> n >> k;
    int ans = 0;
    for (int l = 1, r; l <= k; l = r + 1) {
        r = min(k, k / (k / l));
        ans = (ans + (1ll * (l + r) * (r - l + 1) / 2) % MOD * f(k / l) % MOD) % MOD;
    }
    cout << ans << '\n';
}

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

Measured memory_bytes: 4572