akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
	// public static void printArray(int[] a) {
	// 	for (int i = 0; i < a.length; i++) {
	// 		System.out.print(a[i] + ", ");
	// 	}
	// 	System.out.println();
	// }

	// public static<T> void printArrayT(T[] a) {
	// 	for (int i = 0; i < a.length; i++) {
	// 		System.out.print(a[i] + ", ");
	// 	}
	// 	System.out.println();
	// }

	// public static class Triple implements Comparable<Triple> {
	// 	public int A, B, C;
	// 	Triple(int A, int B, int C) {
	// 		this.A = A;
	// 		this.B = B;
	// 		this.C = C;
	// 	}

	// 	@Override
	// 	public String toString() {
	// 		return String.format("(%d, %d, %d)", A, B, C);
	// 	}

	// 	@Override
	// 	public int compareTo(Triple o) {
	// 		int a = this.A - o.A;
	// 		if (a != 0) return a;
	// 		int b = this.B - o.B;
	// 		if (b != 0) return b;
	// 		return this.C - o.C;
	// 	}
	// }

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] A = new long[N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		long M0 = A[0];
		for (int i = 1; i < N; i += 2) {
			M0 -= A[i];
			M0 += A[i + 1];
		}
		StringBuilder sb = new StringBuilder();
		sb.append(M0);
		long v = M0 / 2;
		for (int i = 1; i < N; i++) {
			v = A[i - 1] - v;
			sb.append(" ");
			sb.append(v * 2);
		}
		System.out.println(sb);
	}
}


Measured memory_bytes: 63108
K=input()
D=int(input())
#余り0,余り1,余り2,…,余り(D-1)
dp=[0]*D
mod=10**9+7
s=0
for i in range(len(K)):
  ndp=[0]*D
  #余りがjだったものは(j+d)%Dの余りに変わるので
  for j in range(D):
    for d in range(10):
      ndp[(j+d)%D]=(ndp[(j+d)%D]+dp[j])%mod
  #直前までKと数字が同じだったものをカウント
  for d in range(int(K[i])):
    ndp[(s+d)%D]+=1 
  dp=ndp
  s=(s+int(K[i]))%D
print((dp[0]-1+(s==0))%mod)

Measured memory_bytes: 43740
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ld double
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define pll pair <ll,ll>
#define nl "\n"
ll n,k;
ll a[102];
ll dp[102][100005];
vector <ll> v;
ll fx(ll idx, ll k)
{
	if(idx==n)
	{
		if(k==0)
			return dp[idx][k]=1;
		else
			return dp[idx][k]=0;
	}
	if(dp[idx][k]!=-1)
		return dp[idx][k];
	ll su=0;
	for(int i=0;i<=min(a[idx],k);i++)
	{
		su = (su + fx(idx+1, k-i))%mod;
	}
	return dp[idx][k]=su;
}
int main()
{
	ios_base::sync_with_stdio(false);
	ll i,j;
	cin>>n>>k;
	for(i=0;i<n;i++)
		cin>>a[i];
	for(i=0;i<102;i++)
		for(j=0;j<100005;j++)
			dp[i][j]=-1;
	// cout<<fx(0,k)<<nl;
	for(i=0;i<=k;i++)
		dp[n-1][i] = (i<=a[n-1])?1:0;
	for(i=n-2;i>=0;i--)
	{
		ll su=0;
		for(j=k;j>=max(0ll, k-a[i]);j--)
			su = (su + dp[i+1][j])%mod;
		dp[i][k] = su;
		for(j=k-1;j>=0;j--)
		{
			su = (su - dp[i+1][j+1] + mod)%mod;
			if(j-a[i]>=0)
				su = (su + dp[i+1][j-a[i]])%mod;
			dp[i][j] = su;
		}
	}
	cout<<dp[0][k]<<nl;
	return 0;
}

Measured memory_bytes: 83332
N = int(input())
A = list(int(input()) for i in range(N))

max_value = max(A)
number = A.count(max_value)

if number > 1:
    for j in range(N):
        print(max_value)
else:
    position = A.index(max_value)
    A.remove(max_value)
    for j in range(N):
        if j == position:
            print(max(A))
        else:
            print(max_value)

Measured memory_bytes: 12520
from bisect import bisect_left
from sys import stdin



def solve(a):
    a.sort()
    mid = a[n-1]/2
    ai = a[bisect_left(a, mid)-1]
    aj = a[bisect_left(a, mid)]
    am = ai if abs(mid-ai) <= abs(mid-aj) else aj

    print(a[n-1], am)


if __name__ == '__main__':
    n = int(input())
    a = list(map(int, stdin.readline().split()))
    solve(a)


Measured memory_bytes: 14432
// Course＞Introduction to Programming I ＞ ITP1_1_C:   Rectangle
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_C&lang=jp

// 以下のソースコードには(複数の？)誤りがあるので、このまま提出しても「誤り」と判定されます。
// ソースコード中の誤りを修正し、「正解」（Accepted）を出してください。

// 適宜、paiza.io (https://paiza.io/ja/projects/new) などのC++実行環境を、確認に用いることを推奨します。


#include <iostream>
using namespace std;

int main(){
	int a,b;
	cin >> a >> b;
	cout << (a+b) / 2 << endl;
	return 0;
}


Measured memory_bytes: 3088
use std::collections::VecDeque;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[derive(Debug)]
struct T {
    x: i32,
    y: i32,
    dist: usize,
}

const dxs: [i32; 4] = [0, 0, 1, -1];
const dys: [i32; 4] = [1, -1, 0, 0];

fn main() {
    input! {
        h: usize,
        w: usize,
        s: [chars; h],
    };

    let mut ans = 0;
    for y in 0..(h as i32) {
        for x in 0..(w as i32) {
            if s[y as usize][x as usize] == '#' {
                continue;
            }
            let mut q = VecDeque::new();
            let mut used = vec![vec![0; w]; h];
            {
                let t = T {
                    x: x,
                    y: y,
                    dist: 0,
                };
                q.push_back(t);
            }
            used[y as usize][x as usize] = 1;
            let mut max = 0;

            while !q.is_empty() {
                let t = q.pop_front().unwrap();
                for i in 0..4 {
                    let nx = t.x + dxs[i];
                    let ny = t.y + dys[i];
                    if nx < 0 || nx >= (w as i32) {
                        continue;
                    }
                    if ny < 0 || ny >= (h as i32) {
                        continue;
                    }
                    if s[ny as usize][nx as usize] == '#' {
                        continue;
                    }
                    if used[ny as usize][nx as usize] == 1 {
                        continue;
                    }
                    used[ny as usize][nx as usize] = 1;

                    let ndist = t.dist + 1;
                    let nt = T {
                        x: nx,
                        y: ny,
                        dist: ndist,
                    };
                    q.push_back(nt);
                    if max < ndist {
                        max = ndist;
                    }
                }
            }
            if ans < max {
                ans = max;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
N = int(input())

for h in range(1, 3501):

    for n in range(1, 3501):

        if (4*h*n - N*n - N*h)<=0:
            continue

        w = N*h*n/(4*h*n - N*n - N*h)
        flag = w.is_integer()
        # print(flag)
        
        if flag and w>0:
            print(h, n, int(w))
            exit()

Measured memory_bytes: 3060
#include<iostream>

using namespace std;

int S(int N){
  if(N == 0) return 0;
  return N % 10 + S(N / 10);
}

int main(void){
  int N;
  cin >> N;
  if(N % S(N) == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
int main(){
  ll a[3][3],n,ans[3][3];
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      ans[i][j]=0;
    }
  }
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin>>a[i][j];
    }
  }
  cin>>n;ll b;
  for(int i=0;i<n;i++){
    cin>>b;
    for(int j=0;j<3;j++){
      for(int k=0;k<3;k++){
        if(a[j][k]==b){
          ans[j][k]=1;
        }
      }
    }
  }
  int an=0,mans=0;
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      if(ans[i][j]==1){an++;}
    }
    if(an==3){mans=1;}
    an=0;
  }
  for(int j=0;j<3;j++){
    for(int i=0;i<3;i++){
      if(ans[i][j]==1){an++;}
    }
    if(an==3){mans=1;}
    an=0;
  }
  if(ans[0][0]==1&&ans[1][1]==1&&ans[2][2]==1){
    mans=1;
  }
  if(ans[2][0]==1&&ans[1][1]==1&&ans[2][0]==1){
    mans=1;
  }
  if(mans==1){
    cout << "Yes"<<endl;
  }else{
    cout << "No"<<endl;
  }
}

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

int main(){
    int N, K;
    cin >> N >> K;
    ll ans = K;
    if (N == 1)
    {
        cout << ans << endl;
        return 0;
    }
    
    for (int i = 1; i < N; i++)
    {
        ans *= K - 1;       
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
data=input()
n=int(data[:2])
m=int(data[2:])
if 1<=n<=12:
    if 1<=m<=12:
        print("ambiguous".upper())
        exit()
    else:
        print("MMYY")
        exit()
if 1<=m<13:
    print("YYMM")
    exit()
print("NA")

Measured memory_bytes: 3060
#include <vector>
#include <cmath>
#include <functional>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    long long x[n], y[n], p[n];
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> p[i];
    vector<long long> ans(n+1, 1LL<<60);
    long long memox[1<<n][n], memoy[1<<n][n];
    for (int s = 0; s < 1<<n; s++) {
        for (int i = 0; i < n; i++) {
            long long xx = abs(x[i]), yy = abs(y[i]);
            for (int j = 0; j < n; j++) {
                if ((s >> j) & 1) {
                    yy = min(yy, abs(y[i] - y[j]));
                    xx = min(xx, abs(x[i] - x[j]));
                }
            }
            memox[s][i] = xx * p[i];
            memoy[s][i] = yy * p[i];
        }
    }
    for (int s = 0; s < 1<<n; s++) {
        const int k = __builtin_popcount(s);
        for (int t = s; ; t = (t - 1) & s) {
            long long cost = 0;
            int h = s ^ t;
            for (int i = 0; i < n; i++) {
                cost += min(memox[h][i], memoy[t][i]);
            }
            ans[k] = min(ans[k], cost);
            if (t == 0) break;
        }
    }
    for (int i = 0; i <= n; i++) cout << ans[i] << endl;
}


Measured memory_bytes: 10872
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]

min_solved = 1000
for i in range(2 ** d):
    i_str = "{:010b}".format(i)[::-1]
    score = 0
    solved = 0
    for j in range(d):
        if i_str[j] == "1":
            score += 100 * (j + 1) * pc[j][0] + pc[j][1]
            solved += pc[j][0]
    if score < g:
        add_i = i_str[:d].rfind("0")
        for k in range(pc[add_i][0]):
            score += 100 * (add_i + 1)
            solved += 1
            if score >= g:
                break
        else:
            continue

    if solved < min_solved:
        min_solved = solved

print(min_solved)


Measured memory_bytes: 3188
#!/usr/bin/env python3
import sys
INF = float("inf")


def Run_length_encoding(S: str):
    """AAABBC -> [(A, 3), (B, 2), (C, 1)]
    """
    ans = []
    curr = S[0]
    counter = 0
    for c in S:
        if c == curr:
            counter += 1
        else:
            ans.append((curr, counter))
            curr = c
            counter = 1
    ans.append((curr, counter))
    return ans


def solve(S: str, K: int):

    rle = Run_length_encoding(S)
    fchr, fcnt = rle[0]
    lchr, lcnt = rle[-1]
    if len(rle) == 1:
        print(fcnt*K//2)
        return

    ans = 0
    for c, cnt in rle:
        ans += cnt//2
    ans *= K

    if K > 1 and fchr == lchr:
        ans -= K*(fcnt//2)
        ans -= K*(lcnt//2)
        ans += (K-1)*((fcnt+lcnt)//2)
        ans += fcnt//2
        ans += lcnt//2

    print(ans)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    K = int(next(tokens))  # type: int
    solve(S, K)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import java.util.Scanner;

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

	int A, B;
	A = sc.nextInt();
	B = sc.nextInt();

	if (A + B  == 3)
	    System.out.println(3);
	else if (A + B == 4)
	    System.out.println(2);
	else
	    System.out.println(1);

    }
}

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

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

const int INF=1e9;
const int MOD=1e9+7;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

bool GaussJordan(const vvd& _a,const vd& b,vd& x)
{
	int n=_a.size();
	vvd a(n,vd(n+1));
	rep(i,n){
		copy(all(_a[i]),begin(a[i]));
		a[i][n]=b[i];
	}
	
	rep(i,n){
		int p=i;
		repi(j,i+1,n) if(abs(a[p][i])<abs(a[j][i])) p=j;
		if(abs(a[p][i])<EPS) return false;
		swap(a[i],a[p]);
		peri(j,i,n+1) a[i][j]/=a[i][i];
		rep(j,n) if(j!=i) peri(k,i,n+1) a[j][k]-=a[j][i]*a[i][k];
	}
	
	rep(i,n) x[i]=a[i][n];
	return true;
}

int main()
{
	for(int n,s,t;cin>>n>>s>>t && n|s|t;){
		s--,t--;
		vi q(n);
		rep(i,n) cin>>q[i];
		vvi d(n,vi(n));
		rep(i,n) rep(j,n) cin>>d[i][j];
		
		vi dist(n,INF),vis(n);
		dist[t]=0; // 終点から各頂点への最短距離
		rep(_,n){
			int u=-1;
			rep(i,n) if(!vis[i] && (u==-1 || dist[i]<dist[u])) u=i;
			vis[u]=1;
			rep(v,n) if(d[u][v]) dist[v]=min(dist[v],dist[u]+d[u][v]);
		}
		
		vvd a(n,vd(n)); vd b(n);
		rep(i,n){
			a[i][i]=1;
			if(i==t) continue;
			
			if(q[i]==0){
				int cnt=0;
				rep(j,n) if(d[i][j]>0) cnt++;
				rep(j,n) if(d[i][j]>0){
					a[i][j]=-1./cnt;
					b[i]+=1.*d[i][j]/cnt;
				}
			}
			if(q[i]==1){
				int cnt=0;
				rep(j,n) if(d[i][j]>0) cnt+=dist[i]==d[i][j]+dist[j];
				rep(j,n) if(d[i][j]>0) if(dist[i]==d[i][j]+dist[j]){
					a[i][j]=-1./cnt;
					b[i]+=1.*d[i][j]/cnt;
				}
			}
		}
		
		vd x(n);
		GaussJordan(a,b,x);
		printf("%.8f\n",x[s]);
	}
}

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

int main()
{
	int n;
	cin >> n;
	int count = 0;
	int mc = 0;
	for (int i = 0; i < n; ++i) {
		int a, b;
		cin >> a >> b;
		if (a == b) {
			++count;
		}
		else {
			mc = max(mc, count);
			count = 0;
		}
	}
	if (3 <= mc || 3 <= count) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 3620
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
  string s;
  cin >> s;

  int begin, end;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'A') {
      begin = i;
      break;
    }
  }
  for (int i = s.length() - 1; i >= 0; i--) {
    if (s[i] == 'Z') {
      end = i;
      break;
    }
  }
  cout << end - begin + 1 << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
using namespace std;
#define MAXSIZE 200
#define MAXL 100
typedef long long int lli;

int main(){
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    
    int ans = (H - h) * (W - w);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n,m,q = map(int,input().split())
a = [0]*q
b = [0]*q
c = [0]*q
d = [0]*q
for i in range(q):
  a[i],b[i],c[i],d[i] = map(int,input().split())
s = [1]*n
mx = 0
while True:
  sc = 0
  for i in range(q):
    if s[b[i]-1]-s[a[i]-1] == c[i]:
      sc += d[i]
  mx = max(mx,sc)
  s[n-1] += 1
  if s[n-1]>m:
    s[n-2]+=1
    for k in range(n-2):
      if s[n-k-2]>m:
        s[n-k-3]+=1
    for i in range(1,n):
      if s[i]>m:
        s[i]=s[i-1]
  if s[0]>m:
    break
print(mx)
    

Measured memory_bytes: 74116
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(int i = (int)(b); i < (int)(e); ++i)
#define RFOR(i, b, e) for(int i = (int)(e-1); i >= 0; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define REPP(x,y,c) for(const auto& [x,y]:(c))
#define VS vector<string>
#define VI vector<int>
#define VVI vector<vector<int>>
#define ALL(x) (x).begin(),(x).end()
#define PAIR pair<int,int>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;

using namespace std;

int main() {
	int n;
	cin >> n;
	VI t(n);
	VI a(n);
	REP(i, n) { cin >> t[i] >> a[i]; }

	ll p = 1, q = 1;
	REP(i, n) {
		if (p <= t[i] && q <= a[i]) {
			p = t[i];
			q = a[i];
		} else if (p > t[i] || q > a[i]) {
			ll k;
			k = max((p - 1) / t[i], (q - 1) / a[i]) + 1;
			p = k * t[i];
			q = k * a[i];
		}
		//cout << p << " " << q << endl;
	}
	cout << p + q << endl;
}


Measured memory_bytes: 256
import java.io.{BufferedReader, IOException, InputStream, InputStreamReader}
import java.util.StringTokenizer

import scala.collection.mutable
import scala.util.Sorting
import math.{min, max, abs}

object Main {
  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val N = sc.nextInt()
    val M = sc.nextInt()
    val R = sc.nextInt()
    val r = Array.fill(R)(sc.nextInt())
    val INF = 100000000
    val e = Array.fill[Int](N, N)(INF)
    (0 until M) foreach { _ =>
      val a = sc.nextInt() - 1
      val b = sc.nextInt() - 1
      val c = sc.nextInt()
      if (e(a)(b) > c) e(a)(b) = c
      if (e(b)(a) > c) e(b)(a) = c
    }

    val d = e.clone()
    for {
      k <- 0 until N
      i <- 0 until N
      j <- 0 until N
    } d(i)(j) = min(d(i)(j), d(i)(k) + d(k)(j))

    val ans = permutation(r, Integer.MAX_VALUE) { (p, ans) =>
      val iterate = (p zip p.drop(1) map { case (i, j) =>
        d(i - 1)(j - 1)
      }).sum
      min(ans, iterate)
    }
    println(ans)
  }

  def main(args: Array[String]): Unit = {
    solve()
  }

  @specialized
  def permutation[A, B](a: Array[A], z: B)(f: (Array[A], B) => B): B = {
    def swap(i: Int, j: Int): Unit = {
      val temp = a(i)
      a(i) = a(j)
      a(j) = temp
    }

    def step(n: Int, acc: B): B = n match {
      case 1 => f(a, acc)
      case _ =>
        val acc2 = (0 until n - 1).foldLeft(acc) { (acc0, i) =>
          val acc1 = step(n - 1, acc0)
          if (n % 2 == 0) {
            swap(i, n - 1)
          } else {
            swap(0, n - 1)
          }
          acc1
        }
        step(n - 1, acc2)
    }

    step(a.length, z)
  }

  class InputReader(val stream: InputStream) {
    val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    var tokenizer: StringTokenizer = null

    def next: String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next.toInt
    def nextLong(): Long = next.toLong
    def nextChar(): Char = next.charAt(0)
  }

}


Measured memory_bytes: 50636
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define INF 100000000
using namespace std;
const int mod = 1000000007;

int main() {

  string N;
  cin>>N;
  if(N=="hi"||N=="hihi"||N=="hihihi"||N=="hihihihi"||N=="hihihihihi")cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  //vector<int> A(N);
  //for(int i=0; i<N; i++){cin>>A[i];}
  //vector<vector<int>> A(N,vector<int>(M));
  //for(int i=0; i<N; i++){for(int j=0; j<M; j++){cin>>A[i][j];}}
  //sort(A.begin(),A.end());
  //for (int i = 0; i < N; i++) { maximum = max(maximum , A[i]);}
  //for (int i = 0; i < N; i++) { minimum = min(minimum , A[i]);}
//  cout <<  << endl;
}


Measured memory_bytes: 256
# C - Exception Handling
N = int(input())
A = [int(input()) for i in range(N)]
m1 = max(A)
i = 0
while A[i]<m1:
    i += 1
m2 = max(A[:i]+A[i+1:])
for j in range(N):
    print(m1 if i!=j else m2)

Measured memory_bytes: 91460
#然列挙では間に合わない
N,C = map(int,input().split())
ld = [[]]
for i in range(C):
  ld.append([0]+list(map(int,input().split())))
lc = [[]]  
for i in range(N):
  lc.append([0]+list(map(int,input().split())))

#前処理
lmae = [[0 for i in range(C+1)] for j in range(3)]
for p in range(1,N+1):
  for q in range(1,N+1):
    for i in range(1,C+1):
      X = lc[p][q]
      Y = i
      lmae[(p+q)%3][i] += ld[X][Y]

#こたえ作り
lans = []
for i in range(1,C+1):
  for j in range(i+1,C+1):
    for k in range(j+1,C+1):
      for cc in [[0,1,2],[0,2,1],[1,0,2],[1,2,0],[2,0,1],[2,1,0]]:
        ans = lmae[cc[0]][i]+lmae[cc[1]][j]+lmae[cc[2]][k]
        lans.append(ans)
print(min(lans))      

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
    ll n;cin >>n;
    string s;cin >>s;
    ll cnt=0;
    vector<ll>esum(n);
    vector<ll>wsum(n);
    for (int i = 0; i < n; ++i) {
        esum[i]=cnt;
        if(s[i]=='W')cnt++;
    }
    reverse(all(s));
    cnt=0;
    for (int i = 0; i < n; ++i) {
        wsum[i]=cnt;
        if(s[i]=='E')cnt++;
    }
    ll ans=INF;
    for (int i = 0; i < n; ++i) {
        ans=min(ans,esum[i]+wsum[n-i-1]);
    }
    cout <<ans <<endl;
    return 0;
}



Measured memory_bytes: 5380
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <cassert>
#include <cstring>
#include <queue>
#include <cstdio>
#include <cmath>
#include <sstream>
 
using namespace std;
 
typedef long long Long;

typedef vector<int> VI;
typedef vector<VI> VVI;

Long MAX = 1000000000000000000LL;

Long capSum(Long A, Long B) {
	if (A+B > MAX) {
		return MAX+1;
	}
	return A+B;
}

int main(int argc, char *argv[]) {
	Long A, B, C, K;
	cin >> A >> B >> C >> K;
	Long diff = K % 2 == 0 ? (A-B) : (B-A);
	if (abs(diff) > MAX) {
		cout << "Unfair" << endl;
	} else {
		cout << diff << endl;
	}
}

 


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

int main() {
  int N;
  cin >> N;
  vector<int> a(N + 1, 0);
  for (int i = 1; i <= N; i++) cin >> a[i];

  vector<int> b(N + 1, 0);
  for (int i = N; i > 1; i--) {
    int cnt = 0;
    for (int j = i; j <= N; j += i) {
      cnt += b[j];
    }
    cnt %= 2;
    if (a[i] == cnt)
      b[i] = 0;
    else
      b[i] = 1;
  }

  int sum = 0;
  for (int i = 0; i < N + 1; i++) sum += b[i];
  b[1] = (sum + a[1]) % 2;

  int cnt = 0;
  for (int i = 1; i <= N; i++)
    if (b[i]) cnt++;

  cout << cnt << endl;
  if (cnt) {
    for (int i = 1; i <= N; i++)
      if (b[i]) cout << i << " ";
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 2432
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int a=stdIn.nextInt();
        int b=stdIn.nextInt();
        if(a > b)System.out.println("a > b");
		else if(a == b)System.out.println("a == b");
		else if(a < b)System.out.println("a < b");
	}
}


Measured memory_bytes: 26144
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

using ld = long double;

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

	vector<ld> v(n);
	REP(i, n)cin >> v[i];
	vector<vector<ld>> dp(n + 1, vector<ld>(2 * n + 1, 0));
	dp[0][n] = 1;
	REP(i, n) {
		REP(j, 2 * n) {
			dp[i + 1][j + 1] += dp[i][j] * v[i];
		}
		REP(j, 2 * n) {
			dp[i + 1][j] += dp[i][j + 1] * (1 - v[i]);
		}
	}
	ld ans = 0;
	REP(i, n)ans += dp[n][i + n + 1];
	cout << fixed << setprecision(12) << ans << endl;
}

Measured memory_bytes: 281728
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<long double,long double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int a,b;

int main(){
	cin>>a>>b;
	cout<<(a+b+1)/2<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstring>
#include <limits>
using namespace std;
#define ll long long int
#define lli long long int
#define fw(i, s, e) for (ll i = s; i < e; ++i)
#define fe(i, s, e) for (ll i = s; i <= e; ++i)
#define fb(i, e, s) for (ll i = e; i >= s; --i)
#define L(T)  \
    ll T;     \
    cin >> T; \
    while (T--)
#define FASTIO                   \
    ios::sync_with_stdio(false); \
    cin.tie(nullptr);            \
    cout.tie(nullptr);
#define mem(a, i) memset(a, i, sizeof(a))
#define ld long double
#define endl "\n"
#define in(P) \
    ll P;     \
    cin >> P;
int main()
{
    FASTIO
    in(n);
    in(a);
    in(b);

    // if (a + b >= n)
    // cout << a << endl;
    // else
    {
        ll t = n / (a + b) * a;
        ll rem = n - n / (a + b) * (a + b);
        cout << t + min(a, rem) << endl;
    }

    return 0;
}


Measured memory_bytes: 3640
n = int(input())
a, b, c = [], [], []
for _ in range(n):
    _a, _b, _c = map(int, input().split())
    a.append(_a)
    b.append(_b)
    c.append(_c)

dp = [[0]*3 for _ in range(n)]
dp[0] = [a[0], b[0], c[0]]

for i in range(1, n):
    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])

print(max(dp[n-1]))


Measured memory_bytes: 34608
import itertools

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

X = [list(map(int,input().split())) for _ in range(N)]

res = list(itertools.combinations(X,2))

cnt = 0

for i in itertools.combinations(X,2):
    #tmp = zip(i[0],i[1])
    tmp = 0
    for j in zip(i[0],i[1]):
        tmp += pow(j[0]-j[1],2)
    ans = tmp ** 0.5
    if ans.is_integer():
        cnt += 1

print(cnt)

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

int main() {
  ll h, w;
  cin >> h >> w;
  ll ans;
  ans = (h * w + 1) / 2;

  if (h == 1 || w == 1) cout << 1 << endl;
  else cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef double f32;
typedef long long i64;
const int N = 1e5+5;
int n, k; i64 v[3]; string s, t;
int main()
{
    cin>>s>>k, t = s+s+s;
    for(int i = 1; i < t.size(); ++i) if(t[i] == t[i-1]) t[i] = '.', ++v[i/s.size()];
    printf("%lld\n", v[0]+k/2*v[1]+(k-1)/2*v[2]);
    return 0;
}

Measured memory_bytes: 3672
use std::io::*;
use std::str::FromStr;
use std::ascii::AsciiExt;

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

fn main() {
    let n: usize = read();
    let k: usize = read();
    let mut s: Vec<char> = read::<String>().chars().collect();

    s[k-1] = s[k-1].to_ascii_lowercase();
    for c in s.iter() {
        print!("{}", c);
    }

}


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

#define int long long

const int mod = 1000000007;

//法則性を見つけたがなんでこうなるかわかんないや! プラスパスカルの三角形！ｗ

int inv(int m, int mod);
int modPow(int n, int val, int mod);

int n;
int flag[100005];
int fact[100005];
  
main()
{
  fill_n(flag, 100005, -1);
  
  fact[0] = 1;
  for(int i = 1; i < 100005; i++) {
    fact[i] = (fact[i - 1] * i) % mod;
  }
  
  cin >> n;
  
  int g;
  for(int i = 0; i < n + 1; i++) {
    int a;
    cin >> a;
    if(!~flag[a]) {
      flag[a] = i;
    } else {
      g = flag[a] + n - i;
    }
  }
  
  for(int i = 1; i <= n + 1; i++) {
    int sub = 0;
    int val;
    if(i <= g + 1) {
      int j = i - 1;
      sub = (fact[g] * inv(fact[g - j], mod)) % mod;
      (sub *= inv(fact[j], mod)) %= mod;
    }

    val = (fact[n + 1] * inv(fact[n - i + 1], mod)) % mod;
    (val *= inv(fact[i], mod)) %= mod;

    cout << (val - sub + mod) % mod << endl;
  }
  return (0);
}

int inv(int m, int mod)
{
  return (modPow(mod - 2, m, mod));
}

int modPow(int n, int val, int mod)
{
  int g = val;
  int ret = 1;
  while(n) {
    if(n & 1) (ret *= val) %= mod;
    (val *= val) %= mod;
    n >>= 1;
  }
  return (ret);
}


Measured memory_bytes: 2816
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits.h>

using namespace std;

typedef long long LL;

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define dumpMap(m) { for (auto it: m) cout << it.first << "=>" << it.second << ' '; }

const int MOD = 1000000007;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(0);
    
    int N, M;
    cin >> N >> M;

    cout << (N == M ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int n;
	string s;
	cin >> n >> s;
	for (int i = 0; i < (int)s.size(); ++i) {
		s[i] = char((s[i] - 'A' + n) % 26 + 'A');
	}
	cout << s << '\n';
	
 	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 24;
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

typedef unsigned long long ull;
typedef std::pair<int,int> P;

int H, W;

int main(){
    while(std::cin >> H >> W, H){
        int diag = H*H + W*W;

        int res_x = -1, res_y = -1;
        // 対角線が同じとき
        for(int h=H+1;h<=150&&!~res_y;h++){
            for(int w=h+1;w<=150;w++){
                int d = w*w+h*h;
                if(d != diag){continue;}
                res_y = h;
                res_x = w;
                break;
            }
        }

        if(~res_y){
            std::cout << res_y << " " << res_x << std::endl;
        }else{
            // 対角線が長いとき
            for(int h=1;h<=150;h++){
                for(int w=h+1;w<=150;w++){
                    int d = w*w+h*h;
                    if(diag >= d){continue;}
                    if(!~res_y || d < res_x*res_x+res_y*res_y ||
                       (d == res_x*res_x+res_y*res_y && h < res_y)){
                        res_y = h;
                        res_x = w;
                    }
                }
            }
            std::cout << res_y << " " << res_x << std::endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define     debug       printf("\n<<CameHere<<\n")
#define     mem(x,y)    memset(x, y, sizeof(x))
#define     all(qz)     qz.begin(),qz.end()
#define     rall(qz)    qz.rbegin(),qz.rend()
#define     inf         LLONG_MIN
#define     INF         LLONG_MAX
#define     mod         1000000007
#define     Sqr(x)      ((x)*(x))
#define     ll          long long
#define     mk          make_pair
#define     pb          push_back
#define     pi          acos(-1.0)
#define     cos(a)      cos(a*pi/180)
#define     sin(a)      sin(a*pi/180)
#define     tan(a)      tan(a*pi/180)

ll pow(ll c,ll d){return d==0?:c*pow(c,d-1);}
ll gcd(ll a,ll b) {return b==0? a:gcd(b,a%b);}
ll lcm(ll a,ll b) {return ((a*b)/gcd(a,b));}
/*---------AL ASAD NUR RIYAD------------*/


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll n;
    cin>>n;
    vector<ll> v(n);
    ll ar[100005];
    mem(ar,0);
    ll sum=0;
    for(ll i=0;i<n;i++){
        cin>>v[i];
        sum+=v[i];
        ar[v[i]]++;
    }
    //cout<<sum<<endl;
    ll q;
    cin>>q;
    while(q--){
        ll a,b;
        cin>>a>>b;
        sum=sum-(a*ar[a])+(b*ar[a]);
        ar[b]+=ar[a];
        ar[a]=0;
        cout<<sum<<endl;
    }
    return 0;
}



















Measured memory_bytes: 4720
import java.util.*;

public class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        char arr[] = sc.next().toCharArray();
        for(int i=0;i<arr.length;i++){
            if(arr[i]=='9')arr[i]='1';
            else arr[i] = '9';
        }
        for(Character c:arr) System.out.print(c);
        System.out.println();

    }
}


Measured memory_bytes: 21332
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using uInt = long long unsigned int;
using Double = long double;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        Int R;
        cin >> R;

        double ans = 6.28318530717958623200 * R;
        cout << ans << endl;
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    Solve().solve();


    return 0;
}


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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 10000000000000007ll;

const double eps = 1e-10;

// del

const i64 MAXN = 500005;

i64 a[MAXN];

inline void up(char p, i64 c, i64 i) {
    if (p == '<') {
        for (i64 j = i - c; j < i; j++) {
            a[j] = (i - 1) - j;
        }
    }
    else if (p == '>') {
        for (i64 j = i - c; j < i; j++) {
            a[j] = j - (i - c);
        }
    }
}

vector<pair<char, i64>> q;

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    string s;
    cin >> s;

    char p = '!';
    i64 c = 1;

    for (i64 i = 0; i < s.size(); i++) {
        if (p == s[i]) {
            c++;
        }
        else {
            if (p != '!') {
                q.push_back({p, c});
            }

            p = s[i];
            c = 1;
        }
    }
    q.push_back({ p, c });

    i64 si = q.front().first == '>' ? 1 : 0;
    i64 fi = q.size() - (q.back().first == '<' ? 1 : 0);

    i64 j = 0;

    if (q.front().first == '>') {
        for (i64 i = 0; i < q.front().second; i++) {
            a[i] = q.front().second - i;
        }

        j += q.front().second;
    }

    for (i64 k = si; k < fi; k += 2) {
        for (i64 i = 1; i < q[k].second; i++) {
            a[j + i] = i;
        }

        j += q[k].second;

        a[j] = max(q[k].second, q[k + 1].second);

        for (i64 i = 1; i < q[k + 1].second; i++) {
            a[j + i] = q[k + 1].second - i;
        }

        j += q[k + 1].second;
    }

    if (q.back().first == '<') {
        for (i64 i = 1; i <= q.back().second; i++) {
            a[j + i] = i;
        }
        j += q.back().second;
    }



    i64  R = 0;
    for (i64 i = 0; i <= s.size(); i++) {
        R += a[i];
    }

    cout << R << endl;


    return 0;
}

Measured memory_bytes: 9104
import java.util.Scanner;

/**
 * https://atcoder.jp/contests/abc172/tasks/abc172_a
 * 
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        System.out.println((int) (a + Math.pow(a, 2) + Math.pow(a, 3)));
    }
}

Measured memory_bytes: 35700
object Main extends App {
  import scala.io.StdIn._
  val Array(n, q) = readLine.trim.split(' ').map(_.toInt)
  val barrier = Array.tabulate(n){_ ⇒
    val Array(x, y, z, r, l) = readLine.trim.split(' ').map(_.toLong)
    (Point(x, y, z), r, l)
  }
  for (_ ← 0 until q) {
    val Array(sx, sy, sz, dx, dy, dz) = readLine.trim.split(' ').map(_.toInt)
    val from = Point(sx, sy, sz)
    val to = Point(dx, dy, dz)
    val vec = to - from match {case v ⇒ v / v.length}
    //println(vec)
    println(barrier.map{
      case (center, radius, cost) ⇒
        val nearest = vec * vec.dot(center - from) + from
        if ((from - nearest).dot(to - nearest) <= 0 && (center - nearest).length <= radius + 0.0000001) cost else 0L
    }.sum)
  }
}
case class Point(x: Double, y: Double, z: Double) {
  def -(that: Point): Vector = Vector(x - that.x, y - that.y, z - that.z)
  def +(that: Vector): Point = Point(x + that.x, y + that.y, z + that.z)
}
case class Vector(x: Double, y: Double, z: Double) {
  def dot(that: Vector): Double = x * that.x + y * that.y + z * that.z
  def +(that: Point): Point = Point(x + that.x, y + that.y, z + that.z)
  def length: Double = Math.sqrt(x * x + y * y + z * z)
  def /(that: Double): Vector = Vector(x / that, y / that, z / that)
  def *(that: Double): Vector = Vector(x * that, y * that, z * that)
  def toPoint: Point = Point(x, y, z)
}



Measured memory_bytes: 45092
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

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

    int a = 0;

    if (S.length() == 1)
    {
        cout << "0";
    }
    else
    {
        for (int i = 0; i < (S.length() / 2); ++i)
        {
            if (S[i] != S[S.length() - 1 - i])
            {
                a++;
            }
        }
        cout << a;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll dp[200001];
ll power(ll x,ll y,ll mod)
{
	if(y==0) return 1;
	ll q=power(x,y/2,mod)%mod;
	if(y%2==0)
	return (q*q)%mod;
	else
	return ((q*q)%mod*x)%mod;
}
ll func(ll x)
{
	if(x==0) return 0;
	if(x==1) return 1;
	if(dp[x]!=-1) return dp[x];
	ll ret=func(x%__builtin_popcountll(x))+1;
	return dp[x]=ret;
}
ll modulo(string s,ll x)
{
	ll r=0;
	for(ll i=0;i<s.length();i++)
	{
		{
			r=r*2+s[i]-'0';
			r%=x;
		}
	}
	return r;
}
int main()
{
	ll l,r,i,j,k,n,m,x;
	cin>>n;
	memset(dp,-1,sizeof(dp));
	for(i=0;i<=200000;i++)
	{
		if(dp[i]==-1)
		dp[i]=func(i);
	}
//	for(i=0;i<=10;i++)
//	cout<<dp[i]<<' ';
	string s;
	cin>>s;
	ll ctr=0;
	for(i=0;i<n;i++)
	if(s[i]=='1') ctr++;
	ll a=modulo(s,ctr+1);
	ll b=0;
	if(ctr>1)
	b=modulo(s,ctr-1);
	//cout<<ctr<<endl;
	for(i=0;i<n;i++)
	{
		if(s[i]=='0')
		{
			ll mod=ctr+1;
			ll q=power(2,n-1-i,mod);
			s[i]='1';
			s[i]='0';
			q%=mod;
			cout<<dp[(a+q)%mod]+1<<endl;
		}
		else
		{
			ll mod=ctr-1;
			if(mod==0)
			{
				cout<<0<<endl;
				continue;
			}
			ll q=power(2,n-1-i,mod);
			q%=mod;
			q=b-q;
			if(q<0) q+=mod;
			else q%=mod;
			cout<<dp[q]+1<<endl;
		}
	}
}

Measured memory_bytes: 5468
import sys

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

# N <= 50
if A == sorted(A):
    print(0)
    sys.exit()

min_a = (float("inf"), -1)
max_a = (-float("inf"), -1)
for i in range(N):
    if A[i] < min_a[0]:
        min_a = (A[i], i)
    if A[i] > max_a[0]:
        max_a = (A[i], i)

# 操作履歴
ops = []
# マイナスに寄せる
if abs(min_a[0]) > abs(max_a[0]):
    for i in range(N-1, -1, -1):
        # 高々2回
        while A[i] > min_a[0]:
            A[i] += min_a[0]
            ops.append((min_a[1]+1, i+1))
        min_a = (A[i], i)
        
else:
    for i in range(N):
        # 高々2回
        while A[i] < max_a[0]:
            A[i] += max_a[0]
            ops.append((max_a[1]+1, i+1))
        max_a = (A[i], i)
# print(A)

print(len(ops))
for (x, y) in ops:
    print(x, y)

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

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

	int ans = 0;

	for (int i = 0; i <= A; i++) {
		for (int j = 0; j <= B; j++) {
			if ((X - (i * 500 + j * 100)) % 50 == 0)if ((X - (i * 500 + j * 100)) / 50 >= 0 && (X - (i * 500 + j * 100)) / 50 <= C)ans++;
		}
	}
	cout << ans;
}

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

using namespace std;
int N,M;
vector<int> A;
const string MINUSINF = "-";
void chmax(string &a, string b){
  if(a == MINUSINF){
    a = b;
  }
  else if(a.size() < b.size()){
    a = b;
  }
  else if(a.size() == b.size()){
    if(a < b){
      a = b;
    }
  }
}
long long match[10] = {2,5,5,4,5,6,3,7,6};
string dp[11000];
int main(){
  cin >> N >> M;
  A.resize(M);
  for(int i=0;i<M;i++){
    cin >> A[i];
  }
  for(int i=0;i<11000;i++){
    dp[i] = MINUSINF;
  }
  dp[0] = "";

  for(int i=0;i<=N;i++){
    if(dp[i] == MINUSINF){
      continue;
    }
    for(auto itr = A.begin();itr != A.end(); itr++){
      chmax(dp[i+match[*itr-1]],dp[i]+(char)('0'+*itr));
    }
  }
  cout << dp[N] << endl;

}


Measured memory_bytes: 43776
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  long long ans=0;
  cin>>n;
  unordered_map<string,int> umap;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    if(umap.find(s)!=umap.end()){ans+=++umap[s];}
    else{umap[s]=0;}
  }
  cout<<ans;
}

Measured memory_bytes: 10660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
int n;
char s[maxx][17];
ll ans;
int dd[7];

void cnt(char t[maxx]) {
	if(t[0] == 'M') dd[1]++;
	else if(t[0] == 'A') dd[2]++;
	else if(t[0] == 'R') dd[3]++;
	else if(t[0] == 'C') dd[4]++;
	else if(t[0] == 'H') dd[5]++;
}

int main() {
	cin >> n;
	for(int i = 1; i <= n; i++) {
		scanf("%s", s[i]);
		cnt(s[i]);
	}
	for(int i = 1; i <= 5; i++)
		for(int j = i + 1; j <= 5; j++)
			for(int k = j + 1; k <= 5; k++) ans += (ll)dd[i] * (ll)dd[j] * (ll)dd[k];
	cout << ans << endl;
}

Measured memory_bytes: 1920
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#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 Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int n;
    cin>>n;
    vector<int> a(n);
        rep(i,n) cin>>a.at(i);
    int cnt=0;
    for(int i=0;i<n;i+=2){
        if(a[i]%2==1) cnt ++;
    }
    cout<<cnt<<endl;
}/*
./problem.exe
*/

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

int main() { 	
 int N,M,D,m,n,i;
  string S;
 cin >>N>>M>>D;
	if(N>M){
    m=M;
      if(N<D){
      n=N; 
      }else{
      n=D;
      }
    }else{
    m=N;
      if(M<D){
      n=M;
      }else{
      n=D;
      }
    } 
  
  cout << n+m<<endl;
}

Measured memory_bytes: 256
from collections import deque

n, k = list(map(int,input().split(' ')))
path = []
for i in range(n+1):
    path.append([])
for i in range(n-1):
    a, b = list(map(int,input().split(' ')))
    path[a].append(b)
    path[b].append(a)
val = [0] * (n+1)
for i in range(k):
    v, pt = list(map(int,input().split(' ')))
    val[v] += pt

used = {}
q = deque([1])
used[1] = True
while q:
    v = q.pop()
    for next_v in path[v]:
        if next_v not in used:
            used[next_v] = True
            val[next_v] += val[v]
            q.append(next_v)

print(' '.join([str(pt) for pt in val[1:]]))


Measured memory_bytes: 88060