akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include <iomanip>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  string S;
  cin>>S;
  for(int i=0;i<=S.size()-9;i++) cout<<S[i];
  return 0;}


Measured memory_bytes: 3552
#include<bits/stdc++.h>
#define fo(i,l,r) for(int i=l;i<=r;i++)
#define of(i,l,r) for(int i=l;i>=r;i--)
#define fe(i,u) for(int i=head[u];i;i=e[i].next)
#define el putchar('\n')
#define ta putchar('	')
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
inline void open(const char *s)
{
	#ifndef ONLINE_JUDGE
	char str[20];
	sprintf(str,"%s.in",s);
	freopen(str,"r",stdin);
//	sprintf(str,"%s.out",s);
//	freopen(str,"w",stdout);
	#endif
}
inline int rd()
{
	static int x,f;
	x=0;f=1;
	char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
	for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+ch-'0';
	return f>0?x:-x;
}
const int N=100010;
int n,L,T,a[N];

int main()
{
//	open("a");
	n=rd();L=rd();T=rd();
	ll p=1;
	fo(i,1,n){
		int x=rd(),y=rd();
		if(y==1){
			a[i]=(x+T)%L;
			p=(p+(x+T)/L%n)%n;
		}
		else{
			a[i]=(x-T%L+L)%L;
			p=(p+n-(T+L-1-x)/L%n)%n;
		}
	}
	sort(a+1,a+n+1);if(p==0)p=n;
	fo(i,p,n)printf("%d\n",a[i]);
	fo(i,1,p-1)printf("%d\n",a[i]);
	return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define pb push_back
#define ff first 
#define ss second
#define mod 1000000007
#define lim 100005
#define nfs_mw ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

int main()
{
	int i,j,n,k,t,h[lim],dp[lim] = {};
	cin>>n>>k;
	for(i=1; i<=n; i++) cin>>h[i];
	for(i=n-1; i; i--){
		dp[i] = mod;
		for(j=i+1; j<=min(i+k,n); j++)
			dp[i] = min(dp[i], dp[j] + abs(h[i]-h[j]));
	}
	cout<<dp[1];
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int maxn=400000+10;
int head[maxn];  //前向星的写法，头数组的记录 
bool vis[maxn];  //标记数组 
int num[maxn];   //记录有多少个子节点 
int node[maxn];  //记录结点到子树的结点的最大深度 
int que[maxn];   //模拟数组 
int nod[maxn];   //记录图的直径上的结点（不包括起点和终点）的连接其他零散点（即不在直径上的点）的个数 
struct Edge {
	int u,v;
	int next;
} edge[maxn];
int n,m;        //n个点，m条边 
int tol;        //前向星的写法，记录边的总数 
int cnt;        //直径上的点的数量记录 
int ans;        //答案输出的，因为要最小序列输出，ans不断变化，要记录为全局变量 
int S,T;        //树的直径的起点和终点 
bool flag;      //flag记录是否可以构成"毛虫图" 
void init() {   //初始化 
	memset(head,-1,sizeof(head));
	memset(node,0,sizeof(node));
	memset(num,0,sizeof(num));
	tol=0;
	cnt=0;
	ans=1;
	flag=true;
}
void add(int u,int v) {  //前向星的写法,添加边 
	edge[tol].u=u;
	edge[tol].v=v;
	edge[tol].next=head[u];
	head[u]=tol++;
}
int bfs(int s) {         //bfs求一个点到另一个最远点的距离 
	int l=0,r=0;
	memset(vis,0,sizeof(vis));
	memset(que,0,sizeof(que));
	que[r++]=s;
	vis[s]=1;
	while(l<=r) {
		s=que[l++];
		for(int i=head[s]; i!=-1; i=edge[i].next) {
			int v=edge[i].v;
			if(vis[v]==0) {
				vis[v]=1;
				que[r++]=v;
			}
		}
	}
	return que[r-1];
}
void dfs(int u) {     //dfs求出结点到子树的结点的最大深度(node[]),判断是否可以构成"毛虫图” 
	if(!flag)         //以及，树的直径上的结点连接其他零散点的个数 
		return;
	int top=0;
	vis[u]=1;
	for(int i=head[u]; i!=-1; i=edge[i].next) {
		int v=edge[i].v;
		if(vis[v]==0) {
			dfs(v);
			node[u]=max(node[u],node[v]);
			if(node[v]>1) top++;
			if(v!=T&&node[v]==1)
				num[u]++;
		}
	}
	node[u]++;
	if(top>=2) {   //一个结点，连接有两个及以上的node[]>1的结点 ，肯定无法构成"毛虫图" 
		flag=false;
		return;
	}
	if(u!=S&&u!=T&&node[u]>=2)
		nod[cnt++]=num[u];
}
void printf_(int u) {  //用递归的方法输出ans,对于num[u]>0的数，要先输出它的连接点 
	int t=ans;
	vis[u]=1;
	if(num[u]>0) {
		for(int i=1; i<=num[u]; i++) {
			printf("%d ",++ans);
		}
	}
	printf("%d%c",t,u==T?'\n':' ');
	ans++;
	for(int i=head[u]; i!=-1; i=edge[i].next) {
		int v=edge[i].v;
		if(v==T||v==S||node[v]>1) {
			if(!vis[v])
				printf_(v);
		}
	}
}
int read() {   //数据输入有点大，想试试能快几ms的 
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') {
		if(ch=='-')
			f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch) {
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
}
int main() {
	while(~scanf("%d",&n)) {
		init();
		m=n-1;
		int u,v;
		for(int i=0; i<m; i++) {
			//scanf("%d %d",&u,&v);
			u=read();
			v=read();
			add(u,v);
			add(v,u);
		}
		T=bfs(1);
		S=bfs(T);
		memset(vis,0,sizeof(vis));
		dfs(S);
		/*cout<<S<<" "<<T<<endl;
		cout<<cnt<<endl;
		for(int i=1; i<=n; i++)
			printf("%d%c",node[i],i==n?'\n':' ');
		for(int i=1; i<=n; i++)
			printf("%d%c",num[i],i==n?'\n':' ');
		for(int i=0; i<cnt; i++)
			printf("%d%c",nod[i],i==cnt-1?'\n':' ');
		*/
		reverse(nod,nod+cnt);   //dfs得到的nod[]其实是从T到S的nod[]数据，reverse反转元素的顺序，得到S到T的nod[]数据 
		for(int i=0; i<cnt; i++) {
			if(nod[i]<nod[cnt-i-1])   //nod[i]越大的应该也越往后才输出，这样保证输出的字典序最小 
				break;
			else if(nod[i]>nod[cnt-i-1]) {
				swap(S,T);
				break;
			}
		}
		memset(vis,0,sizeof(vis));
		if(!flag)
			printf("-1\n");
		else
			printf_(S);
	}
}

Measured memory_bytes: 19968
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        int num = Integer.parseInt(a+b);
        boolean can = false;
        for(int i = 1; i*i<= num;i++){
            if(i*i == num){
                can = true;
                break;
            }
            else{
                can = false;
            }
        }
        if(can){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin >> A >> B;
  int s = 1;
  int c = 0;
  while(1){
    if (s >= B){
      cout << c;
      break;
    }
    c++;
    s += A - 1;
  }
}

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

typedef long long ll;

int main(){
    ll n,a,b;cin >> n >> a >> b;
    if(abs(a-b)%2==0){
        cout << abs(a-b)/2 << endl;
    }else if(a<b){
        ll ans1=0,ans2=0;
        //一回端っこに行く
        ans1+=a-1+1;
        ans1+=abs(1-(b-ans1))/2;
        //一回端っこに行く
        ans2+=n-b+1;
        ans2+=abs((a+ans2)-n)/2;
        cout << min(ans1,ans2) << endl;
    }else if(a>=b){
        ll ans1=0,ans2=0;
        //一回端っこに行く
        ans1+=b-1+1;
        ans1+=abs((a-ans1)-1)/2;
        //一回端っこに行く
        ans2+=n-a+1;
        ans2+=abs(n-(b+ans2))/2;
        cout << min(ans1,ans2) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl
#define SHOWA(x,n) for( int yui = 0; yui < n; yui++ ){ cout << x[yui] << " "; } cout << endl

#define pb emplace_back
#define fi first
#define se second

using namespace std;

typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
typedef vector<vi> mi;
     
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ld EPS = 1e-12;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> inline T sq( T a ){ return a * a; }

ll in(){ long long int x; scanf( "%lld" , &x ); return x; }
char yuyushiki[1000010]; string stin(){ scanf( "%s" , yuyushiki ); return yuyushiki; }

// head

int n;
ld d;
ld x;
ld ans;

int main(){

  n = in();
  d = in();
  x = in();

  for( int i = n; i >= 1; i-- ){
    ans += ( 2 * i * d + x * i * ( 2 * i - 1 ) ) / ( 2 * i );
    d = ( d * ( 2 * i + 2 ) + 5 * x ) / ( 2 * i );
    x = x * ( 2 * i + 4 ) / ( 2 * i );
  }

  printf( "%.18lf\n" , (double)ans );

  return 0;
}


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


using namespace std;


int x;

int main()
{
	scanf("%d", &x);
	
	if (x >= 30) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	
	return 0;
}



Measured memory_bytes: 1648
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}

int main(){
	int K, T;
	cin >> K >> T;
	vector<int> A(T);
	rep(i, T) cin >> A[i];
	Cout(max(2*(*max_element(all(A))) - K - 1, 0));
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


void print(vector<vector<int> > G){
  int N = G.size();
  int M = 0;
  for(int i=0;i<N;i++) M += G[i].size();
  cout<<M<<endl;
  for(int i=0;i<N;i++)
    for(int to:G[i]) cout<<i + 1<<" "<<to + 1<<endl;
}

signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  cin>>N;
  vector<vector<int> > G(N);
  if(N%2 == 1){
    for(int i=0;i<N;i++)
      for(int j=i+1;j<N;j++)
	if(i+1 + j+1 != N) G[i].push_back(j);
  }
  else{
    for(int i=0;i<N;i++)
      for(int j=i+1;j<N;j++)
	if(i+1 + j+1 != N + 1) G[i].push_back(j);
  }

  print(G);

  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int n;
	while(cin>>n,n){
		int in[1010][4]={0};
		rep(i,n)rep(j,4)cin>>in[i][j];
		int a,b,c,d;
		vector<int>out;
		cin>>a>>b>>c>>d;
		rep(i,n){
			if(a>=in[i][1]&&
			   b>=in[i][2]&&
			   c>=in[i][3]&&
			   d>=4*(in[i][1]+in[i][3])+9*in[i][2])out.pb(in[i][0]);
		}
		if(out.size())rep(i,out.size())cout<<out[i]<<endl;
		else cout<<"NA"<<endl;
	}
}

Measured memory_bytes: 1244
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define repe(i,n) for(int i=0;i<n;i++)
#define repa(i,j,n) for(int i=j;i<n;i++)
//#define v.all() v.begin(),v.end()
#define repr(i,n) for(int i=n;i>=0;i--)
#define int long long int
#define vi vector<int>
#define vpi vector<pair<int,int>>
int gcd(int a,int b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
vi primef(int n){
	vi a,ref;
	a.push_back(1);
	while(n%2==0) {
		a.push_back(2);
		n/=2;
	}
	for(int i=3;i<=sqrt(n);i+=2){
		while(n%i==0){
			a.push_back(i);

			n/=i;
		}
	}
	if(n>2) a.push_back(n);
	sort(a.begin(), a.end());
	ref.push_back(a[0]);
	for(int i=1;i<a.size();i++){
		if(a[i]!=a[i-1]) {
			ref.push_back(a[i]);
		}
	}
	return ref;
}
int powe(int a,int b){
	int ans=0;
	while(a>=b){
		b*=2;
		ans++;
	}
	return ans;
}
signed  main(){
	int t=1;
	//cin>>t;
	while(t--) {
		int a,b,c,k;
		cin>>a>>b>>c>>k;
		int ck=1;
		if(a<b && b<c) cout<<"Yes"<<endl;
		else {
			if(a>=b){
				
				int pow2=powe(a,b) ;
				if(pow2<=k){
					k-=pow2;
					b=b*pow(2,pow2);
				}
				else ck=0;
			}
			if(b>=c){
				int pow2=powe(b,c) ;
				if(pow2<=k){
					k-=pow2;
					c=c*pow(2,pow2);
				}
				else ck=0;
			}
			if(ck) cout<<"Yes"<<endl;
			else cout<<"No"<<endl;
		}

	}
	return 0;
}

Measured memory_bytes: 3976
S = input()
N = len(S)
res = [0] * len(S)

a = b = 0
for i in range(N):
        if S[i] == 'R':
            a += 1
            if b != 0:
                res[i-b] += (b+1)//2
                res[i-b-1] += (b)//2
                b = 0
        elif S[i] == 'L':
            b += 1
            if a != 0:
                res[i-1] += (a+1)//2
                res[i] += (a)//2
                a = 0
if b != 0:
    res[N-b] += (b+1)//2
    res[N-b-1] += (b)//2

print(" ".join([str(x) for x in res]))


Measured memory_bytes: 10492
#include <bits/stdc++.h>
using namespace std;
int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output14.txt", "w", stdout);
#endif
	//ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	int a[n], b[n], c[n];
	for (int i = 0; i < n; i++)
		cin >> a[i] >> b[i] >> c[i];
	int dp[n][3];
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];
	for (int i = 1; i < n; i++)
	{
		dp[i][0] = a[i] + max(dp[i - 1][1], dp[i - 1][2]);
		dp[i][1] = b[i] + max(dp[i - 1][0], dp[i - 1][2]);
		dp[i][2] = c[i] + max(dp[i - 1][0], dp[i - 1][1]);
	}
	cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2]));
//cout << "\n";
}

Measured memory_bytes: 5952
#include <map>
#include <set>
#include <list>
#include <ctime>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <cstdlib>
#include <utility>
#include <iostream>
#include <algorithm>
using namespace std;
long long a[30];
int main ( ) {
	string s;
	long long i,l;
	long long ans=0;
	cin>>s;
	l=s.length();
	for (i=0;i<l;i++) a[s[i]-96]++;
	for (i=1;i<=26;i++) {
		if (a[i]>1) ans+=(a[i]-1)*a[i]/2;
	}
	cout<<l*(l-1)/2-ans+1<<endl;
	return 0;
}

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

int A, B, K;
int num[100];
int main(){
    int count = 0;
    cin >> A >> B >> K ;

    for(int i=1; i<=100; i++){
	if(A%i==0 && B%i==0){
	    num[count] = i;
	    count++;
	}	    
    }

    cout << num[count-K] << endl;
    
}


Measured memory_bytes: 256
N,M=map(int,input().split())

A = []
for  i in range(M):
    x = [x for x in input().split()]
    x[0] = int(x[0])
    A.append(x)

p = [0]*N
a = [False]*N

for i in range(M):
    t = A[i][0]-1
    if a[t]==True:
        pass
    else:
        if A[i][1] =='AC':
            a[t] = True
        else:
            p[t] += 1

ans_p = 0
for i in range(N):
    if a[i]==True:
        ans_p += p[i]

print(sum(a), ans_p)


Measured memory_bytes: 27096
import java.util.Scanner;

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

        long W = scanner.nextLong();
        long H = scanner.nextLong();
        long x = scanner.nextLong();
        long y = scanner.nextLong();

        double area = W * H / 2.0;
        int flag = (x + x == W && y + y == H) ? 1 : 0;

        System.out.printf("%f %d%n", area, flag);
    }
}


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

using namespace std;

#define N 300000

int n,lst[N][30],f[N];
vector<int> ans;
char s[N];

int main(){
	scanf("%s",s+1); n=strlen(s+1);
	reverse(s+1,s+n+1);
	f[0]=1;
	for (int i=1;i<=n;++i){
		for (int j=0;j<26;++j) lst[i][j]=lst[i-1][j];
		lst[i][s[i]-'a']=i;
		f[i]=i+1;
		for (int j=0;j<26;++j){
			if (!lst[i][j]) f[i]=1;
			else f[i]=min(f[i],f[lst[i][j]-1]+1);
		}
	}
	for (int i=n;i>=0;--i){
		for (int j=0;j<26;++j){
			if (!lst[i][j]||f[i]==f[lst[i][j]-1]+1){
				ans.push_back(j);
				i=lst[i][j];
				break;
			}
		}
	}
	for (int i:ans) putchar(i+'a'); puts("");
	
	return 0;
}
			

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

int main()
{
	long long int n,i,j,k;
	cin>>n>>k;
	int a[n];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	int dp[n];
	dp[0]=0;
	for(i=1;i<n;i++)
	{
		int ans=INT_MAX;
		for(j=1;j<=k;j++)
		{
			if(i-j>=0)
			{
				int p=a[i]-a[i-j];
				if(p<0)
				{
					p=-p;
				}
				ans=min(ans,dp[i-j]+p);
			}
			else
				break;
		}
		dp[i]=ans;
	}
	cout<<dp[n-1];
}

Measured memory_bytes: 1024
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

int main()
{
	int A, B;
	cin >> A >> B;

	if (A + B >= 10) {
		cout << "error" << endl;
	}
	else {
		cout << A + B << endl;
	}


}






Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
     
     
typedef long long ll;
typedef vector <int> vi;
typedef pair <int,int> pi;
typedef tuple <int,int,int> ti;

#define forn(i,a,n) for(int i = a; i < n ; i++)
#define mem(str,a) memset(str, a, sizeof(str));
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(nullptr)
const int MOD = 1e9+7, N = 1e7 + 10, E = 1e-9;
/*
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
//vector <int> show;
//for (auto x : show)
//   cout << x << " ";
getline(cin,s);


*/

int main() {
    int n;
    string s;
    cin >> n >> s;
    int temp = 0, max = 0;
    forn(i,0,s.size()) {
        if(s[i] == 'I') {
            temp++;
            if(temp > max)
                max = temp;
        }
        else
            temp--;
    }
    cout << max << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		new Main().mainrun();
	}

	private Scanner scan;
	private char[] s1,s2;

	private int dp[][];

	private void mainrun() {

		scan = new Scanner(System.in);

		s1 = scan.nextLine().toCharArray();
		s2 = scan.nextLine().toCharArray();

		dp = new int[s1.length + 1][s2.length + 1];

		dp[0][0] = 0;

		for(int i = 1;i < s1.length + 1;i++) {
			dp[i][0] = i;
		}

		for(int i = 1;i < s2.length + 1;i++) {
			dp[0][i] = i;
		}

		for(int i = 1;i < s1.length + 1; i++) {
			for(int j = 1; j < s2.length + 1;j++) {
				dp[i][j] = Math.min(Math.min(dp[i-1][j]+1,dp[i][j-1]+1)
									, dp[i-1][j-1] +( s1[i-1] == s2[j-1] ? 0:1));
			}
		}

		System.out.println(dp[s1.length][s2.length]);

		scan.close();
	}
}



Measured memory_bytes: 30884
#include <algorithm>
#include<iostream>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using lll = long long;
using ull = unsigned long long;
using namespace std;


struct Edge{
  int to;
  int weight;
  Edge(int t,int w){
    to = t;
    weight = w;
  }
};

using Graph = vector<vector<Edge>>;
vector<int> color;

void dfs(const Graph &g,long v,int col){
  color[v] = col;
  //cout << "dfs:" << v << endl;

  for(auto next_v : g[v]){


    if(color[next_v.to] != -1){ continue;}

    //cout << "to:" << next_v.to << endl;
    
    if(next_v.weight % 2 == 0){
      dfs(g,next_v.to,col);
    }

    else{
      dfs(g,next_v.to,1-col);
    }
    
  }

}

int main(){
  lll ii,jj,kk;
  vector<int> ret;
  
  long n;
  cin >> n;

  Graph g(n);

  color.assign(n,-1);
  
  for(ii=0;ii<n-1;ii++){
    int from, to, weight;


    
    cin >> from >> to >> weight;

    //cout << "from:" << from << "to:" << to << "weight" <<weight <<endl;
    
    g[from-1].push_back(Edge(to-1, weight));
    g[to-1].push_back(Edge(from-1, weight));

    //cout << "ii:" << ii << endl;
  }
  //cout << "end of input" << endl;
  dfs(g,0,0);

  for(auto v : color){
    cout << v << endl;
  }
  return 0;
}


Measured memory_bytes: 8192
n,a,b=map(int,input().split())
mod=10**9+7

def power_func(a,n,mod):
  bi=str(format(n,"b"))
  res=1
  for i in range(len(bi)):
    res=(res*res)%mod
    if bi[i]=='1':
      res=(res*a)%mod
  return res

def cmb1(x,y,mod):
  l=1
  for g in  range(x+1-y,x+1):
    l*=g
    l%=mod
  for k in range(1,y+1):
    l*=power_func(k,mod-2,mod)
    l%=mod
    
  return l
    
  return ans

ans=power_func(2,n,mod)-1
ans1=cmb1(n,a,mod)
ans2=cmb1(n,b,mod)

print((ans-ans1-ans2)%mod)

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

int color[9] = {0};
int N, a;

int main () {
  cin >> N;
  for (int i=0; i<N; i++) {
    cin >> a;
    if (a < 400) color[0] = 1;
    else if (a < 800) color[1] = 1;
    else if (a < 1200) color[2] = 1;
    else if (a < 1600) color[3] = 1;
    else if (a < 2000) color[4] = 1;
    else if (a < 2400) color[5] = 1;
    else if (a < 2800) color[6] = 1;
    else if (a < 3200) color[7] = 1;
    else color[8]++;
  }
  int minc = 0, maxc = 0;
  for (int i=0; i<8; i++) if (color[i]==1) minc++;
  if (minc==0) {
    minc = 1;
    maxc = color[8];
  }
  else maxc = minc + color[8];
  
  cout << minc << " " << maxc << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void) {
    int a[2];
    int n, m;
    int min=1000;
    int cost[2] = {0};
    for (int j = 0; j < 3; j++) {
        cin >> a[j];
    }
    for (int i = 0; i < 3; i++) {
        n = i+1;
        m = i + 2;
        if (n ==3) { n = 0; }
        if (m > 2) { m = m-3; }
        if (abs(a[i] - a[n ]) > abs(a[i] - a[m])) {
            cost[i] = abs(a[i] - a[m]) + abs(a[n] - a[m]);
        }
        else {
            cost[i] = abs(a[i] - a[n ]) + abs(a[n ] - a[m]);
        }
        if (cost[i] < min) {
            min = cost[i];
        }
    }
    cout << min << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

using LL = long long;
using P = pair<int, LL>;
using V = vector<LL>;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN_LL(v) LL v;cin>>v;
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<endl
#define INF 1000000001

int main() {
  IN(N);

  vector<vector<P>> edge(N, vector<P>());
  REP(i, N-1) {
    IN(a); IN(b); IN_LL(c);
    edge[a-1].push_back(make_pair(b-1, c));
    edge[b-1].push_back(make_pair(a-1, c));
  }

  V cost(N, INF);
  vector<bool> visited(N, false);

  IN(Q); IN(K); K -= 1;
  cost[K] = 0;
  queue<int> q; q.push(K);

  while(!q.empty()) {
    int p = q.front(); q.pop();
    visited[p] = true;
    for (const auto& e : edge[p]) {
      if (visited[e.first])
        continue;
      q.push(e.first);
      cost[e.first] = cost[p] + e.second;
    }
  }

  REP(i, Q) {
    IN(x); IN(y);
    x -= 1; y -= 1;
    OUT(cost[x] + cost[y]);
  }

  return 0;
}


Measured memory_bytes: 9984
#include<stdio.h>
#include<math.h>

#define SIZE 1000

int main(){
	int i, ii;
	int a[SIZE];
	int b[SIZE];
	for(i=0;i < SIZE;i++){
		a[i] = 0;
	}
	for(i=0;i < SIZE;i++){
		b[i] = 0;
	}
	
	i = 0;
	ii = 0;
	while(1){
		scanf("%d %d", &a[i], &b[i]);
		if( (a[i] == 0) && (b[i] == 0)) break;
		i++;
		ii++;
		if(i > SIZE) break;
	}
	i = 0;
	int j, k, l;
	while(1){
		for(l=0;l<ii;l++){
			for(j=0;j<a[i];j++){
				for(k=0;k<b[i];k++){
					printf("#");
				}
				printf("\n");
			}
			i++;
			printf("\n");
		}
		break;
	}
	return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

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

  int N;
  cin>>N;
  vector<int> A(N);
  rep(i,N) cin>>A[i];

  ll all=0;
  rep(i,N) all^=A[i];

  vector<int> ans(N,0);
  for(int i=0;i<N;i++) ans[i]=all^A[i];
  rep(i,N) cout<<ans[i]<<" ";
  cout<<endl;

  return 0;
}


Measured memory_bytes: 4768
import sys
import os
import math
import bisect
import itertools
import collections
import heapq
import queue
import array

# 時々使う
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

# 再帰の制限設定
sys.setrecursionlimit(10000000)


def ii(): return int(sys.stdin.buffer.readline().rstrip())
def il(): return list(map(int, sys.stdin.buffer.readline().split()))
def fl(): return list(map(float, sys.stdin.buffer.readline().split()))
def iln(n): return [int(sys.stdin.buffer.readline().rstrip())
                    for _ in range(n)]


def iss(): return sys.stdin.buffer.readline().decode().rstrip()
def sl(): return list(map(str, sys.stdin.buffer.readline().decode().split()))
def isn(n): return [sys.stdin.buffer.readline().decode().rstrip()
                    for _ in range(n)]


def lcm(x, y): return (x * y) // math.gcd(x, y)


# MOD = 10 ** 9 + 7
MOD = 998244353
INF = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, K = il()
    D = [il() for _ in range(K)]

    dp = [0] * (N)
    dp[0] = 1
    acc = 0
    for i in range(1, N):
        for l, r in D:
            if i - l >= 0:
                acc += dp[i-l]
                acc %= MOD
            if i - r - 1 >= 0:
                acc -= dp[i-r-1]
                acc %= MOD
        dp[i] = acc
    print(dp[-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 17264
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

int main(){
	
	int n,k; cin>>n>>k;
	ll ans = 1e10;
	vector<int> h(n);
	for(auto &i:h) cin>>i;
	sort(h.begin(),h.end());
	for(int i=0; i+k-1<n; i++){
		ans = min<ll>(ans,h.at(i+k-1)-h.at(i));
	}
	cout <<ans<< endl;
}


Measured memory_bytes: 640
/*input
2 3
8 20

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
 
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int x = i, c = 0;
    while (x) {
      c++;
      x /= 10;
    }
    ans += (c & 1);
  }
  cout << ans << endl;
 
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int[] A = new int[N];
		double av = 0;
		for(int i = 0;i < N;i++) {
			int a = scn.nextInt();
			av += a;
			A[i] = a;
		}
		av /= (double)N;
		int num = 0;
		double diff = Double.MAX_VALUE;
		for(int i = 0;i < N;i++) {
			int a = A[i];
			if(diff > Math.abs((double)a - av)) {
				diff = Math.abs((double)a - av);
				num = i;
			}
		}

		System.out.println(num);






	}
}


Measured memory_bytes: 23124
import collections
N=int(input())
a=list(map(int,input().split()))
def judge(a):
    if sum(a)==0:
        return True
    else:
        a=dict(collections.Counter(a))
        if len(a.keys())==3:
            a0=list(a.keys())[0]
            a1=list(a.keys())[1]
            a2=list(a.keys())[2]
            if a0^a1==a2 and a[a0]==a[a1] and a[a1]==a[a2]:
                return True
        if len(a.keys())==2:
            a0=list(a.keys())[0]
            a1=list(a.keys())[1]
            if a0==0 or a1==0:
                if a[a0]==2*a[a1] or a[a1]==2*a[a0]:
                    return True
    return False

if judge(a):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 16920
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define enld endl

int main() {
	char A;
	cin >> A;
	if (isupper(A)) {
		cout << 'A' << endl;
	}
	else {
		cout << 'a' << endl;
	}
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll INF = 10000000000000007;

    ll H, W;
    cin >> H >> W;
    ll ans = INF;
    for (ll h = 1; h < H; h++) {
        ll s1 = h * W;
        //縦縦
        ll h2 = (H - h) / 2;
        ll s2 = h2 * W;
        ll s3 = (H - h - h2) * W;
        ll dis = max(s1, max(s2, s3)) - min(s1, min(s2, s3));
        ans = min(dis, ans);
        //縦横
        ll w = W / 2;
        s2 = (H - h) * w;
        s3 = (H - h) * (W - w);
        dis = max(s1, max(s2, s3)) - min(s1, min(s2, s3));
        ans = min(dis, ans);
    }
    for (ll w = 1; w < W; w++) {
        ll s1 = H * w;
        // 横横
        ll w2 = (W - w) / 2;
        ll s2 = H * w2;
        ll s3 = H * (W - w - w2);
        ll dis = max(s1, max(s2, s3)) - min(s1, min(s2, s3));
        ans = min(dis, ans);
        // 横縦
        ll h = H / 2;
        s2 = h * (W - w);
        s3 = (H - h) * (W - w);
        dis = max(s1, max(s2, s3)) - min(s1, min(s2, s3));
        ans = min(dis, ans);
    }
    cout << ans << endl;
}


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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef pair<int, int> pi;

int H, W, h, w;
const int maxn = 505;

int a[maxn][maxn];

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> H >> W >> h >> w;
    if(H % h == 0 and W % w == 0){
        cout << "No" << endl;
    }else{
        bool trans = false;
        if(H % h){
            swap(H, W);
            swap(h, w);
            trans = true;
        }
        for(int i = 1;i <= H;i++){
            for(int j = 1;j <= W;j++){
                if((j - 1) % w == 0){
                    a[i][j] = 1e8;
                }else if((j - 1) % w == w - 1){
                    a[i][j] = -1e8 - 1;
                }else{
                    a[i][j] = 0;
                }
            }
        }
        if(trans){
            swap(H, W);
            for(int i = 1;i <= max(H, W);i++){
                for(int j = 1;j < i;j++){
                    swap(a[i][j], a[j][i]);
                }
            }
        }
        cout << "Yes" << endl;
        for(int i = 1;i <= H;i++){
            for(int j = 1;j <= W;j++){
                cout << a[i][j] << ((j == W) ? '\n' : ' ');
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3840
# 決めつけ法。どの木でもY/Nは変わらないと決めつけて、
# 1,2,3……がこの順に一列に並ぶ木を使う　と時間オーバー
# 1と、2以降が全てつながる木を使う

N,M = gets.split(" ").map { |v|
	v.to_i
}

arr = Array.new(N-1, 0)
	
M.times {
	a,b = gets.split(" ").map { |v|
		v.to_i
	}
	
	if (a == 1)then
		arr[b-2] += 1
	elsif (b == 1) then
		arr[a-2] += 1
	else
		arr[a-2] += 1
		arr[b-2] += 1
	end
	
}

if arr.map{|i| i%2}.max == 0 then
	puts "YES"
else
	puts "NO"
end
	

Measured memory_bytes: 3324
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
typedef long long ll;
using namespace std;
int pn[55]={11,31,41,61,71,101,131,151,181,191,
            211,241,251,271,281,311,331,401,421,431,
            461,491,521,541,571,601,631,641,661,691,
            701,751,761,811,821,881,911,941,971,991,
            1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,
            1291,1301,1321,1361,1381
            };
int main(void){
    int n;cin>>n;
    rep(i,n)cout<<pn[i]<<" ";
    cout<<endl;
}


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

typedef uint32_t ui;

static const ui INF = 1 << 30;

ui cost[101][101][2];

int main() {
  int n, m;
  while (cin >> n >> m, n | m) {
    fill_n(cost[0][0], sizeof(cost) / sizeof(ui), INF);
    for (int i = 1; i <= m; i++) cost[i][i][0] = cost[i][i][1] = 0;
    while (n--) {
      int a, b, c, t;
      cin >> a >> b >> c >> t;
      cost[a][b][0] = c;
      cost[b][a][0] = c;
      cost[a][b][1] = t;
      cost[b][a][1] = t;
    }

    for (int k = 1; k <= m; k++) {
      for (int i = 1; i <= m; i++) {
        for (int j = i + 1; j <= m; j++) {
          for (auto&& r : {0, 1}) {
            cost[i][j][r] = cost[j][i][r] = min(cost[i][k][r] + cost[k][j][r], cost[i][j][r]);
          }
        }
      }
    }

    int k;
    cin >> k;
    while (k--) {
      int p, q, r;
      cin >> p >> q >> r;
      cout << cost[p][q][r] << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a,b;
    while(cin>>a>>b)
    {
        if(a=='H'&&b=='H')
            printf("H\n");
        else if(a=='D'&&b=='D') printf("H\n");
        else printf("D\n");
    }
    return 0;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio();
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    switch (n) {
        case 2: cout << s; break;
        default: cout << s[2] << s[1] << s[0]; break;
    }
    //cout << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s. \n";
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll long long
#define inf 9999999999999999
#define F first
#define S second
#define eb emplace_back
#define mpp make_pair
#define P(x) cout<<__LINE__ <<": "<<#x<<' '<<(x)<<'\n'
#define dbg cout<<__LINE__ <<": 0manush\n"
#define read(x) freopen("input.txt","r",stdin)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pi 2*acos(0.0)
#define ee exp(1)
#define mx 50000
#define mod 1000000007
using namespace std;

int main(){//read(x);
//fast;
ll r,g,h,i,j,x,t,y,z=0,e,f,a,b,c,d,n,m,l,k;
cin>>n;l=0;
for(i=1;i<n;i++){
    a=ceil((double)n/(double)i)-1;
    //cout<<a<<endl;
    l+=a;
}
cout<<l<<endl;
}





















Measured memory_bytes: 3632
n = int(input())
a = list(map(int, input().split()))
ans = 1
if n == 1 or n == 2:
  ans = 1
else:
  b = [a[0], a[1]]
  if a[1] - a[0] > 0:
    f = '+'
  elif a[1] - a[0] < 0:
    f = '-'
  elif a[1] - a[0] == 0:
    f = ''
  for i in range(2, n):
    if f == '+' and a[i] - b[-1] >= 0:
      b.append(a[i])
      f = '+'
    elif f == '+' and a[i] - b[-1] < 0:
      b = [a[i]]
      f = ''
      ans += 1
    elif f == '-' and a[i] - b[-1] <= 0:
      b.append(a[i])
      f = '-'
    elif f == '-' and a[i] - b[-1] > 0:
      b = [a[i]]
      f = ''
      ans += 1
    elif f == '' and a[i] - b[-1] > 0:
      b.append(a[i])
      f = '+'
    elif f == '' and a[i] - b[-1] < 0:
      b.append(a[i])
      f = '-'
    elif f == '' and a[i] - b[-1] == 0:
      b.append(a[i])
      f = ''
print(ans)

Measured memory_bytes: 20468
#include<bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;  
#define ordered_set tree<ll, null_type , less<ll> , rb_tree_tag , tree_order_statistics_node_update> 
#define ll long long
#define ull unsigned long long
#define pb push_back
#define inf 1e18
#define mk make_pair
#define ld long double
#define mod 1000000007
#define fi first
#define se second
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test ll t; cin>>t; while(t--)
ll power(ll a,ll n)
{
    ll p;
    if(n==0)
    {
        return 1;
    }
    p=power(a,n/2);
    p=((p%mod)*(p%mod))%mod;
    if(n%2==1)
    {
        p=((p%mod)*(a%mod))%mod;
    }
    return p;
}
int main()
{
    ll n;
    cin>>n;
    ll a[n],i;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    vector<set<ll>>v(1000001);
    ll x,y,val,val1;
    for(int i=0;i<n;i++)
    {
        x=a[i];
        y=0;
        while(x%2==0)
        {   
            y++;
            x/=2;
        }
        v[2].insert(y);
        for(int j=3;j<=sqrt(x);j++)
        {
            if(x%j==0)
            {
                y=0;
                while(x%j==0)
                {
                    y++;
                    x/=j;
                }
                v[j].insert(y);
            }
        }
        if(x>2)
        {
            v[x].insert(1);
        }
    }
    ll ans=1;
    for(int i=1;i<1000001;i++)
    {
        if(v[i].size()>0)
        {
            x=*v[i].rbegin();
            ans=((ans%mod)*(power(i,x)%mod))%mod;
        }
    }
    ll b[n];
    val=0;
    for(int i=0;i<n;i++)
    {
        b[i]=((ans%mod)*(power(a[i],mod-2)%mod))%mod;
        val=(val+b[i])%mod;
    }
    cout<<val<<'\n';
    return 0;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  int answer = 0;
  
  if (A > B) answer += B;
  else answer += A;
  if (C > D) answer += D;
  else answer += C;
  
  cout << answer << endl;
} 

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d %d %d", $w, $h, $x, $y);
$s = $w * $h / 2;
$f = 0;
if ($x * 2 == $w && $y * 2 == $h) {
	$f = 1;
}
echo "$s $f";

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

int main(){
	int n , max = 0 , sum = 0 , o  ;
	const int k = 1e5 ;
	cin >> n ;
	int arr[2 * n] ;
	for( int i = 0 ; i < 2 * n ; i++ ){
		cin >> arr[i] ;
	}
	for( int j = 1 ; j <= 2 * n ; j ++ ){
		max = 0 ;
		for( int i = 0 ; i < 2 * n ; i++ ){
			if( arr[i] > max ){
				max = arr[i] ;
				o = i  ;
			}
		}
		arr[o] = -1 ;
		if( j % 2 == 0 ){
			sum += max ;
		}
	}
	cout << sum ;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define vpll vector<pll>
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
#define pb push_back
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;
using namespace std;

int main(){
    ll H, W, N; cin >> H >> W >> N;
    if(H < 3 && W < 3){
        rep(i, 0, 10) cout << 0 << endl;
        return 0;
    }
    map<pll, ll> m;
    rep(i, 0, N){
        ll _a, _b; cin >> _a >> _b;
        _a--; _b--;
        for(int i=-1; i<= 1; i++){
            for(int j=-1; j<= 1; j++){
                ll newa = _a + i;
                ll newb = _b + j;
                if(0 <= newa && newa < H && 0 <= newb && newb < W){
                    pll ind = {newa, newb};
                    if(m.find(ind) != m.end()) m[ind]++;
                    else m[ind] = 1;
                }
            }
        }
    }
    vl ans(10, 0);
    for(auto &e : m){
        // cout << "map: " << e.first << ", " << e.second << endl;
        ll newa = e.first.first;
        ll newb = e.first.second;
        if(0 <= -1 + newa && 1 + newa < H && 0 <= -1 + newb && 1 + newb < W){
            ans[e.second]++;
        }
    }
    ans[0] = (H - 2) * (W - 2);
    rep(i, 1, 10){
        ans[0] -= ans[i];
    }
    rep(i, 0, 10){
        cout << ans[i] << endl;
    }

    return 0;
}




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

using namespace std;

#define PI 3.14159265358979323846264338327950L

int main(void){
    int L,R,d,ans=0;

    cin>>L>>R>>d;

    for(int i=L;i<=R;i++){
        if(i%d == 0)ans++;
    }

    cout<<ans<<endl;

    return 0;
}



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

#define INF_LL 1e18
#define INF 1e9

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()

using namespace std;

using ll = long long;
using PII = pair<int, int>;

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

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

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

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

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

ll mod(int x, int m){
	if(x < 0){
		return m-(-x%m);
	}
	return x%m;
}

int main(void){
	int N, C, K;
	ll T[114514];
	ll num = 1;
	ll b_n = 1;
	ll b_t;
	cin >> N >> C >> K;
	REP(i, N){
		cin >> T[i];
	}
	sort(T, T+N);

	b_t = T[0];
	FOR(i, 1, N){
		if(b_t+K < T[i] || b_n >= C){
			b_t = T[i];
			b_n = 1;
			num++;
		}else{
			b_n++;
		}
	}
	cout << num << endl;
}


Measured memory_bytes: 1024
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    n, k = input_int_list()
    ans = 0
    for i in range(1, n + 1):
        start = i
        cnt = 0
        while start < k:
            start *= 2
            cnt += 1
        ans += 1 / (n * 2**cnt)
    print(ans)
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 65448
package main

import "fmt"

func main() {
	var N, D, X int
	fmt.Scan(&N, &D, &X)
	var count int
	for i := 1; i <= N; i++ {
		var A int
		fmt.Scan(&A)
		count += (D-1)/A + 1
	}
	fmt.Println(count + X)
}

Measured memory_bytes: 512
N = int(input())
A = list(map(int, input().split()))

m = [0] * N
for i in range(N):
    c = 0
    while A[i] % 2 == 0:
        c += 1
        A[i] = A[i] // 2
    m[i] = c
print(min(m))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#include <cstring>
using namespace std;
#define ll  long long
#define endl '\n'
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll x;
    cin>>x;
    ll m=sqrtl(x);
    for (int i=m;i>0;i--){
        if (x%i==0){
            cout<<x/i+i-2<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256