akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>

typedef long long LL;

const int N=25005;
const int MOD=1000000007;

int n,k,m,a[N],f[N][405],g[N][405],ls[405];

int ksm(int x,int y)
{
	int ans=1;
	while (y)
	{
		if (y&1) ans=(LL)ans*x%MOD;
		x=(LL)x*x%MOD;y>>=1;
	}
	return ans;
}

int jc(int n)
{
	int ans=1;
	for (int i=1;i<=n;i++) ans=(LL)ans*i%MOD;
	return ans;
}

int main()
{
	scanf("%d%d%d",&n,&k,&m);
	for (int i=1;i<=m;i++) scanf("%d",&a[i]);
	int mx=0,now=0,tot=(LL)(n-m+1)*ksm(k,n-m)%MOD;
	for (int i=1;i<=m;i++)
	{
		now=std::min(now+1,i-ls[a[i]]);
		ls[a[i]]=i;mx=std::max(mx,now);
	}
	if (mx==k) {printf("%d",tot);return 0;}
	if (mx==m)
	{
		f[0][0]=1;
		for (int i=1;i<=n;i++)
		{
			int s=0,t=0;
			for (int j=k-1;j>=1;j--)
			{
				(s+=f[i-1][j])%=MOD;
				(t+=g[i-1][j])%=MOD;
				(f[i][j]+=(LL)f[i-1][j-1]*(k-j+1)%MOD)%=MOD;
				(g[i][j]+=(LL)g[i-1][j-1]*(k-j+1)%MOD)%=MOD;
				(f[i][j]+=s)%=MOD;
				(g[i][j]+=t)%=MOD;
				if (j>=m) (g[i][j]+=f[i][j])%=MOD;
			}
		}
		int w=0;
		for (int i=1;i<=k;i++) (w+=g[n][i])%=MOD;
		w=(LL)w*jc(k-m)%MOD*ksm(jc(k),MOD-2)%MOD;
		printf("%d",(tot+MOD-w)%MOD);
	}
	else
	{
		int u=0,v=0;
		memset(ls,0,sizeof(ls));
		for (int i=1;i<=m;i++)
			if (!ls[a[i]]) u++,ls[a[i]]=1;
			else break;
		memset(ls,0,sizeof(ls));
		for (int i=m;i>=1;i--)
			if (!ls[a[i]]) v++,ls[a[i]]=1;
			else break;
		f[0][u]=g[0][v]=1;
		for (int i=1;i<=n;i++)
		{
			int s=0,t=0;
			for (int j=k-1;j>=1;j--)
			{
				(s+=f[i-1][j])%=MOD;
				(t+=g[i-1][j])%=MOD;
				(f[i][j]+=(LL)f[i-1][j-1]*(k-j+1)%MOD)%=MOD;
				(g[i][j]+=(LL)g[i-1][j-1]*(k-j+1)%MOD)%=MOD;
				(f[i][j]+=s)%=MOD;
				(g[i][j]+=t)%=MOD;
			}
		}
		for (int i=0;i+m<=n;i++)
		{
			int s=0,t=0;
			for (int j=1;j<k;j++) (s+=f[i][j])%=MOD,(t+=g[n-m-i][j])%=MOD;
			(tot+=MOD-(LL)s*t%MOD)%=MOD;
		}
		printf("%d",tot);
	}
	return 0;
}

Measured memory_bytes: 79488
n = int(input())
a = list(map(int,input().split()))
l = []
l_even = [i for i in a if i % 2 == 0]
for i in range(n):
  if a[i] % 2 == 0:
    if a[i] % 3 == 0 or a[i] % 5 == 0:
    	l.append(1)

if sum(l) != len(l_even):
  print('DENIED')
else:
  print('APPROVED')

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

int main() {
    int n;
    float x0, y0, r;
    float x1, y1, x2, y2, x3, y3;
    float x12, y12, x32, y32;

    scanf("%d", &n);
    for (int i=0; i<n; i++) {
        scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3);
        x12 = x1 - x2;
        y12 = y1 - y2;
        x32 = x3 - x2;
        y32 = y3 - y2;

        x0 = (y32*(x12*(x1+x2)+y12*(y1+y2))-y12*(x32*(x3+x2)+y32*(y3+y2)))/(2*x12*y32-2*y12*x32);
        y0 = (-x32*(x12*(x1+x2)+y12*(y1+y2))+x12*(x32*(x3+x2)+y32*(y3+y2)))/(2*x12*y32-2*y12*x32);
        r = sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0));
        printf("%.3f %.3f %.3f\n", x0, y0, r);
    }

    return 0;
}


Measured memory_bytes: 2036
#include<stdio.h>
int main(void){
    int  i,j,n,m,a[100][100]={0},b[100]={0},k = 0;
    scanf("%d %d",&n,&m);
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d",&a[i][j]);
        }
    }
    for(i=0;i<m;i++){
        scanf("%d",&b[i]);
    }
    for(i=0;i<n;i++){
            for(j=0;j<m;j++){
                k = k + a[i][j]*b[j];
            }
            printf("%d\n",k);
            k=0;
    }
    return 0;
}

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

using namespace std;

int main() {
    vector<int> v(3, 0);
    cin >> v.at(0) >> v.at(1) >> v.at(2);
    
    sort(v.begin(), v.end());
    
    cout << v.at(0) << " " << v.at(1) << " " << v.at(2) << endl;
    
    return 0;
    
}


Measured memory_bytes: 3124
I = [int(_) for _ in open(0).read().split()]
N, T = I[:2]
A, B = I[2::2], I[3::2]
dp = [-1] * 6001
dp[0] = 0
for a, b in sorted(zip(A, B)):
    dp_new = dp[:]
    for k in range(T):
        if dp[k] == -1:
            continue
        dp_new[k + a] = max(dp[k + a], dp[k] + b)
    dp = dp_new
print(max(dp))


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

typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<ll> a(N);
    ll s = 0;
    rep(i, N) {
        cin >> a[i];
        s += a[i];
    }
    ll ans = abs(a[0] + a[0] - s);
    rep(i, N - 2) {
        a[0] += a[i + 1];
        ans = min(ans, abs(a[0] + a[0] - s));
    }
    cout << ans << endl;
}

Measured memory_bytes: 1920
#include<stdio.h>

int main(void){
    int N;

    scanf("%d",&N);
    int n=N%2;
    int h=N/2+1;
    double ans=(double)h/(double)N;

    if(n==0){
        printf("0.5");
    }else{
        printf("%lf",ans);
    }

    return 0;
}

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

int main() {
  string str;
  cin >> str;
  
  if(str == "a" || str == "e" || str == "i" || str == "u" || str == "o"){
   cout << "vowel"; 
  }else{
    cout << "consonant";
  }
}


Measured memory_bytes: 256
/*---------------------------*\
____________Mari000____________         
________Mostafa  Shehab________    
\*---------------------------*/

#include <bits/stdc++.h>
using namespace std;
 
#define PI  3.14159265  // PI = acos(-1)
#define EPS (1e-10)
#define endl "\n"
typedef long long ll;
typedef long double ld;
//template <class Type>

ll power(ll x,ll y,ll p);
int Bit(ll x);
 
inline int D(){
	int t;
	scanf("%d",&t);
	return t;
}
inline ll llD(){
	ll t;
	scanf("%lld",&t);
	return t;
}

const int N=1e5 + 5;
ll arr[N];

int ox,oy,ot,x,y,t,n;
bool flage=true;
int main(){
	scanf("%d",&n);
	while(n--){
		scanf("%d%d%d",&t,&x,&y);
		flage&=(abs(x-ox)+abs(y-oy)<=abs(t-ot) && (abs(t-ot)-abs(x-ox)-abs(y-oy))%2 == 0);
		ox=x,oy=y,ot=t;
	}
	puts(flage?"Yes":"No");
}










ll power(ll x,ll y,ll p){ 
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or  
                // equal to p 
    while (y > 0){ 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p;
    }
    return res; 
}


int Bit(ll x){
	if(!x)
		return 0;
	return 1+Bit(x>>1);
}










Measured memory_bytes: 256
#include <stdio.h>

int ans=700 ;
char s[3] ;

int main(void){
    
    scanf ("%s",s) ;
    
    if (s[0]=='o') {
        ans +=100 ;
    }
    
    if (s[1]=='o') {
        ans +=100 ;
    }
    
    if (s[2]=='o') {
        ans +=100 ;
    }
    
    printf ("%d",ans) ;

    return 0 ;
}


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

int main(){
    int n,m;
    cin>>n>>m;
    string s1[n],s2[m];
    for(int i=0;i<n;i++)cin>>s1[i];
    for(int i=0;i<m;i++)cin>>s2[i];
    bool flag=false;
    for(int x1=0;x1<=n-m;x1++){
        for(int y1=0;y1<=n-m;y1++){
            bool match=true;
            for(int x=0;x<m;x++){
                for(int y=0;y<m;y++){
                    if(s1[x+x1][y+y1]!=s2[x][y])match=false;
                }
            }
            if(match)flag=true;
        }
    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
char a[100005];
int main()
{
	scanf("%s",&a);
	if(a[0]==a[strlen(a)-1]){
		if(strlen(a)%2!=0){
			printf("Second\n");
		}
		else{
			printf("First\n");
		}
	}
	else{
		if(strlen(a)%2!=0){
			printf("First\n");
		}
		else{
			printf("Second\n");
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main()
{ 
    char c[5];
  
    scanf("%s",c);
   
    if(c[0]==c[1]) printf("Bad\n");
    else if(c[1]==c[2]) printf("Bad\n");
    else if(c[2]==c[3]) printf("Bad\n");
    else printf("Good\n");
  
    return 0;
}

Measured memory_bytes: 1588
#include<iostream>
#include<string>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
using namespace std;
int n,m,a[100100],b[100100];

int gcd(int x,int y)
{
    if (y==0) return x;
    else return gcd(y,x%y);
}

int main()
{
    scanf("%d%d",&n,&m);
    int i;
    for (i=1;i<=n;i++) scanf("%d",&a[i]);
    a[n+1]=m;
    sort(a+1,a+1+n+1);
    for (i=1;i<=n;i++) b[i]=a[i+1]-a[i];
    int ans=b[1];
    for (i=2;i<=n;i++) ans=gcd(ans,b[i]);
    printf("%d",ans);
    return 0;
}

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

vector<int> V[4];

int T[4][4];
void init(){
	T[0][1]=-2;
	T[0][3]=-1;
	T[1][0]=-1;
	T[1][2]=-2;
	T[2][1]=-1;
	T[2][3]=-2;
	T[3][0]=-2;
	T[3][2]=-1;
}

int houkou(int X,int Y,int x,int y){
	if(x>X)return 0;
	if(y>Y)return 1;
	if(X>x)return 2;
	if(Y>y)return 3;
}

void in(int num){
	V[num].clear();
	int m;cin>>m;
	int X,Y,Z,x,y,z;
	cin>>X>>Y;
	cin>>x>>y;
	Z=houkou(X,Y,x,y);
	V[num].push_back((X-x>0?X-x:x-X)+(Y-y>0?Y-y:y-Y));
	X=x;
	Y=y;
	for(int i=0;i<m-2;i++){
		cin>>x>>y;
		z=houkou(X,Y,x,y);
		V[num].push_back(T[Z][z]);
		V[num].push_back((X-x>0?X-x:x-X)+(Y-y>0?Y-y:y-Y));
		X=x;
		Y=y;
		Z=z;
	}
	V[num+1].clear();
	for(int i=V[num].size()-1,j=0;i>=0;i--,j++){
		if(j%2){
			V[num+1].push_back((V[num][i]==-1?-2:-1));
		}
		else{
			V[num+1].push_back(V[num][i]);
		}
	}
}

void draw(int num){
	for(int i=0;i<V[num].size();i++){
		if(i%2){
			if(V[num][i]==-1)cout<<"R";
			else cout<<"L";
		}
		else{
			cout<<V[num][i];
		}
	}
	cout<<endl;
}

int chk(int a,int b){
	if(V[a].size() != V[b].size())return 0;
	for(int i=0;i<V[a].size();i++){
		if(V[a][i]!=V[b][i]){
			return 0;
		}
	}
	return 1;
}

int main(){
	init();
	for(int n;cin>>n,n;cout<<"+++++\n"){
		in(0);
		for(int i=1;i<=n;i++){
			in(2);
			if(chk(0,2)+chk(1,2)){
				cout<<i<<endl;
			}
		}
	}
	
	return 0;
}


Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e7+5;
int a[40]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main() {
   int m;
   cin>>m;
   cout<<a[m]<<endl;
}


Measured memory_bytes: 256
// Aizu 1011: Finding the Largest Carbon Compound Give...
// 2017.9.17 bal4u@uu

#include <stdio.h>

int a[31];

int main()
{
	int i;
	a[1] = 1, a[2] = 2;
	for (i = 3; i <= 30; i++) a[i] = 3*a[i-2] + 2;
	while (scanf("%d", &i) == 1) printf("%d\n", a[i]);
	return 0;
}

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

int main() {
    double pi = 3.141592653589793238;
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    double hP = h * 5 + (m / 60) * 5;
    double ang = abs(hP - m) * 6;
    double cosAB = cos(ang / 180.0 * pi);
    double ans = sqrt((a * a) + (b * b) - (2 * a * b * cosAB));
    cout << fixed << setprecision(20) << ans << endl;
}

Measured memory_bytes: 4212
#include <stdio.h>
#include <vector>
#include <queue>
using namespace std;

vector<int> G[101];
bool visit[101];
int n, u, k, m;
int dist[101];

void bfs()
{
	int root = 1;
	queue<int> que;
	que.push(root);
	dist[root] = 0;
 visit[root] = true;
	while (!que.empty())
	{
		int node = que.front();
		que.pop();
		for (int i = 0; i < G[node].size(); i++)
		{
			int next = G[node][i];
			if (!visit[next])
			{
				visit[next] = true;
				que.push(next);
				dist[next] = dist[node] + 1;
			}
		}
	}
}

int main()
{
	for (int i = 0; i < sizeof(dist) / sizeof(dist[0]); i++)
		dist[i] = -1;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d%d", &u, &k);
		for (int j = 0; j < k; j++)
		{
			scanf("%d", &m);
			G[u].push_back(m);
		}
	}
	bfs();
	for (int i = 1; i <= n; i++)
		printf("%d %d\n", i, dist[i]);

	return 0;
}



Measured memory_bytes: 2760
<?php
list($S) = sscanf(trim(fgets(STDIN)), "%s");
list($T) = sscanf(trim(fgets(STDIN)), "%s");
$cnt = 0;
for ($i=0; $i < strlen($S); $i++) {
    if($S[$i] != $T[$i]){
        $cnt++;
    }
}
print($cnt);

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

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


// std::vector Declaration
template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// std::vector Initialization
template<typename T>
void fill_all(T& arr, const T& v) { arr = v; }
template<typename T, typename U>
void fill_all(T& arr, const U& v) { for (auto& i : arr) fill_all(i, v); }

// std::vector Debug
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "[";
    bool a = 1;
    for (auto e : v ) {
        os << (a ? "" : " "); 
        os << e;
        a = 0;
    }
    os << "]";
    return os;
}

// std::pair Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << " " << p.second << ")";
    return os;
}

// std::set Debug
template<typename T>
ostream& operator<<(ostream& os, const set<T>& st) {
    os << "{";
    bool a = 1;
    for (auto e : st) {
        os << (a ? "" : " ");
        os << e;
        a = 0;
    }
    os << "}";
    return os;
}

// std::multiset Debug
template<typename T>
ostream& operator<<(ostream& os, const multiset<T>& st) {
    os << "{";
    bool a = 1;
    for (auto e : st) {
        os << (a ? "" : " ");
        os << e;
        a = 0;
    }
    os << "}";
    return os;
}

// std::map Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const map<T, U>& mp) {
    os << "{";
    bool a = 1;
    for (auto e : mp) {
        os << (a ? "" : " ");
        os << e.first << ":" << e.second;
        a = 0;
    }
    os << "}";
    return os;
}

// std::tuple Debug
template<int N, class Tuple>
void out(ostream& os, const Tuple& t){}
template<int N, class Tuple, class H, class ...Ts>
void out(ostream& os, const Tuple& t) {
    if (N) os << " ";
    os << get<N>(t);
    out<N+1,Tuple,Ts...>(os, t);
}
template<class ...Ts>
ostream& operator<<(ostream& os, const tuple<Ts...>& t) {
    os << "(";
    out<0,tuple<Ts...>,Ts...>(os, t);
    os << ")";
    return os;
}

// Debug
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl


struct edge { int to, cost; };
ostream& operator<<(ostream& os, const edge& e) {
    os << "(" << e.to << ", " << e.cost << ")";
    return os;
}

const LL LINF = 1LL<<60;
const int IINF = 1<<30;
const LL MOD = 1e9+7;


LL solve(LL a, LL b, LL c) {
    LL i = (a-1) / c + 1;
    LL j = b / c;
    return j - i + 1;
}

LL gcd(LL x, LL y) {
    if(x < y) swap(x, y);
    if(x % y == 0) return y;
    else return gcd(y, x % y);
}

int main()
{
    LL A, B, C, D; cin >> A >> B >> C >> D;

    LL ans = (B - A + 1) -
             solve(A, B, C) -
             solve(A, B, D) +
             solve(A, B, C*D/gcd(C,D));

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <stdio.h>
#include <iomanip>

using namespace std;

//typedefリスト
typedef vector<long long int> vint;
typedef vector<string> vstr;
typedef long long int llint;

int main(void) {
	int a;
	string s;
	cin >> a >> s;
	if (a >= 3200) {
		cout << s << endl;
	}
	else {
		cout << "red" << endl;
	}
}


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

int main(void){
    unsigned long a, b;
    cin >> a >> b;

    if(a == 1 || b == 1){
        cout << 1 << endl;
    }
    else if(a % 2 == 1 && b % 2 == 1){
        cout << (a * b / 2) + 1 << endl;
    }else{
        cout << a * b / 2 << endl;
    }
    return 0;
}


Measured memory_bytes: 764
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstdlib>
using namespace std;
int main(){
	char str[100];
    scanf("%s",str);
	
	int strlen=4;
	int num = 3;
	int bits[num];
	
	for(int i=0;i<pow(2,num);i++){
		
		//ビット入力
		for(int j=0;j<num;j++){
			bits[j]=0;
		}
		int x = i;
		for(int j=0;j<num;j++){
			bits[j] = x%2;
			x /= 2;
		}
		
	    //メイン探索
		char str0[2];
		str0[0] = str[0];
		str0[1] = '\0';
		int temp = atoi(str0);
		for(int j=0;j<strlen;j++){
			char strj[2];
			strj[0] = str[j+1];
			strj[1] = '\0';
			int pn = 2*bits[j]-1;
			temp += (pn * atoi(strj));
		}
		
		if(temp==7){
			for(int j=0;j<num;j++){
				printf("%c",str[j]);
				if(bits[j]==1){
					printf("+");
				} else{
					printf("-");
				}
			}
			printf("%c=7\n",str[3]);
			break;
		}
	}

	return 0;
}

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

typedef long long ll;
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define all(x) (x).begin(), (x).end()
#define en '\n'
#define FILL(x, v) memset(x, v, sizeof(x))
#define pb push_back
#define fast                     \
	ios::sync_with_stdio(false); \
	cin.tie(NULL);               \
	cout.tie(NULL);
#define F_OR(i, a, b, s) for (int i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...)       \
	F_ORC(__VA_ARGS__) \
	(__VA_ARGS__)

#define E_ACH2(x, a) for (auto &x : a)
#define E_ACH3(x, y, a) for (auto &[x, y] : a)
#define E_ACH4(x, y, z, a) for (auto &[x, y, z] : a)
#define E_ACHC(...) GET5(__VA_ARGS__, E_ACH4, E_ACH3, E_ACH2)
#define EACH(...)       \
	E_ACHC(__VA_ARGS__) \
	(__VA_ARGS__)

template <typename A, typename B>
inline void chmin(A &a, B b)
{
	if (a > b)
		a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b)
{
	if (a < b)
		a = b;
}

const int mxn = 5e5;
const int M = 1e9 + 7;

ll pw(ll b, ll e)
{
	ll res = 1;
	while (e)
	{
		if (e % 2)
			res = (res * b) % M;
		b = (b * b) % M;
		e >>= 1; // e/=2;
	}
	return res;
}

ll iv[mxn + 1], f1[mxn + 1], f2[mxn + 1];
ll nck(int n, int k)
{
	return f1[n] * f2[k] % M * f2[n - k] % M;
}

int main()
{
	fast;
	string s;
	cin >> s;
	if (s.back() == 's')
	{
		s += "es";
	}
	else
	{
		s += "s";
	}
	cout << s << en;
}

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

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

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

int main() {
    long long A,B,C,D;
  
    long long Ccnt, Dcnt, LCMcnt;
    
    cin >> A >> B >> C >> D;

    // Cで割り切れる数の個数
    Ccnt = B / C - (A / C);
    if(A % C == 0) ++Ccnt;
    // Dで割り切れる数の個数
    Dcnt = B / D - A / D ;
    if(A % D == 0) ++Dcnt;
    // C, DのLCMで割り切れる数の個数 
    LCMcnt = B / lcm(C,D) - A / lcm(C,D) ;
    if(A % lcm(C,D) == 0) ++LCMcnt;

    cout <<(B - A + 1) - (Ccnt + Dcnt - LCMcnt) << endl;

}

Measured memory_bytes: 256
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N;
LL A[300000];

LL ans = -INF;

void solve(){
	multiset<LL> bigger;
	LL bigger_accum = 0;

	multiset<LL> smaller;
	multiset<LL> smaller_hidden;
	LL smaller_accum = 0;

	for(int i=0;i<N;i++){
		bigger.insert(A[i]);
		bigger_accum += A[i];
	}
	for(int i=N;i<3*N;i++) smaller_hidden.insert(A[i]);

	for(int _=0;_<N;_++){
		auto iter = smaller_hidden.begin();
		smaller.insert(*iter);
		smaller_accum += (*iter);
		smaller_hidden.erase(iter);
	}

	ans = max(ans,bigger_accum-smaller_accum);
	for(int i=N;i<2*N;i++){
		//bigger更新
		bigger.insert(A[i]);
		bigger_accum += A[i]-(*(bigger.begin()));
		bigger.erase(bigger.begin());

		//smaller更新
		//smallerにA[i]が入っているなら
		if(smaller.find(A[i])!=smaller.end()){
			smaller_accum -= A[i];
			smaller.erase(smaller.find(A[i]));
			smaller_accum += (*(smaller_hidden.begin()));
			smaller.insert(*(smaller_hidden.begin()));
			smaller_hidden.erase(smaller_hidden.begin());
		}
		//smallerにA[i]が入ってないなら
		else{
			smaller_hidden.erase(smaller_hidden.find(A[i]));
		}

		ans = max(ans,bigger_accum-smaller_accum);
	}
}

int main(){
    cin >> N;
    for(int i=0;i<3*N;i++) cin >> A[i];

    solve();

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


Measured memory_bytes: 19512
#include<stdio.h>
#define DIM 50

int main(void)
{
  int n,v[DIM],c[DIM],gap[DIM],i,max=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
  scanf("%d",&v[i]);
  }
  for(i=0;i<n;i++)
  {
  scanf("%d",&c[i]);
  }
  for(i=0;i<n;i++)
  {
  gap[i]=v[i]-c[i];
    if(gap[i]<0)
    {
    gap[i]=0;
    }
    max+=gap[i];
  }
  printf("%d",max);
return 0;
}

Measured memory_bytes: 128
import sys, ast

def dfs(str_input,count = 1):
    if count == 7:
        if ast.literal_eval(str_input) == 7:
            print(str_input + "=7")
            sys.exit(0)
        else:
            return 0
    for i in ["+","-"]:
        dfs(str_input[:count] + i + str_input[count:], count = count + 2)

x = input()

dfs(x)

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

int main(){
  string s;
  cin >> s;
  set<char> st;
  for (int i=0; i<s.length(); i++){
    st.insert(s.at(i));
  }
  for (int i=0; i<26; i++){
    if (st.count('a'+i) == 0) {
      cout << (char)('a'+i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
using namespace std;
int main()
{
	ll a,b,c,s,x,y,z;
	cin>>a>>b>>c;
	x=abs(a-b)+abs(a-c);
	y=abs(b-c)+abs(b-a);
	z=abs(c-a)+abs(c-b);
	s=min(x,min(y,z));
//	cout<<x<<" "<<y<<" "<<z<<endl;
	cout<<s;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;


int main(){
    string s;
    cin>>s;
    ll k;
    cin>>k;
    
    ll i=0;
    for(i=0;s[i]=='1';i++){
        if(i+1>=k){
            cout<<s[i]<<endl;
            return 0;
        }
    }
    cout<<s[i]<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    ll t1,t2,a1,a2,b1,b2;
    in>>t1>>t2>>a1>>a2>>b1>>b2;
    if(t1*a1+t2*a2==t1*b1+t2*b2) return cout<<"infinity"<<endl,0;
    if(a1>b1){
        swap(a1,b1);
        swap(a2,b2);
    }
    if(t1*a1+t2*a2<t1*b1+t2*b2) return cout<<0<<endl,0;
    ll s=t1*b1+t2*b2,d=t1*a1+t2*a2-t1*b1-t2*b2;
    ll l=0,r=s/d+2,m;
    while(r-l>1){
        m=(l+r)>>1;
        if(t1*b1>=m*d+t1*a1) l=m;
        else r=m;
    }
    if(t1*b1==l*d+t1*a1){
        cout<<2*l<<endl;
    }
    else{
        cout<<2*l+1<<endl;
    }
}

Measured memory_bytes: 256
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <bitset>

using namespace std;
typedef long long ll;

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


    ll ans=0;
    ll anss =0;
    ll count=0;
    ll i,j;
  
    long double x;
    vector<ll> aa;

    ll Q,N,K;
    long double a, b;
    string S;
    cin >> N >>K;
    ll flag=0;
    ll t1=0;
    ll t2=0;
  	ll sum=0;
    ll dig;
    ll Q1=Q;

    for(i=0;i<N;i++){
        cin>>Q;
        aa.push_back(Q);
        if(Q==1){
            flag=i;
        }
    }
    
    ans=((N-1)/(K-1));

    if((N-1)%(K-1)!=0) ans++;

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

Measured memory_bytes: 1400
import java.util.Scanner;


public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		for(; scanner.hasNext();)
		{
			int n = scanner.nextInt();
			
			int count = 0;
			for(int i=0; i<10; i++)
			{
				for(int j=0; j<10; j++)
				{
					for(int k=0; k<10; k++)
					{
						for(int l=0; l<10; l++)
						{
							if(n == i+j+k+l)
							{
								count ++;
							}
						}
					}
				}
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 26708
#include <bits/stdc++.h>
using namespace std;
int n;
int a[100005];
int cnt[100005];
long long sum;
int main(){
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a[i];
		sum+=a[i];
		cnt[a[i]]++;
	}
	int q;
	cin>>q;
	while(q--){
		int b,c;
		cin>>b>>c;
		cnt[c]+=cnt[b];
		long long cc=cnt[b];
		cnt[b]=0;
		sum+=(c-b)*1ll*cc;
		cout<<sum<<'\n';
	}
	return 0;
}

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

#define ll              long long int
#define pb              push_back
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define fast_io         ios_base::sync_with_stdio(false); cin.tie(NULL);


int main(){
    fast_io;
    
    ll n;
    cin >> n;
    if(n == 0){
    	cout<<"0\n";
    	return 0;
    }

    vector<ll> v(n);

    for(ll i=0; i<n; i++){
    	cin >> v[i];
    }

    if(n == 1){
    	cout<<"0"<<"\n";
    	return 0;
    }
    
    vector<vector<ll>> dp(n, vector<ll>(n,inf));
    vector<vector<ll>> price(n, vector<ll>(n,inf));
    ll i,j;

    
    for(ll k=0; k<n; k++){
    	i = 0;
    	j = k;

    	while(i<n and j<n){
    		if(i == j){
    			dp[i][j] = v[i];
    			price[i][j] = 0;
    		}
    		else{
    			for(ll p=i; p<j; p++){
    				// i to p and  p+1 to j

    				ll newValue = dp[i][p] + dp[p+1][j];
    				ll newPrice = price[i][p] + price[p+1][j] + newValue;

    				if(newPrice < price[i][j]){
    					price[i][j] = newPrice;
    					dp[i][j] = newValue;
    				}
    			}
    		}

    		i++;
    		j++;
    	}
    }

    cout<<price[0][n-1]<<"\n";
    
	return 0;
}

Measured memory_bytes: 2816
N=int(input())
A=list(map(int,input().split()))
s=sum(A)
x=0
for i in range(1,N,2):
    x+=2*A[i]
X=[s-x]
for i in range(1,N):
    X.append(2*A[i-1]-X[i-1])
print(*X)


Measured memory_bytes: 69732
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acosl(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	ll a, b;
	cin >> a >> b;
	cout << a * b << endl;
}


Measured memory_bytes: 3616
/**
 * Title: AtCoDeer and Election Report
 * Url: https://atcoder.jp/contests/abc046/tasks/arc062_a
 */
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<numeric>
#include<functional>
#include<sstream>
#include<iomanip>

using namespace std;

#define ll long long

int main() {
    int n; cin >> n;
    vector<ll> t(n), a(n);
    for(int i=0; i<n; i++) cin >> t[i] >> a[i];
    ll ti=1, ai=1;
    for(int i=0; i<n; i++) {
        ll k = max((ll)ceil(ti/(long double)t[i]), (ll)ceil(ai/(long double)a[i]));
        ti = k*t[i];
        ai = k*a[i];
    }
    cout << ti+ai << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
const int MAXN = 1e5 + 10;

struct Edge {
  int v, next;
}edge[MAXN << 1];
int head[MAXN], tail, n, deg[MAXN];
void insert(int u, int v) {
  edge[++tail] = (Edge) {v, head[u]}; head[u] = tail;
}
namespace solver1 {
  int f[MAXN];
  int bound, root;
  bool dfs(int u, int fa) {
    std::vector <int> dps;
    for (int i = head[u]; i; i = edge[i].next) {
      int v = edge[i].v;
      if (v == fa) continue;
      if (!dfs(v, u)) return 0;
      if (f[v] > bound) return 0;
      dps.push_back(f[v]);
    }
    if (deg[u] & 1) dps.push_back(0);
    std::sort(dps.begin(), dps.end());
    int l = 0, r = dps.size() - 1;
    while(l <= r) {
      int mid = (l + r) >> 1;
      bool flag = 1;
      for (int i = 0, j = dps.size() - 1; i < j; i++, j--) {
        if (i == mid) i++;
        if (j == mid) j--;
        if (dps[i] + dps[j] > bound) {flag = 0; break;}
      } 
      if (flag) {
        f[u] = dps[mid];
        r = mid - 1;
      } else {
        l = mid + 1;
      }
    }
    f[u]++;
    return f[u];
  }
  bool check() {
    memset(f, -1, sizeof f);
    return dfs(root, 0) 
      && f[root] <= bound + 1;
  }
  void main() {
    int ans1 = 0;
    for (int i = 1; i <= n; i++) { 
      if (deg[i] & 1) ans1++, root = i; 
    }
    ans1 /= 2;
    printf("%d ", ans1);
    int l = 1, r = n, ans2 = 0;
    deg[root]++;
    while (l <= r) {
      int mid = (l + r) >> 1;
      bound = mid;
      if (check()) {
        ans2 = mid;
        r = mid - 1;
      } else {
        l = mid + 1;
      }
    }
    printf("%d\n", ans2);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    insert(a, b);
    insert(b, a);
    deg[a]++; deg[b]++;
  }
  solver1::main();
}


Measured memory_bytes: 12288
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
    VEC(int,a,5);
    int res = INF;
    do{
        int r;
        rep(i,5){
            r += a[i];
            if(i != 4)while(r%10 != 0){
                r++;
            }
        }
        res = min(res,r);
    }while(next_permutation(ALL(a)));
    cout<<res;
}



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

int main() {
	// your code goes here
	string a;
	cin >> a;
	int c = 0;
	for(char i :a){
		if(i == '+') c++;
		else c--;
	}
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 1000005
using namespace std;

int n, a[4][N], dp[4][N];

int f(int x, int d1){
	int &r = dp[d1][x];
	if(r != -1)
		return r;
	if(x == n + 1)
		return 0;
	r = 0;
	for(int i = 1; i <= 3; i++){
		if(i == d1)
			continue;
		r = max(r, a[i][x] + f(x + 1,i));
	}
	return r;
}

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	memset(dp, -1, sizeof dp);
	scanf("%d",&n);
	for(int i = 1; i <= n; i++)
		scanf("%d %d %d",&a[1][i] ,&a[2][i] ,&a[3][i]);
	printf("%d\n", f(1, 0));
	return 0;
}

Measured memory_bytes: 30592
N = int(input())
MOD = 10**9 + 7

DP = [[[[0 for _ in range(4)] for _ in range(4)] for _ in range(4)] for _ in range(N)]
# DP[i][a][b][c] i-2からi文字目までがabcであるような文字列の数
Banned = {(1,2,3),(2,1,3),(1,3,2)}

for a in range(4):
  for b in range(4):
    for c in range(4):
      if (a,b,c) not in Banned:
        DP[2][a][b][c] = 1
      

for i in range(3,N):
  for a in range(4):
    for b in range(4):
      for c in range(4):
        DP[i][b][c][0] += DP[i-1][a][b][c]
        DP[i][b][c][1] += DP[i-1][a][b][c]
        if not ((b,c) == (1,2) or (b,c) == (2,1) or (a,c) == (1,2) or (a,b) == (1,2)):
          DP[i][b][c][3] += DP[i-1][a][b][c]
        if not (b,c) == (1,3):
          DP[i][b][c][2] += DP[i-1][a][b][c]

ans = 0
for a in range(4):
  for b in range(4):
    for c in range(4):   
      ans += DP[N-1][a][b][c]
print(ans % MOD)
#print(DP[3])
          
        

Measured memory_bytes: 75168
# ABC140 B - Buffet

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
pt = 0 

for i in range(N):
    pt += B[A[i]-1]
    if i >= 1 and A[i] == A[i-1] + 1 :
        pt += C[A[i-1]-1]

print(pt)  

Measured memory_bytes: 3064
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>

#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807
#define LLMIN       -9223372036854775808
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;

int N;
vector<int> G[100000];
int used[100000];

void dfs(int p,int v){
    if(SZ(G[v])==1 && p!=-1){
        if(!used[p] && !used[v]){
            used[v]=1;
            used[p]=1;
        }
    }else{
        REP(i,SZ(G[v]))
            if(G[v][i]!=p)
                dfs(v,G[v][i]);
        REP(i,SZ(G[v]))
            if(G[v][i]!=p && !used[G[v][i]] && !used[v]){
                used[G[v][i]]=1;
                used[v]=1;
                break;
            }
    }
}

int main(void){
    cin>>N;
    REP(i,N-1){
        int a,b;
        cin>>a>>b;
        a--,b--;
        G[a].pb(b);G[b].pb(a);
    }
    dfs(-1,0);
    REP(i,N)
        if(!used[i]){
            // printf("i=%d\n",i);
            cout<<"First"<<endl;
            return 0;
        }
   cout<<"Second"<<endl;
     return 0;
}

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

// Type alias
using ll=long long;
using ld=double;

using pi=pair<int,int>;
using pll=pair<ll,ll>;
using pld=pair<ld,ld>;
using ti3=tuple<int, int, int>;

using vi=vector<int>;
using vll=vector<ll>;
using vld=vector<ld>;
using vpi=vector<pi>;
using vpll=vector<ll>;
using vpld=vector<ld>;
using vti3=vector<ti3>;

// Constants
const double EPS = 1e-9;
const int inf = numeric_limits<int>::max() / 2;
const ll llinf = numeric_limits<ll>::max() / 2;
const ll mod = 1e9+7;

// Macro
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;--i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,a,b) for(int i=int(b-1);i>=int(a);--i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

#define ALL(a) a.begin(),a.end()

// Funtcions
ll pow(ll base, ll i, ll mod){
  ll a = 1;
  while(i){
    if (i & 1) {
      a *= base;
      a %= mod;
    }
    base *= base;
    base %= mod;
    i >>= 1;
  }
  return a;
}
ll gcd(ll a, ll b){
  while(b){
    ll c = a % b;
    a = b;
    b = c;
  }
  return a;
}
ll lcm(ll a, ll b){
  return a / gcd(a, b) * b;
}
template<typename T> bool chmin(T& a, const T& b) {
  if (a > b) return a = b, true; else return false;
}

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

ll dp[105][100005];
void solve(){
  ll N, W; cin >> N >> W;
  ll w[105], v[105]; rep(i, N) cin >> w[i] >> v[i];
  dp[0][0] = 0;
  REP(j, 1, 100000+1) dp[0][j] = llinf;

  rep(i, N){
    rep(j, 100000+1){
      if(j-v[i] >= 0){
        dp[i+1][j] = min(dp[i][j], dp[i][j-v[i]] + w[i]);
      } else {
        dp[i+1][j] = dp[i][j];
      }
    }
  }

  rrep(i, 100000+1){
    if(dp[N][i] <= W){
      cout << i << endl;
      break;
    }
  }
}

int main(){
// FastIO
//ios_base::sync_with_stdio(false);
cin.tie(NULL);
  solve();
  return 0;
}

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

int H, A[500001];

void max_heapify(int i) {
    int l = 2 * i;
    int r = 2 * i + 1;

    int largest = 0;
    if (l <= H && A[l] > A[i])
        largest = l;
    else
        largest = i;
    if (r <= H && A[r] > A[largest])
        largest = r;

    if (largest != i) {
        swap(A[i], A[largest]);
        max_heapify(largest);
    }
}

int main() {
    cin >> H;
    for (int i = 0; i < H; i++)
        cin >> A[i + 1];

    for (int i = H / 2; i >= 1; i--)
        max_heapify(i);

    for (int i = 1; i <= H; i++)
        cout << " " << A[i];
    cout << endl;
    return 0;
}


Measured memory_bytes: 5052
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#define SIZE 200005

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

int main()
{
	int n,d,x;
	scanf("%d %d %d",&n,&d,&x);
	int all=2*d+(2*n-1)*x;
	double dp=0.0;
	for(int i=1;i<=n;i++)
	{
		double ndp=1.0+dp+dp/(double) i;
		dp=ndp;
	}
	printf("%.10f\n",dp*(double) all/2.0);
	return 0;
}


Measured memory_bytes: 128
def fg(x):
    if g[x] == x:
        return x
    re = fg(g[x])
    g[x] = re
    return re


def kg(x, y):
    x = fg(x)
    y = fg(y)
    if d[y] > d[x]:
        g[x] = y
    else:
        g[y] = x
    if d[x] == d[y]:
        d[x] += 1


n, q = map(int, input().split())
d = [0] * n
g = [x for x in range(n)]
for _ in range(q):
    c, x, y = map(int, input().split())
    if c:
        print((fg(x) == fg(y))*1)
    else:
        kg(x, y)



Measured memory_bytes: 6028
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		while(in.hasNext()) {
			int red=in.nextInt(),green=in.nextInt(),blue=in.nextInt();
			int K=in.nextInt();
			for(int i=0;i<K;i++) {
				if(blue<=green || blue<=red) {
					blue=blue*2;
				}else if(green<=red) {
					green*=2;
				}else {
					blue*=2;
				}
			}
			if(blue>green && green>red) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		}
	}
}


Measured memory_bytes: 35688
#pragma GCC optimize("O3")

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define For(i, a, b)    for(int i = (a); (i) < (b) ; ++(i))
#define CtoI(c)         int((c)) - int('0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int n; cin >> n;
    vector<int> t(n+1), x(n+1), y(n+1);
    rep(i, n) cin >> t[i+1] >> x[i+1] >> y[i+1];

    rep(i, n){
        int dt = t[i+1] - t[i];
        int dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
        if(dt < dist || dt%2 != dist%2){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

return 0;
}

Measured memory_bytes: 4384
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,ans=0,x=0;
  cin >> n;
  long long a[n],b[n]={};
  for(int i=0;i<n;i++){
  	cin >> a[i];
  }
  sort(a,a+n);
  for(int i=0;i<n;i++){
	b[x]++;
	if(a[i]!=a[i+1]){
	  x++;
	}
  }
  for(int i=0;i<x;i++){
  	if(b[i]%2==1){
  	  ans++;
  	}
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
while True:
    n,m = map(int, input().split())
    if n == 0 and m == 0:
        break
    else:
        h,w = [],[]

        for _ in range(n):
            h.append(int(input()))

        for _ in range(m):
            w.append(int(input()))

        l = [0 for _ in range(1000*1501)]

        for i in range(n):
            tmp = 0
            for j in range(i,n):
                tmp += h[j]
                l[tmp] += 1

        ans = 0

        for i in range(m):
            tmp = 0
            for j in range(i,m):
                tmp += w[j]
                ans += l[tmp]

        print(ans)


Measured memory_bytes: 41528
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n - 1); i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

template<typename T>
inline void setmax(T& a, T b) {
    if (a < b) a = b;
}

template<typename T>
inline void setmin(T& a, T b) {
    if (a > b) a = b;
}

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;
const int N = 3500;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); 
    srand((unsigned)chrono::high_resolution_clock::now().time_since_epoch().count());
    ll n;
    cin >> n;
    fore(a, 1, N) fore(b, 1, n) {
        ll x = n * a * b;
        ll y = 4 * a * b - n * a - n * b;
        if (y <= 0) continue;
        if (x % y == 0) {
            cout << a << ' ' << b << ' ' << x / y << '\n';
            return 0;
        }
    }
    assert(false);
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int a,b,c,d,e;
int main(){
  cin>>a>>b;
  for(int i=1;i<1001;i++){
    d=i*0.08;
    e=i*0.1;
    if(a==d&&b==e){
      cout<<i;
      return 0;
    }
  }
  cout<<-1;
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define LONGLONGMAX 9223372036854775807
#define LONGLONGMIN -9223372036854775807
#define INTMAX 32767
#define INTMIN -32767
#define ROUNDUP(divisor,dividend) (divisor + (dividend - 1)) / dividend
int n,k;
int main(){
  cin >> n >> k;
  cout << ((k*2)-1<=n?"YES":"NO") << endl; 
}


Measured memory_bytes: 256
from itertools import product
h,w,k=map(int,input().split())
M=[input() for i in range(h)]
a=0
for A in product([0,1],repeat=h):
    for B in product([0,1],repeat=w):
        ANS=0
        for i in range(h):
            for j in range(w):
                if M[i][j]=='#' and A[i]==0 and B[j]==0:
                    ANS+=1
        if ANS==k:
            a+=1

print(a)


Measured memory_bytes: 73644
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val heights = readLine()!!.split(" ").map(String::toInt)
    var max = 0
    val indexes = mutableListOf(0)
    for (i in 1.until(n)) {
        if (heights[i -1] < heights[i]) {
            indexes.add(i)
            val ren = indexes.last() - indexes[indexes.size - 2] - 1
            if (ren > max) {
                max = ren
            }
        }
    }
    println(Math.max(max, heights.size - indexes.last() - 1))
}

Measured memory_bytes: 55768
import * as fs from 'fs';

namespace AtCoder.abc162 {

    export class Program {

        constructor(private readonly args: string[]) {
        }

        /**
         * in
         *
         * out
         *
         */
        main(this: Program): void {
            const n: number = parseInt(this.args[0]);
            let ans: number = 0;

            for (let i: number = 1; i <= n; i++) {
                if (i % 3 === 0) continue;
                if (i % 5 === 0) continue;
                ans += i;
            }
            console.log(ans);
        }
    }
}

const args = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n');
const prg = new AtCoder.abc162.Program(args);
prg.main();


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

using namespace std;

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

  int min_idx = 0;
  int A[100001];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (i > 0 && A[min_idx] > A[i])
      min_idx = i;
  }

  int alive = N;
  while (alive > 1) {
    for (int i = 0; i < N; i++) {
      if (i == min_idx || A[i] == 0)
        continue;
      A[i] %= A[min_idx];
      if (A[i] == 0)
        alive -= 1;
    }
    for (int i = 0; i < N; i++) {
      if (i == min_idx || A[i] == 0)
        continue;
      if (A[i] < A[min_idx])
        min_idx = i;
    }
  }

  cout << A[min_idx] << endl;

  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pii=pair<int,int>;
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((ll)x.size())
#define MOD (ll)(998244353)
#define INF (2e9)
#define EPS (1e-6)
#ifdef LOCAL_TEST
#define debug(...) do{\
	cerr<<__PRETTY_FUNCTION__<<" - "<<__LINE__<<\
	" : ("#__VA_ARGS__<<") = ";\
	_OUT(__VA_ARGS__);\
}while(0)
template<typename T>void _OUT(T x){cerr<<x<<endl;}
template<typename T,typename...I>void _OUT(T x,I ...tail){cerr<<x<<", ";_OUT(tail...);}
#else
#define debug(...)
#endif

void INIT(){
#ifdef LOCAL_TEST
	freopen("D:\\input.in","r",stdin);
	freopen("D:\\output.out","w",stdout);
	freopen("D:\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
}

ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll fpow(ll b,ll p){
	b%=MOD;
	ll ans=1;
	while(p>0){
		if(p&1) ans=(ans*b)%MOD;
		p/=2;
		b=(b*b)%MOD;
	}
	return ans;
}

int32_t main() {
	INIT();
	//code...
	int h,n; cin>>h>>n;
	vector<pii> v(n); //pair(weight,cost)
	for(auto &i:v) cin>>i.F>>i.S;
	int dp[10010];
	For(i,1,h) dp[i]=INF;
	dp[0]=0;
	For(i,0,n-1) For(j,1,h){
		if(j<=v[i].F) dp[j]=min(dp[j],v[i].S);
		else dp[j]=min(dp[j],dp[j-v[i].F]+v[i].S);
	}
	cout<<dp[h]<<"\n";
	return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

int main(){
    ll n; cin >> n;
    ll sum = 0;
    ll tmp = n;
    while(tmp>0){
        sum += tmp % 10;
        tmp /= 10;
    }
    if(n%sum==0) puts("Yes");
    else puts("No");
    //cout << sum << endl;
}

Measured memory_bytes: 256