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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(10);
    
    int n; cin >> n;
    string s; int x;
    list<int> L;
    REP(mi, n) {
        cin >> s;
        if(s[0] == 'i') {
            cin >> x; L.push_front(x);
        } else if(s.size() == 6) { // delete
            cin >> x;
            for(auto it = L.begin(); it != L.end(); it++) {
                if(*it == x) {
                    L.erase(it);
                    break;
                }
            }
        } else if(s[6] == 'F') {
            L.pop_front();
        } else if(s[6] == 'L') {
            L.pop_back();
        }
    }
    int i = 0;
    for(auto it = L.begin(); it != L.end(); it++) {
        if(i++) cout << " ";
        cout << *it;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 34436
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc135
{
    class D
    {
        private static readonly long mod = 1000000007;

        public static void Main()
        {
            var s = Console.ReadLine();
            var n = s.Length;
            var dp = new long[n, 13];

            if (s[n - 1] == '?')
            {
                for (int i = 0; i <= 9; i++)
                    dp[0, i] = 1;
            }
            else
                dp[0, s[n - 1] - '0'] = 1;

            var d = 10;
            for (int i = 1; i < s.Length; i++)
            {
                if (s[n - 1 - i] == '?')
                {
                    for (int j = 0; j < 13; j++)
                    {
                        for (int k = 0; k <= 9; k++)
                        {
                            var r = (j + k * d) % 13;
                            dp[i, r] = (dp[i, r] + dp[i - 1, j]) % mod;
                        }
                    }
                }
                else
                {
                    int num = s[n - 1 - i] - '0';
                    for (int j = 0; j < 13; j++)
                    {
                        var r = (j + num * d) % 13;
                        dp[i, r] = dp[i - 1, j];
                    }
                }
                d = d * 10 % 13;
            }
            Console.WriteLine(dp[n - 1, 5]);
        }
    }
}


Measured memory_bytes: 36540
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
using namespace std;
using ll = unsigned long long;
using p = pair<int, int>;

int main()
{
    int H, W, K;
    cin >> H >> W >> K;

    vector<vector<int>> m(H, vector<int>(W));

    const int black = 1;

    rep(y, 0, H)
    {
        string s;
        cin >> s;
        rep(x, 0, W)
        {
            char c = s[x];
            if (c == '#')
            {
                m[y][x] = black;
            }
        }
    }
    int ans = 0;
    rep(j, 0, 1 << H)
    {
        rep(i, 0, 1 << W)
        {
            int count = 0;
            rep(y, 0, H)
            {
                rep(x, 0, W)
                {
                    if ((j >> y) & 1)
                        continue;
                    if ((i >> x) & 1)
                        continue;

                    if (m[y][x] == black)
                        ++count;
                }
            }
            if (count == K)
            {
                ++ans;
            }
        }
    }

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


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
int main(){
	int s=1;
	long long x,y;
	scanf("%lld%lld",&x,&y);
	while(x+x<=y){
		x=x+x;
		s++;
	}
	printf("%d\n",s);
	return 0;
}

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



int main() {
int N,K;
  cin>>N>>K;
  string S;
  cin>>S;
   
  if(S.at(K-1)=='A'){S.at(K-1)='a';}
    if(S.at(K-1)=='B'){S.at(K-1)='b';}  
  if(S.at(K-1)=='C'){S.at(K-1)='c';}
cout<<S<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int k=0;
  if(a>b)
    for(int i=b; i>=1 && c>0; i--){
      if(b%i == 0 && a%i == 0){
        c--;
      }
      if (c==0){
         k = i;
         break;
      }
    }
  else{
    for(int i=a; i>=1 && c>0; i--){
      if(b%i == 0 && a%i == 0){
        c--;
      }
      if (c==0){
         k = i;
         break;
      }
    }
  }
  printf("%d\n", k);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	int n, m, a, sum = 0; cin >> n >> m;
	for (int h = 0; h < m; h++) {
		cin >> a;
		sum += a;
	}
	if (sum % (n + 1) == 0) {
		cout << sum / (n + 1) << endl;
	}
	else {
		cout << sum / (n + 1) + 1 << endl;
	}
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007


int main() {
	
char a;
cin>>a;
if(a=='A'){
	ce('T')
}else if(a=='T'){
	ce('A')
}else if(a=='G'){
	ce('C')
}else{
	ce('G')
}

	

}

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

ll n,m,ans;
bool path[9][9],ch[9];

void dep(ll now,ll cnt){
	if(cnt==n){
		ans++;
		return;
	}
	for(int i=1;i<n;i++){
		if(path[now][i]==false){
			continue;
		}
		if(ch[i]==true){
			continue;
		}
		ch[i]=true;
		dep(i,cnt+1);
		ch[i]=false;
	}
}
int main() {
	cin>>n>>m;
	for(int i=0;i<m;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		path[x][y]=path[y][x]=true;
	}
	ch[0]=true;
	dep(0,1);
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;

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


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAX_N=100005;
int x[MAX_N];
int n,A,B; 
int main()
{
	cin>>n>>A>>B;
	for(int i=1;i<=n;i++)
	{
		cin>>x[i];
	}
	LL ans=0;
	for(int i=1;i<n;i++)
	{
		ans+=min((LL)A*(x[i+1]-x[i]),(LL)B);
	}
	cout<<ans<<endl;
	return 0;
}

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

typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003;

int main(){
    
    int N;cin>>N;
    vector<pair<int,int>> A(N);
    for(int i=0;i<N;i++){
        cin>>A[i].first;
        A[i].second=i;
    }
    
    sort(all(A));
    
    int ans=0;
    
    for(int i=0;i<N;i+=2){
        if((A[i].second)%2==1) ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
N = int(input())
H = list(map(int, input().split()))

idou = 0
count = 0
for a, b in zip(H,H[1:]):
    if a >= b:
        count += 1
    else:
        if idou < count:
            idou = count
        count = 0

print(max(idou, count))


Measured memory_bytes: 14252
import java.util.*;

public class Main {
    public static void main(String args[] ) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n+1];
		int[] b = new int[n];
		long count = 0;
		
		for (int i = 0; i<n+1; i++) {
			a[i] = sc.nextInt();
		}
		
		for (int i = 0; i<n; i++) {
			b[i] = sc.nextInt();
		}
		
		for(int i=0; i<n; i++) {
			if(a[i] < b[i]) {
				count += a[i];
				b[i] -= a[i];
				if(b[i] > a[i+1]) {
					count += a[i+1];
					a[i+1] = 0;
				} else {
					count += b[i];
					a[i+1] -= b[i];
				}
			} else {
				count += b[i];
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 64976
#include <stdio.h>
#include <map>

using namespace std;

int main()
{
    map<int,int> mp;
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        int tmp;
        scanf("%d",&tmp);
        mp[tmp]++;
    }
    int num=0;
    for(auto i=mp.begin();i!=mp.end();i++)
    {
        num+=i->second-1;
    }
    if(num&1) printf("%d\n",mp.size()-1);
    else printf("%d\n",mp.size());
}

Measured memory_bytes: 4864
import java.util.*;
import javax.lang.model.util.ElementScanner6;
//import java.lang.Math;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        // 入力
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        //String s = sc.next();

        // 処理
        String out = "";
        while ( a > 0 && c > 0){
            c -= b;
            if ( c <= 0){
                out = "Yes";
                break;
            }
            a -= d;
            if ( a <= 0){
                out = "No";
                break;
            }
        }

        // 出力
        System.out.println(out);
    }
}

Measured memory_bytes: 35780
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>

int main()
{
    /* input */
    int A, B;
    scanf( "%d %d", &A, &B );

    /* process */

    /* output */
    printf( "%d\n", A * B );

    return 0;
}


Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
  
int main() {
    int n;
  	cin >> n;
    vector<int> A(n);
	for(int i =0;i<n;i++){
      cin >> A.at(i);
    }
    int v = 0;
    for(int k=0;k<n;k++){
      v=A.at(k);
      int j = k-1;
      while(j>=0 && A.at(j) > v){
        A.at(j+1) = A.at(j);
        j--;
      }
      A.at(j+1)=v;
      for(int x = 0;x<n-1;x++){
        cout << A.at(x) << ' ';
      }
      cout << A.at(n-1)<< endl;
    }
        
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

class Graph{
	private:
	int n;
	vvp g;
	public:
	vi DIJ(int s){
		priority_queue<P> q;
		vi d(n,inf);
		d[s]=0;
		q.push({0,s});
		while(!q.empty()){
			P p=q.top();
			q.pop();
			int v=p.second;
			if(d[v]<-p.first) continue;
			for(auto i:g[v]){
				int u=i.first,D=d[v]+i.second;
				if(d[u]>D){
					d[u]=D;
					q.push({-D,u});
				}
			}
		}
		return d;
	}
	Graph(int v){
		n=v;
		g=vvp(v);
	}
	void add_edge(int s,int t,int c){
		g[s].push_back({t,c});
		g[t].push_back({s,c});
	}
};

int n;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	map<P,int> mp;
	vp a;
	for(int i=0;i<n;i++){
		int x,y,w;
		cin>>x>>y>>w;
		mp[{x,y}]=w;
		a.push_back({x,y});
	}
	int res=0;
	for(int i=0;i<n;i++){
		int x=a[i].first,y=a[i].second;
		res=max(res,mp[{x,y}]+mp[{x-1,y}]+mp[{x,y-1}]+mp[{x-1,y-1}]);
		res=max(res,mp[{x,y}]+mp[{x+1,y}]+mp[{x,y-1}]+mp[{x+1,y-1}]);
		res=max(res,mp[{x,y}]+mp[{x-1,y}]+mp[{x,y+1}]+mp[{x-1,y+1}]);
		res=max(res,mp[{x,y}]+mp[{x+1,y}]+mp[{x,y+1}]+mp[{x+1,y+1}]);
	}
	cout<<res<<" / 1"<<endl;
}


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

int main() {
  int n; cin >> n;
  int ans = 500;
  for (int a, i = 0; i < n; ++i) {
    scanf("%d", &a);
    ans = min(ans, __builtin_ctz(a));
  }
  cout << ans;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define min(p,q)((p)<(q)?(p):(q))

double p[110];

//辺の情報を個別に持つタイプ
typedef struct edge{ll s,g;}E;
typedef struct graph{
	int vcnt,ecnt;
	E  e[10010];//適宜変える(ecnt)
	int id[110];//適宜変える(vcnt)
}G;
G g;

int esort(const void*a,const void*b){
	E*p=(E*)a,*q=(E*)b;
	if((*p).s<(*q).s)return -1;
	if((*p).s>(*q).s)return  1;
	if((*p).g<(*q).g)return -1;
	return 1;
}
void readgraph(ll n){
	//適宜変える
	int ecnt=0;
	rep(i,0,n){
		int k;
		scanf("%lf%d",p+i,&k);
		while(k--){
			int x,y;
			scanf("%d",&x);
			x--;
			g.e[ecnt].s=i;
			g.e[ecnt].g=x;
			ecnt++;
		}
	}
	g.vcnt=n;
	g.ecnt=ecnt;
	qsort(g.e,g.ecnt,sizeof(E),esort);

	int p=0;
	rep(i,0,g.vcnt){
		while(p<g.ecnt&&g.e[p].s<i)p++;
		g.id[i]=p;
	}
	g.id[g.vcnt]=g.ecnt;//番兵
}

#define VCNT 110
int SCC[VCNT],SCCcnt;//SCC[i]=頂点iが属する強連結成分の番号
int SCCi[VCNT],SCCidx[VCNT];//SCCi[SCCidx[i]:SCCidx[i+1]]=強連結成分iに属する頂点の番号
int adv[VCNT],back[VCNT];
int sccs[VCNT],sccscnt;
int isin[VCNT],scct;
#undef VCNT
void sccdfs(int v){
	adv[v]=back[v]=++scct;
	sccs[sccscnt++]=v;
	isin[v]=1;
	rep(i,g.id[v],g.id[v+1]){
		int u=g.e[i].g;
		if(isin[u]!=2){
			if(isin[u]==0)sccdfs(u);
			back[v]=min(back[v],back[u]);
		}
	}
	if(back[v]==adv[v]){
		int u;
		do{
			u=sccs[--sccscnt];
			isin[u]=2;
			SCC[u]=SCCcnt;
		}while(u!=v);
		SCCcnt++;
	}
}
int sccc(const void*p,const void*q){
	if(SCC[*(int*)p]<SCC[*(int*)q])return -1;
	if(SCC[*(int*)p]>SCC[*(int*)q])return 1;
	if(*(int*)p<*(int*)q)return -1;
	return 1;
}
void scc(){
	SCCcnt=0;
	rep(i,0,g.vcnt)isin[i]=adv[i]=0;
	rep(i,0,g.vcnt)if(!adv[i])sccdfs(i);
	rep(i,0,g.vcnt)SCCi[i]=i;
	qsort(SCCi,g.vcnt,sizeof(int),sccc);

	SCCidx[0]=0;
	SCCidx[SCCcnt]=g.vcnt;
	rep(i,1,g.vcnt)if(SCC[SCCi[i-1]]!=SCC[SCCi[i]])SCCidx[SCC[SCCi[i]]]=i;
}

int main(){
	int n;
	while(scanf("%d",&n),n){
		readgraph(n);
		scc();
		int deg[110]={};
		rep(i,0,g.ecnt)if(SCC[g.e[i].s]!=SCC[g.e[i].g])deg[SCC[g.e[i].g]]++;
		double pp[110]={};
		rep(i,0,SCCcnt)pp[i]=deg[i]?0:1;
		rep(i,0,g.vcnt)pp[SCC[i]]*=p[i];
		double ans=1;
		rep(i,0,SCCcnt)ans*=1-pp[i];
		printf("%.9f\n",ans);
	}
}


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

#define LEN 100005

typedef struct pp{
 char name [100];
 int t;
}P;

P Q[LEN+1];

int head = 0,tail = 0,n;

int cul (int) ;/* q と m をあげる */

int main () {
  int i,m,q,sum = 0;

 scanf ("%d%d",&n,&q);
 tail = n;
 if (n < 1 || n > 100000) return 0;
 if (q < 1 || q > 1000) return 0;

   for(i = 0; i < n; i++) {
    scanf("%s",Q[i].name);
    scanf ("%d",&Q[i].t);
    sum += Q[i].t;
    if(sum > 1000000)return 0;
  }
  cul (q) ;

 return 0;
}

int cul (int q) {
  int i,j = 0,sum = 0,num = 0;

  while (head != tail){
  if (Q[head].t == 0 ){
   head = (head + 1)%(LEN+1);
   continue;
}
/* ０になる場合 */
  if (Q[head].t <= q){
    sum += Q[head].t;
    Q[head].t = 0;
    printf("%s %d\n",Q[head].name,sum);
    j++;
    if(j == n)return 0;
    head = (head+1)%(LEN+1);
    num++;
  }
  else{
     Q[head].t -= q;
     sum += q;
     Q[tail] = Q[head];
     tail = (tail+1)%(LEN+1);
     head = (head+1)%(LEN+1);
   }
  }
  return 0;
}




Measured memory_bytes: 11864
#include<iostream> 
#include<algorithm> 
#include<cassert> 
#include<vector> 
#include<fstream> 
#include<string> 
#include<stdio.h> 
#include<stdlib.h> 
#include<time.h> 
#include<queue> 
#include<map> 
#include<set> 
#include<bitset> 
#include<cmath> 

using namespace std; 
#define REP(i,m,n) for(int i=m;i<n;++i) 
#define REPll(i,m,n) for(long long i=m;i<n;++i) 
#define INF 10000000000000000 
#define MOD 1000000007 
#define ll long long 
#define mp make_pair 
#define all(v) v.begin(),v.end() 

vector<vector<char>>v;

int main() {
    ll h,w;
    cin>>h>>w;
    v.assign(h,vector<char>(w,'.'));
    REP(i,0,h){
        REP(j,0,w){
            char hoge;
            cin>>hoge;
            v[i][j]=hoge;
        }
    }
    REP(i,0,h){
        REP(j,0,w){
            if(v[i][j]=='#'){
                bool error=true;
                if(i!=0){
                    if(v[i-1][j]=='#'){
                        error=false;
                    }
                }
                if(i!=h-1){
                    if(v[i+1][j]=='#'){
                        error=false;
                    }
                }
                if(j!=0){
                    if(v[i][j-1]=='#'){
                        error=false;
                    }
                }
                if(j!=w-1){
                    if(v[i][j+1]=='#'){
                        error=false;
                    }
                }
                if(error==true){
                    cout<<"No"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0; 
}


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

int main() {
  int A,B,C,D;
  char a,b,c,d;
  cin >> a >> b >> c >> d;
  A=a-'0';
  B=b-'0';
  C=c-'0';
  D=d-'0';
  char q,w,e;
  for(int i=0;i<9;i++){
    int sum=A;
    if(i%2==0){
      q='+';
      sum+=B;
    }
    else{
      sum-=B;
      q='-';
    }
    if((i/2)%2==0){
      sum+=C;
      w='+';
    }
    else{
      sum-=C;
      w='-';
    }
    if((i/4)%2==0){
      sum+=D;
      e='+';
    }
    else{
      sum-=D;
      e='-';
    }
    if(sum==7){
      cout << A << q << B << w << C << e << D <<"=7";
      break;
    }
  }
}

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

int main() {
        long long h,w; cin>>h>>w;
        long long ans = 1e12;

        for (int i = 1; i <= h; i++) {
                long long c1,c2;
                c1 = max(i*w, (h-i-(h-i)/2)*w) - min(i*w, ((h-i)/2)*w);
                c2 = max(i*w, (w-w/2)*(h-i)) - min(i*w, (w/2)*(h-i));
                ans = min(ans,min(c1,c2));
        }

        for (int i = 1; i <= w; i++) {
                long long c1,c2;
                c1 = max(i*h, (w-i-(w-i)/2)*h) - min(i*h, ((w-i)/2)*h);
                c2 = max(i*h, (h-h/2)*(w-i)) - min(i*h, (h/2)*(w-i));
                ans = min(ans,min(c1,c2));
        }

        cout<<ans<<endl;
}





Measured memory_bytes: 256
from heapq import heapify,heappop,heappush
N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
AB.sort(key = lambda x: x[0])
Q = []
ans = 0
j = 0
AB.append([10**6,1])
for m in range(1,M+1):
    while AB[j][0] <= m:
        heappush(Q,-AB[j][1])
        j += 1
    if Q:
        t = -heappop(Q)
        ans += t

print(ans)


Measured memory_bytes: 31928
#include<iostream>
#include<vector>
using namespace std;
int main()
{
  int N,Q,M,D;
  int i,max,maxI;
  while(cin>>N>>Q,N|Q){
    vector<int> v(100);
    while(N-->0){
      cin>>M;
      while(M-->0){
	cin>>D;
	v[D]++;
      }
    }
    max=maxI=0;
    for(i=0;i<100;i++){
      if(Q<=v[i]&&max<v[i]){
	max=v[i];
	maxI=i;
      }
    }
    cout<<maxI<<endl;
  }
}

Measured memory_bytes: 904
#include <bits/stdc++.h>
using namespace std;
int a[5];
int main()
{
  int r,g,b,n;
  int ans = 0;
  scanf("%d%d%d%d",&r,&g,&b,&n);
  for(int i = 0 ; i * r <= n; i++)
  {
    for(int j = 0 ; j * g + i * r <= n ; j++)
    {
      if((n - j*g  - i * r) % b == 0) ans ++; 
    }
  }
  cout<<ans<<endl;
}

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


using namespace std;

typedef long long ll;

int a[]={1,3,5,7,8,10,12};
int b[]={4,6,9,11};
int c[]={2};
int vis[22];
int main()
{
    for(int i=0;i<7;i++)
        vis[a[i]]=1;
    for(int i=0;i<4;i++)
        vis[b[i]]=2;
    for(int i=0;i<1;i++)
        vis[c[i]]=3;
    int x,y;
    scanf("%d%d",&x,&y);
    if(vis[x]==vis[y]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
char s[N];
int main()
{
    scanf("%s",s+1);
    int a=0,n=strlen(s+1);
    long long ans=0;
    for(int i=1;i<=n-1;i++)
    {
        if(s[i]=='A') a++;
        else if(s[i]=='B'&&s[i+1]=='C')
        {
            ans+=a;
            i++;
        }
        else a=0;
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 384
//Atcoder que 1
//Abhishek Pandey
    #include<bits/stdc++.h>
    #define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #define ll long long
    #define ld long double
    #define debug(n1) cout << n1 << endl
    #define fi(i,a,N) for(ll i=a; i<N; i++)
    #define fd(i,a,N) for(ll i=a; i>N; i--)
    using namespace std;
    int main(){
    SPEED;
    string s,t;
    cin>>s>>t;
    int m=s.length();
    t.erase(m);
    if(s==t)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    return 0;
    }

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

int main() {
    int N; cin >> N;
    long int sum = 0;
    for (int i = 1; i <= N; i++) {
        if (i % 3 != 0  && i % 5 != 0) {
            sum += i;
        }
    }
    cout << sum << endl;
}


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

#define REP(i, n) for (int i = 0; i < (int)n; i++)

int K, T;

int main()
{
  cin >> K >> T;

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

  vector<pair<int, int>> pa;
  REP(i, T) pa.push_back(pair<int, int>(a[i], i));

  int pt = -1;
  int cnt = 0;
  REP(i, K) {
    sort(pa.begin(), pa.end());

    bool f = false;
    for (int t = T-1; t >= 0; t--) {
      if (pa[t].second != pt && pa[t].first > 0) {
        pa[t].first--;
        pt = pa[t].second;
        f = true;
        break;
      }
    }

    if (f) continue;

    for (int t = T-1; t >= 0; t--) {
      if (pa[t].first > 0) {
        cnt++;
        pt = pa[t].second;
        break;
      }
    }
  }

  cout << cnt << endl;


  return 0;
}

Measured memory_bytes: 256
a,b=map(int,input().split())
def so(n):
    import collections
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return collections.Counter(a)
x=so(b)
ans=1
for y in x.keys():
  ans*=y**(x[y]//a)
print(ans)
    

Measured memory_bytes: 3316
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

struct dat{
	int fx;
	int fy;
	int tx;
	int ty;
};

int main(){
	int H,W; cin>>H>>W;
	vector<vector<int>> nap(H, vector<int> (W));
	rep(i,H)rep(j,W)cin>>nap[i][j];
	int ans_count = 0;
	vector<dat> ans;
	rep(i,H-1){
		rep(j,W){
			if(nap[i][j] % 2 == 1){
				--nap[i][j];
				++nap[i+1][j];
				ans.push_back({i, j, i+1, j});
				++ans_count;
			}
		}
	}
	rep(j,W-1){
		if(nap[H-1][j] % 2 == 1){
			--nap[H-1][j];
			++nap[H-1][j+1];
			ans.push_back({H-1, j, H-1, j+1});
			++ans_count;
		}
	}
	cout<<ans_count<<endl;
	rep(i,ans.size()){
		dat e = ans[i];
		printf("%d %d %d %d\n", e.fx+1, e.fy+1, e.tx+1, e.ty+1);
	}
	return 0;
}

Measured memory_bytes: 5232
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;

int main()
{
    long long int n, m, a[100010];
    long long int dp[100010] = {};
    bool cant[100010] = {};
    dp[1] = 1;
    dp[2] = 2;

    cin >> n >> m;

    for (int i = 0; i < m; i++) {
        cin >> a[i];
        cant[a[i]] = 1;
    }

    if (cant[1] == 1) {
        dp[1] = 0;
        dp[2] = 1;
    }
    if (cant[2] == 1) {
        dp[2] = 0;
    }
    for (int i = 3; i <= n; i++) {
        if (cant[i] == 1) {
            dp[i] = 0;
        }
        else {
            dp[i] += dp[i-1];
            dp[i] %= 1000000007;
            dp[i] += dp[i-2];
            dp[i] %= 1000000007;
        }
    }

    cout << dp[n] << endl;
}

Measured memory_bytes: 1920
import math
A, B, H, M = list(map(int, input().split()))

h_deg = (90 - ((360 / 12) * H + 30*M/60)) % 360
m_deg = (90 - (360 / 60) * M) % 360

h_rad = h_deg * (math.pi/180)
m_rad = m_deg * (math.pi/180)

h_x = A * math.cos(h_rad)
h_y = A * math.sin(h_rad)
m_x = B * math.cos(m_rad)
m_y = B * math.sin(m_rad)

ans = math.sqrt((h_x - m_x)**2 + (h_y - m_y)**2)
print(ans)


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

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

using namespace std;
using ll=long long;

const int INF = 100000;

int main() {
    float R;
    float res;
    cin >> R;
    res = 2 * R * M_PI;
    cout << res;
    return 0;
}


Measured memory_bytes: 3764
N,M = map(int,input().split(" "))
ab = [list(map(int,input().split(" "))) for i in range(M)]
#print(ab)
ans = [0 for i in range(N+1)]
for i in range(M):
    ans[ab[i][0]]+=1
    ans[ab[i][1]]+=1
    #print(ab[i][0])
    #print(ab[i][1])
for i in range(1,len(ans)):
    print(ans[i])
    

Measured memory_bytes: 3060
import collections
r, g, b, n = map(int, input().split())

#sum_rg = collections.Counter()
sum_rg = collections.defaultdict(int)

for i in range(n + 1):
    if n < r*i:
        break
    for j in range(n + 1):
        if n < r*i + g*j:
            break
        sum_rg[r*i + g*j] += 1

ans = 0
for k in range(n + 1):
    if n < b*k:
        break
    ans += sum_rg[n - b*k]

#print(sum_rg)
print(ans)


Measured memory_bytes: 41436
#include<cmath>
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<bitset>
#define int long long
using namespace std;
const int maxn=100005,mod=1e9+7;
int n,a,b;
inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')
			f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
inline void write(int a)
{
	if(a<0)
	{
		putchar('-');
		write(-a);
	}
	else
	{
		if(a>=10)
			write(a/10);
		putchar(a%10+'0');
	}
}
signed main()
{
	cin>>a>>b;
	for(int i=1;i<=1000;++i)
	{
		if((int)(i*0.08)==a&&(int)(i*0.1)==b)
		{
		cout<<i;
		return 0;
		}
	} 
	cout<<-1;
	return 0;
}

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

set<int> aloneNum;

int dfs(int t, int S){
    if(t > 12){
        int retVal =12;
        vector<int> selcted;
        for(int i=0;i<24;i++){
            if(S &(1<<i)){
                selcted.push_back(i);
            }
        }
        selcted.push_back(24);
        // cerr << "cal" << endl;
        for(int i=0;i<selcted.size();i++){
            // cerr << selcted[i] << endl;
            if(i==0){
                continue;
            }
            int temp = selcted[i]-selcted[i-1];
            retVal = min(retVal,min(temp,24-temp));
        }
        return retVal;
    }
    if(aloneNum.find(t) != aloneNum.end()){
        return max(dfs(t+1,S|(1<<t)),dfs(t+1,S|(1<<(24-t))));
    }
    return dfs(t+1,S);

}

int main(){
    int N;
    cin >> N;
    vector<int> D(N+1);
     vector<int> num(13,0);
    for(int i=0;i<N;i++){
        cin >> D[i];
        num[D[i]] ++;
    }
    num[0]++;
    if(num[0] >1 || num[12] >1){
        cout << 0 << endl;
        return 0;
    }
    
    int S =1;
    for(int i=1;i<=12;i++){
        if(num[i] >2){
            cout << 0 << endl;
            return 0;
        }
        if(num[i] == 2){
            S |= (1<<i);
            S |= (1<<(24-i));
        }else if(num[i] == 1){
            aloneNum.insert(i);
        }
    }

    // cerr << bitset<24>(S) << endl;

    cout << dfs(0,S) << endl;
   
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	double sum = 0.0;
	for(int i=0;i<n;i++)
	{
		double a;
		cin>>a;
		double c = 1/a;
		sum+=c;
	}
	double ans = 1/sum;
	printf("%.12f",ans);
	return 0;
}

Measured memory_bytes: 256
if True:
    n,m=map(int,input().split())
    s=[(0,0) for i in range(n)]
    for i in range(n):
        s[i]=list(map(int,input().split()))
    #print(s)
else:
    n,m=2,5
    s=[(4,9),(2,4)]
s=sorted(s,key=lambda x: x[0])
#print(s)
d=0
ans=0
for i in range(n):
    pr=s[i][0]
    b=s[i][1]
    if d+b<m:
        ans+=pr*b
        d+=b
    else:
        ans+=(m-d)*pr
        break
print(ans)

Measured memory_bytes: 29836
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
// #define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    vi d(n);
    rep(i,n)cin>>d[i];
    SORT(d);
    n/=2;
    cout<<d[n]-d[n-1]<<endl;
}

Measured memory_bytes: 640
class Array
  def gcd
    self.inject{|a,b| a.gcd(b)}
  end
end

n = gets.to_i

renban = [*1..n]
kumiawase = renban.repeated_combination(3).to_a

result = 0
kumiawase.each do |a|
  size = a.uniq.size
  if size == 1
    result += a.gcd
  elsif size == 2
    result += (a.gcd * 3)
  else
    result += (a.gcd * 6)
  end
end

puts result

Measured memory_bytes: 115728
def cmb(n, r, mod):
    if r < 0 or n < r:
        return 0
    r = min(r, n - r)
    numerator, denominator = 1, 1
    for i in range(1, r + 1):
        numerator = (numerator * (n + 1 - i)) % mod
        denominator = (denominator * i) % mod
    return numerator * pow(denominator, mod - 2, mod) % mod


def solve():
    n, a, b = map(int, input().split())
    MOD = 10 ** 9 + 7
    
    ans = pow(2, n, MOD) - 1
    ans -= cmb(n, a, MOD)
    ans -= cmb(n, b, MOD)
    print(ans % MOD)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
# define pll pair<ll,ll>

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n;
	cin>>n;
	vector<int> is_prime(n+1);
	for(int i=0;i<=n;i++)
	is_prime[i]=i;
	
    for (int i = 2; i * i <= n; i++) {
        if (is_prime[i]==i) {
        for (int j = i * i; j <= n; j += i)
            is_prime[j] = i;
    }
    }
	
	ll ans = 0 ;
	//cout<<is_prime[14]<<"\n";
	for(int i=1;i<n;i++){
		int x = n-i;
		ll mid = 1;
		int cnt = 0;
		int temp = is_prime[x];
		map<int,int> m;
		while(x!=1){
			++m[is_prime[x]];
			x = x/is_prime[x];
		}	
		map<int,int> :: iterator it;
		for(it = m.begin();it!=m.end();it++){
			mid = mid *(it->second+1);
		}
		ans += mid;
	//	cout<<n-i<<" "<<mid<<"\n";
	}
	cout<<ans;
	return 0;
}

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

using namespace std;

#define all(x) (x).begin(), (x).end()

typedef long long ll;

void solve(){
	int n;
	cin >> n;
	vector<ll> a(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
		if(a[i] == 0) {
			cout << 0;
			return;
		}
	}
	
	ll prod = 1;
	for(auto x : a) {
		if (x <= 1000000000000000000 / prod) {
			prod *= x;
		} else {
			cout << -1;
			return;
		}
	}
	cout << prod;
}

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

	solve();
    
    return 0;
}


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


int main() {
  int N, M;
  cin >> N >> M;
  
  int a, b;
  vector<int> x(N);
  for (int i=0; i<M; i++) {
    cin >> a >> b;
    x.at(a-1) += 1;
    x.at(b-1) += 1;
  }
  
  //sort(x.begin(), x.end());
  for (auto n : x) {
    cout << n << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3604
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define pb push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=a;i>b;i--)
#define mkp(a,b) make_pair(a,b)
#define all(v) v.begin(),v.end()
#define max3(a,b,c) max(a,(max(b,c))
#define min3(a,b,c) min(a,(min(b,c))
#define read(a) cin>>a
#define readt(a,b) read(a),read(b)
using namespace std;
bool compare(pair<int,int>& p1,pair<int,int>& p2)
{
    return p1.second<p2.second;
}
int main()
{
    fastio
    string s,t;
    readt(s,t);
    int ans=INT_MAX;
    rep(i,0,s.size()-t.size()+1)
    {
        int tans=0;
        rep(j,i,i+t.size())
        {
            if(s[j]!=t[j-i]) tans++;
            // cout<<s[j]<<" "<<t[j-i]<<"\n";
        }
        ans=min(ans,tans);
        // cout<<ans<<" "<<tans<<" "<<i<<"\n";
    }
    cout<<ans;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fi first
#define se second
#define pb push_back
#define mk make_pair
using namespace std;
typedef long long ll;
typedef long double lld;
const ll INF = 1e18;
const ll MOD = 1e9+7;
 
ll fastpowMOD(ll a, ll p,ll MOD);
ll fastpowMOD(ll a, ll p,ll MOD){ if(p==0) return 1; a %= MOD; ll z = fastpowMOD(a,p/2,MOD); z = (z*z)%MOD; if(p%2) z = (z*a)%MOD; return z; }
 
ll lcm(ll a,ll b){
    return (a*b)/__gcd(a,b);
}


void solve(){
	ll n;
	cin>>n;
	vector<ll> dp(n+1,0);
	
	for(ll i=1;i<=n;i++){
		
		for(ll j=i;j<=n;j+=i){
			dp[j]++;
		}
		
	}
	ll ans = 0;
	for(ll i=1;i<=n;i++){
		ans += i*dp[i];
	}
	cout<<ans<<"\n";
}

int main(){
    fastio;
    int t;
    t=1;
    //cin>>t
    for(int i=1;i<=t;i++){
    	solve();
	}
    
	
}




Measured memory_bytes: 81348
import sys
input = sys.stdin.readline

mod = 10**9+7

N, K = map(int, input().split())

ans = 0
dp = [None]*(K+1)
for n in reversed(range(1, K+1)):
    L = K//n
    p = pow(L, N, mod)
    for i in range(2, L+1):
        p = (p - dp[n*i]) % mod
    
    dp[n] = p
    ans = (ans + p*n) % mod

print(ans)

Measured memory_bytes: 68768
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	
	//角
	//■■
	//■■
	//3+1＝4 パリティ変わらず

	//辺
	//■■■
	//■■■
	//5+1=6 パリティ変わらず

	//それ以外の内部
	//8+1=9 パリティ変わるので裏返る。

	//一番外側を除いた面積なので(n-2)*(m-2)

	LL n, m; cin >> n >> m;

	if (n == 1 && m == 1) {
		cout << 1 << endl;
		return 0;
	}

	if (n >= 2) {
		n = n - 2;
	}

	if (m >= 2) {
		m = m - 2;
	}

	cout << n*m << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; 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(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  ll X;
  cin >> X;
  ll s = 100;
  rep(k,100000) {
    s = ll(s*1.01);
    if(s>=X) {
      cout << k+1 << endl;
      return 0;
    }
  }
  return 0;
}

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

int main() {
    int group[] = {0,1,3,1,2,1,2,1,1,2,1,2,1};
    int a, b;
    cin >> a >> b;


    if (group[a] == group[b]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn func(x: i64, y:i64)->i64{
    if x == 0 || y == 0 {
        0
    }
    else if x >= y {
        3 * (x / y) * y + func(y, x % y)
    } else {
        func(y, x)
    }
}

fn main(){
    let n: i64 = read();
    let x: i64 = read();
    println!("{}", func(x, n - x));
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

Measured memory_bytes: 4352
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class A753 {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int x;
	    in >> x;
	    if(x == 7 || x == 5 || x == 3) ans2(true, out);
	    else ans2(false, out);
	}
};


int main() {
	A753 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int main() {
    int a, b;
    cin >> a >> b;
    if (a > 8 || b > 8) {
        cout << ":(" << endl;
    } else {
        cout << "Yay!" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define input(array) repi(array##_itr, array) { cin >> *(array##_itr); }
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n,d;
	int ans=0;
	cin >>n>>d;
	cout<<(n+2*d)/(2*d+1)<<endl;
}

Measured memory_bytes: 3528
#include <iostream>
#include <set>
#include <vector>
#include <numeric>
#include <cstring>

using namespace std;

#define forsn(i,s,n) for(int i = (s);i < (int)(n);i++)
#define forn(i,n) forsn(i,0,n)

typedef long long int tint;

int a[64], b[64];
bool pos[64][64];

int main() {
	int n; cin >> n;
	forn(i,n) cin >> a[i];
	forn(i,n) cin >> b[i];
	
	memset(pos, 0, sizeof(pos));
	
	forn(i,n) {
		if (a[i] != b[i] && a[i] < ((2 * b[i]) + 1)) {
			cout << -1 << endl;
			return 0;
		}
		pos[i][a[i]] = 1;
	}
	
	tint res = 0;
	forn(j, 60) {
		tint biggest = -1;
		forn(i,n) {
			if (pos[i][b[i]]) continue;
			
			tint best_fori = 5000;
			
			forsn(a_val, 2 * b[i] + 1, 64) if (pos[i][a_val]) {
				tint best = a_val - b[i] + 1;
				forsn(d, b[i] + 1, a_val - b[i] + 1) {
					if (a_val % d == b[i] ||
						(a_val % d) >= ((2 * b[i]) + 1)) {
						best = d;
						break;
					}
				}
				best_fori = min(best_fori, best);
			}
			biggest = max(biggest, best_fori);
		}
		if (biggest == -1) break;
		else {
			res |= (1LL << biggest);
			forn(i,n) {
				forn(k, 60) if (pos[i][k]) {
					pos[i][k % biggest] = true;
				}
			}
		}
	}
	
	cout << res << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
// #include<bits/stdc++.h>
using namespace std;
#define ll long long
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;


int main(){
  int A,B,C,X,Y;
  cin >> A >> B >> C >> X >> Y;
  int sum=A*X+B*Y;
  int ans=sum;
  int x=X,y=Y;
  for(int i=1; i<=max(X,Y); i++){
    int res=sum;
    res += C*2;
    if(x>0){
      res -= A;
    }
    if(y>0){
      res -= B;
    }
    ans = min(ans,res);
    sum = res;
    x--;
    y--;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
#define int long long
 
 
#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define rrep(i, a) for (int i = (int) a-1; i >= 0; i--)
#define rreps(i, a, b) for (int i = (int) (a)-1; i >= (int) (b); i--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__ "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
 
#ifdef LOCAL
#define lcout(a) cout << a;
#define lcoutln(a) cout << a << endl;
#define lcerr(a) cerr << a;
#define lcerrln(a) cerr << a << endl;
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif
 
vector<int> a;
int N;
 
signed main()
{
	cin >> N;
	rep(i, N) {
		CIN(int, t);
		a.PB(t);
	}
	int res = 0;
	int cnt = 0;
	int sum = 0;
	rep(i, N) {
		sum += a[i];
		if (sum <= 0) {
			cnt += -sum + 1;
			sum = 1;
		}
		i++;
		if (i == N) break;
		sum += a[i];
		if (sum >= 0) {
			cnt += sum + 1;
			sum = -1;
		}
	}
	res = cnt;
	sum = 0;
	cnt = 0;
	rep (i, N) {
		sum += a[i];
		if (sum >= 0) {
			cnt += sum + 1;
			sum = -1;
		}
		i++;
		if (i == N) break;
		sum += a[i];
		if (sum <= 0) {
			cnt += -sum + 1;
			sum = 1;
		}
	}
	res = min(res, cnt);
	cout << res << endl;
}

Measured memory_bytes: 1400
n = int(input())
s = input()
num = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
m = n - 3
l = []

for i in num:
    for j in num:
        for k in num:
            if i in s:
                a = s.index(i)
                if j in s[a+1:]:
                    b = s[a+1:].index(j)
                    if k in s[a+1:][b+1:]:
                        l.append(i+j+k)

print(len(set(l)))

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

int main(){

  int n,i,j,k,key;
  int *a;

  scanf("%d",&n);

  a = malloc(sizeof(int)*n);
  
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  
  
  for(i=1;i<n+1;i++){
    for(k=0;k<n;k++){
      printf("%d",a[k]);
      if(k==n-1)printf("\n");
      else     printf(" ");
    }
    
    key = a[i];
    j = i - 1;
    
    while( j >= 0 && a[j] > key){
      a[j+1] = a[j];
      j--;
      a[j+1] = key;
    }
  }
  


  return 0;
}



Measured memory_bytes: 2072
L,R=map(int,input().split())
min=20000
newR=L+2019
if newR<R: #Rを小さくする
    R=newR
for i in range(L,R): #L～R-1
    for j in range(i+1,R+1): #i+1～R
        a=(i*j)%2019
        if a<min:
            min=a
print(min)

Measured memory_bytes: 3060