akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::io::*;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

fn main(){
    input!{
        n:i32,
    }
    println!("{}", 3 * n * n);
}


Measured memory_bytes: 4352
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=LI()
dp=[[-1]*n for i in range(n)]
acc=list(accumulate(lis))
for i in range(n):
    dp[i][i]=0
def memo(x,y):
    if dp[x][y]>=0:
        return dp[x][y]
    res=inf
    for i in range(x,y):#左側区間の右端
        if x==0:
            if acc[y]+memo(x,i)+memo(i+1,y)<res:
                res=acc[y]+memo(x,i)+memo(i+1,y)
        else:
            if acc[y]-acc[x-1]+memo(x,i)+memo(i+1,y)<res:
                res=acc[y]-acc[x-1]+memo(x,i)+memo(i+1,y)
    dp[x][y]=res
    return res
        
for i in range(n):
    for j in range(i,n):
        memo(i,j)
#print(dp)
print(dp[0][-1])

        

        
    


Measured memory_bytes: 118392
use std::io;
use std::str::FromStr;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn input_i32_vec() -> Vec<i32> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn main() {
    let n: usize = input();
    let d_vec = input_i32_vec();
    let mut sum = 0;
    for i in 0..n {
        for j in (i+1)..n {
            sum += d_vec[i] * d_vec[j];
        }
    }
    println!("{}", sum);
}


Measured memory_bytes: 4352
N = int(input())
lis = [0] * 10**6
A = list(map(int, input().split()))
for i in range(N):
    lis[A[i]] += 1
val = sum(A)
Q = int(input())
for i in range(Q):
    B,C = map(int, input().split())
    val -= lis[B] * B
    val += lis[B] * C
    lis[C] += lis[B]
    lis[B] = 0
    print(val)


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{

	cin.tie(0); ios_base::sync_with_stdio(false);
	ll n, ans=0;
	cin >>n;
	ans = 1;
	rep(i, 3) ans *=n;
	cout << ans <<"\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>


using namespace std;

int main(){
	int k,x;
	scanf("%d%d",&k,&x);
	for(int i=x-k+1;i<=x+k-2;i++){
		cout << i << " ";
	}cout << x+k-1 << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

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

	ll N, K;
	ll score = 0;
	ll times = 0;
	double ans = 0.0F;

	cin >> N >> K;

	rep(i, N) {
		score = i + 1;
		if (score >= K) {
			ans += ((double)1 / N);
		}
		else {
			times = (ll)ceil(log2((double)K / (i + 1)));
			ans += ((double)1 / N) * ((double)1 / pow(2, times));
		}
	}

	cout << fixed << setprecision(12) << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi   = vector<int>;
using vll  = vector<ll>;
using vc   = vector<char>;
using vvll  = vector<vll>;
using vvi  = vector<vi>;
using vvc  = vector<vc>;
using vb   = vector<bool>;
using vvb  = vector<vb>;
using pii  = pair<int,int>;
using vpii = vector<pii>;


int main() {
    int A, B; cin >> A >> B;
    if (A >= 13) {
        cout << B;
    } else if (A >= 6) {
        cout << B/2;
    } else {
        cout << 0;
    }
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

int c[300];
int main()
{
	string s;
	cin >> s;
	for(auto it : s)
		c[it] ++;
	int cnt = 0;
	for(int i = 'A'; i <= 'Z'; i ++)
		if(c[i] == 2)
			cnt ++;
		
		cout << (cnt==2?"Yes":"No");



	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

  int R, G, B, N;
  cin >> R >> G >> B >> N;

  int ans = 0;
  for (int r = 0; r <= N; r++) {
    for (int g = 0; g <= N; g++) {
      int t = N - r * R - g * G;
      if (t >= 0 && t % B == 0) {
        ans++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define MAX_N 100000
#define MAX_Q 100000


long long n, q;
long long dat[MAX_N*4];

//すべてのノードを0で初期化
void init(){
    for(int i = 0; i < 2*n - 1; i++) dat[i] = 0;
}


//a[i] を x に変更
void update(int i, long long x){
    i += n - 1;
    dat[i] = x;

    //登りながら探索
    while(i > 0){
        i = (i - 1) / 2;
        dat[i] = max(dat[2*i + 1], dat[2*i + 2]);
    }
}


//区間[a, b)の最大値を返す
long long find(int a, int b, int k, int l, int r){
    if(r <= a || b <= l) return 0;
    else if(a <= l && r <= b) return dat[k];
    else{
        long long vl = find(a, b, k * 2 + 1, l, (l + r)/2);
        long long vr = find(a, b, k * 2 + 2, (l + r)/2, r);
        return max(vl, vr);
    }
}

int main(){

    cin >> q;
    n = q;
    n++;
    vector<long long> dp(q + 1, 0);
    vector<int> POW(20);
    POW[0] = 1;

    for(int i = 1; i < 20; i++){
        POW[i] = POW[i-1]*2;
    }

    //n以上n^2っぽいなにかと置換
    n = *lower_bound(POW.begin(), POW.end(), n);
    init();

    for(int i = 0; i < q; i++){
        long long x; cin >> x;

        long long Max = find(0, x, 0, 0, n);
        dp[x] = max(dp[x], Max + x);
        update(x, dp[x]);
        
        //cout << x << " " << Max << " " << dp[x] << endl;
    }

    long long ans = 0;
    for(int i = 1; i <= q; i++) ans = max(ans, dp[i]);
    ans = -ans;
    for(int i = 1; i <= q; i++) ans += (long long)i;
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 5724
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll K, T;
  cin >> K >> T;
  vector<ll> a(T);
  for (int i = 0; i < T; i++) {
    cin >> a[i];
  }
  sort(a.rbegin(), a.rend());
  for (int i = 0; i < T; i++) {
    if (a[i] <= 1) continue;
    ll j = i + 1;
    while (a[i] > 0 && j < T) {
      if (a[j] < 1) {
        j++;
      } else {
        a[i]--;
        a[j]--;
      }
    }
  }
  ll ans = 0;
  for (auto res : a) {
    ans += max(0LL, res - 1);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] str = Console.ReadLine().Split(' '); //700 600 680
        var a = int.Parse(str[0]); //700
        var b = int.Parse(str[1]); //600
        var c = int.Parse(str[2]); //780
        if (a < b)
        {
            if (a < c)
            {
                Console.Write(b < c ? a + b : a + c);
            }
            else
            {
                Console.Write(a + c);
            }
        }
        else
        {
            if (b < c)
            {
                Console.Write(a < c ? b + a : b + c);
            }
            else
            {
                Console.Write(b + c);
            }
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define pfi(a) printf("%d",a);
#define pfl(a) printf("%lld",a);
#define pfin(a) printf("%d\n",a);
#define pfln(a) printf("%lld\n",a);
#define sfi(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pb push_back
#define f(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define endl "\n"
const int MAXN=3e5+5;
const int M= 1e9;

int main(){	
	
	ll sum,n;
	cin>>sum>>n;

	f(i,0,n){
		ll temp;
		sfl(temp)

		sum-=temp;
	}

	sum=max(sum,-1ll);

	cout<<sum;
	
	return 0;	
}

Measured memory_bytes: 3684
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>

using namespace std;
int n,m;
int a[5][233],d[5][233];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[1][i]);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[2][i]);
	for(int i=1;i<=n;i++)
	{
		d[1][i]=d[1][i-1]+a[1][i];
		d[2][i]=max(d[1][i],d[2][i-1])+a[2][i];
	}
	printf("%d\n",d[2][n]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793
int dx[] = {0,1,-1,0,1,-1,1,-1};
int dy[] = {1,0,0,-1,1,-1,-1,1};

int main(){
    string s;
    cin >> s;
    int ans = 0;
    int len = 1;
    string tmp = "";

    for(int i = 0; i < (int)s.size();){
        string str = s.substr(i, len);
        if(tmp != str){
            ans++;
            tmp = str;
            i += len;
        }else{
            len++;
            if(len + i > (int)s.size())
                break;
            continue;
        }
        len = 1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int r, c, k;
    cin >> r >> c >> k;
    vector<string> grid;
    string s;
    for(int i = 0; i < r; i++) {
        cin >> s;
        grid.push_back(s);
    }
    int ans = 0;
    for(int stat_r = 0; stat_r < (1<<r); stat_r++) {
        for(int stat_c = 0; stat_c < (1<<c); stat_c++) {
            int acc = 0;
            for(int i = 0; i < r; i++) {
                if ((stat_r >> i) & 1) 
                    continue;
                for(int j = 0; j < c; j++) {
                    if ((stat_c>>j) & 1)
                        continue;
                    if (grid[i][j] == '#')
                        acc += 1;
                }
            }
            // cout << "stat_r " << stat_r << ", acc = " << acc << endl;
            if (acc == k)
                ans += 1;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#1
#入力
N=int(input())
A=list(map(int,input().split()))

#処理

X=[0 for i in range(8)]
Y=0
for i in A:
    if i<400:
        X[0]=1
    elif i<800:
        X[1]=1
    elif i<1200:
        X[2]=1
    elif i<1600:
        X[3]=1
    elif i<2000:
        X[4]=1
    elif i<2400:
        X[5]=1
    elif i<2800:
        X[6]=1
    elif i<3200:
        X[7]=1
    else:
        Y+=1
if sum(X)==0:
    print(1,Y)
else:
    print(sum(X),sum(X)+Y)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
    int x,y,z;
    cin >> x >> y >> z;
    if(y<z){
    }else{
      swap(y,z);
    }
    if(x<y){
    }else{
      swap(x,y);
    }
    if(y<z){
    }else{
      swap(y,z);
    }
    cout << x << " " << y << " " << z << endl;
    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N; cin >> N;
    vector<ll> A(N); rep(i, N){cin >> A.at(i);}
    map<ll, ll> cnt;
    cnt[-1] = 3;
    ll ans = 1;
    rep(i, N){
        ll cur = A.at(i);
        ll prev = A.at(i) - 1;
        ans = ans * cnt[prev] % MOD;
        if (cnt.find(A.at(i)) != cnt.end()){
            cnt[cur]++; cnt[prev]--;
        } else {
            cnt[cur] = 1; cnt[prev]--;
        }
    }
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 10124
n = int(input())
a = list(map(int,input().split()))

m = []

for i in a:
    m.append(i)
    m.append(i+1)
    m.append(i-1)


d ={}
for i in m:
    if i not in d:
        d[i] =0
    d[i] += 1



b = 0
for i in d.keys():
    if b <= d[i]:
        b = d[i]


print(b)



Measured memory_bytes: 25580
using System;

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b;

            string inD0 = Console.ReadLine();
            string[] cngD0 = inD0.Split(' ');

            a = int.Parse(cngD0[0]);
            b = int.Parse(cngD0[1]);

            Console.WriteLine(a*b);
        }
    }
}


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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> gg(n);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    gg[u].push_back(v);
    gg[v].push_back(u);
  }
  for (int i = 0; i < n; i++) {
    cout << gg[i].size() << '\n';
  }
  return 0;
}

Measured memory_bytes: 3600
// IOI 2021
#include <bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
 
////////////////////////////////////////////////////////////////////
 
const int N = 1e5 + 5;

int A[3];

int main() {
 
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	mt19937 Rnd(time(0));
	
	bool e = 0;
	for (int i = 0; i < 3; i++) cin >> A[i], e |= (A[i] % 2 == 0);
	sort(A, A + 3);
	if (e) die(0);
	cout << 1LL * A[0] * A[1] << endl;

	return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
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; }
const ll MOD = 1e9+7;

int main(){
    ll N;
    cin >> N;
    bool ok = true;
    REP(i,N){
        ll a;
        cin >> a;
        if(a%2 == 1)
            continue;
        if(!(a % 3 == 0 || a % 5 == 0))
            ok = false;
    }

    if(ok)
        cout << "APPROVED" << endl;
    else
        cout << "DENIED" << endl;
        
    return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF=1LL<<60;
//set<int>::iterator it;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int a[3],k;
	cin>>a[0]>>a[1]>>a[2]>>k;
	sort(a,a+3);
	cout<<a[2]*pow(2,k)+a[0]+a[1]<<endl;;
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
	int w, n;
	int pos[30];
	
	scanf("%d %d", &w, &n);
	
	for (int i = 1; i <= w; i++){
		pos[i - 1] = i;
	}
	
	for (int i = 0; i < n; i++){
		int a, b;
		scanf("%d,%d", &a, &b);
		
		swap(pos[a - 1], pos[b - 1]);
	}
	
	for (int i = 0; i < w; i++){
		printf("%d\n", pos[i]);
	}
	
	return (0);
}

Measured memory_bytes: 1188
//
//  main.cpp
//  CoderWork
//
//  Created by Minoru Hayashi on 2020/02/29.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//

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

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const ll MOD = 1000000007;

//#define __DBG__


void solve(void){

  string S;
  
  cin >> S;
  
  bool flag=1;
  
  if(S.size()%2==1){
    flag=0;
  }
  else
  {
  
    REP(i,S.size()/2){
      string A=S.substr(i*2,2);
      
      if(A!="hi"){
        flag=0;
        break;
      }
    }
  }
  
  puts(flag?"Yes":"No");


  return;
}

int main(int argc, const char * argv[]) {



    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
  
    solve();
 
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)
#define rrep(i,a,b) for(int (i)=int(a);(i)>=int(b);(i)--)

#define put(a) cout << (a) << endl

#define INF 1000000001
#define MOD 1000000007
#define INF64 1000000000000000001

#define F first
#define S second

#define Pii  pair<int,int>
#define Pll  pair<long long,long long>
#define Piii pair<int,pair<int,int>>
#define Plll pair<long long,pair<long long,long long>>

#define Vll(a,b,c)    vector<vector<long long>> (a)((b),vector<long long>((c))
#define Vlll(a,b,c,d) vector<vector<vector<long long>>> (a)((b),vector<vector<long long>>((c),vector<long long>((d)))

#define MAX_N 1000000
int N,M,L,A,B;
int K[MAX_N];
int ans;
vector<char> C;
bool bool_ans;

int solve(void) {


  return ans;
}

int main (void)
{
  int a;
  cin >> a;

  cout << a*a*3 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
using namespace std;
typedef long long ll;
const int N=2e5+20;
const ll mod=1e9+7;
ll f[N],h,w,a,b;
ll powmod(ll x,ll n)
{
    ll s=1;
    while(n)
    {
        if(n&1)
            s=(s*x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }
    return s;
}
ll lucas(ll n,ll m)
{
    ll a=f[n],b=(f[m]*f[n-m])%mod;
    return (a*powmod(b,mod-2))%mod;
}
int main()
{
    f[0]=1;
    for(ll i=1;i<N;i++)
        f[i]=(f[i-1]*i)%mod;
    	scanf("%lld%lld%lld%lld",&h,&w,&a,&b);
        ll res=0;
        for(ll i=b+1;i<=w;i++)
        {
            ll tmp=(lucas(i-1+h-a-1,h-a-1)*lucas(w-i+a-1,w-i))%mod;
            res=(res+tmp)%mod;
        }
        printf("%lld\n",res);    
    return 0;
}

Measured memory_bytes: 1920
from itertools import accumulate
inf = float('inf')

def acc_max(array):
    na = []
    tmp = 0
    for a in array:
        if a > tmp:
            tmp = a
        na.append(tmp)
    return na

N,C = map(int,input().split())
X = []; V = []
for _ in range(N):
    x,v = map(int,input().split())
    X.append(x)
    V.append(v)

right = list(accumulate(V))
left = list(accumulate(V[::-1]))

right1 = [r - x for r, x in zip(right,X)]

left1 = [l - (C-x) for l, x in zip(left,X[::-1])]

right2 = acc_max([r - 2*x for r, x in zip(right,X)])

left2 = acc_max([l - 2*(C-x) for l, x in zip(left,X[::-1])])

ans = 0

for end in range(N):
    if end == N-1:
        res = max(right1[end],left1[end])
    else:
        res = max(right1[end]+left2[N-1-(end+1)],left1[end]+right2[N-1-(end+1)])
    if res > ans:
        ans = res

print(ans)

Measured memory_bytes: 37844
//
//  code.cpp
//  Cpp
//
//  Created by Yash Jain on 25/02/20.
//  Copyright © 2020 Yash Jain. All rights reserved.
//

#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int degree[200001];
long long fact[200001];

long long powermod(long long a,long long b){
    if(b == 0)
        return 1;
    if(b%2 == 1)
        return (a*(powermod((a*a)%mod,b/2)))%mod;
    return powermod((a*a)%mod, b/2);
}

long long ncr(long long a,long long b){
    long long temp = (fact[a]*powermod(fact[b],mod-2))%mod;
    temp = (temp*powermod(fact[a-b],mod-2))%mod;
    return temp;
}

int main(){
    int x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    
    vector<long long>p1(a,0),p2(b,0),p3(c,0);
    for(int i=0;i<a;i++){
        cin>>p1[i];
    }
    for(int i=0;i<b;i++){
        cin>>p2[i];
    }
    for(int i=0;i<c;i++){
        cin>>p3[i];
    }
    
    sort(p1.begin(),p1.end());
    sort(p2.begin(),p2.end());
    sort(p3.begin(),p3.end());
    
    vector<long long>taken;
    
    long long sum = 0;
    
    for(int i = a-1;i>a-1-x;i--){
        taken.push_back(p1[i]);
        sum+=p1[i];
    }
    
    for(int i = b-1;i>b-1-y;i--){
        taken.push_back(p2[i]);
        sum+=p2[i];
    }
    
    sort(taken.begin(),taken.end());
    long long ans = sum;
    
    long long r = c-1;
    long long l = 0;
    for(int j=0;j<min(c,x+y);j++){
        if(p3[r]>taken[l]){
            ans+=p3[r]-taken[l];
            l++;
            r--;
        }
    }
    cout<<ans;
}


Measured memory_bytes: 4724
i = gets.to_i
ary = gets.split(" ").map(&:to_i)
count = 0
ary.each do |n|
    if n % 2 == 0
        k = n
        if k % 3 != 0 && k %5 !=0
            count +=1
        end
    end
end
if count == 0
    puts "APPROVED"
else
    puts "DENIED"
end

Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

typedef vector<int> vec;
typedef vector<vec> mat;

const ll mod = 1000000007;

int main(){
    int n, m;
    cin >> n >> m;
    priority_queue<int> a;
    rep(i, n) {
        int p;
        cin >> p;
        a.push(p);
    }
    rep(i, m){
        int p = a.top();
        a.pop();
        p /= 2;
        a.push(p);
    }
    ll ans = 0;
    rep(i, n){
        int p = a.top();
        a.pop();
        ans += p;
    }
    cout << ans << endl;


}

Measured memory_bytes: 3908
package main

import "fmt"

func main() {
	var a, b, k int
	fmt.Scan(&a, &b, &k)
	for i := 0; i < k; i++ {
		if i%2 == 0 {
			if a%2 == 1 {
				a--
			}
			a /= 2
			b += a

		} else {
			if b%2 == 1 {
				b--
			}
			b /= 2
			a += b
		}
	}
	fmt.Println(a, " ", b)
}


Measured memory_bytes: 1768
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000001;
constexpr ll INF= 9 * 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

int main() {
    int N;
    cin >> N;
    cout << N * N * N << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N = 5 ;
  int A ;
  vector<int> vec(N);
  for (int i = 0 ; i < N; i++) {
  cin >> vec.at(i);
  }
  A = std::accumulate(vec.begin(), vec.end(), 0);

    cout << (1 + 2 + 3 + 4 + 5) - A << endl;
  
}

Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 

 
const int INF = 1000000;
const double EPS = 1e-8;
const int mod = 1e9 + 7;

int main(){
	int d[6+10][2+10];
	rep(i, 6+10) rep(j, 2+10) d[i][j] = -1;
	d[0][0]=1;
	d[0][1]=2;
	d[1][1]=3;
	d[2][0]=1;
	d[3][0]=4;
	d[3][1]=5;
	d[4][0]=5;
	d[4][1]=2;
	d[5][0]=2;
	d[5][1]=1;

	string s;
	int pos;
	while(cin>>s && s!="#"){
		pos = 0;
		rep(i, s.size()){
			if(pos!=-1)
				pos = d[pos][s[i]-'0'];
		}
		cout<<(pos==5?"Yes":"No")<<endl;
	}
}

Measured memory_bytes: 1180
#include<bits/stdc++.h>
using namespace std;
int main()
{long long k,m,sum=0,ans=INT_MIN;cin>>k>>m;
 vector<long long>a(m);
for(long long i=0;i<m;i++){cin>>a[i];if(a[i]==0)a[i]=k;}
 sort(a.begin(),a.end());
 for(long long i=0;i<m-1;i++)
 {
   sum+=(a[i+1]-a[i]);
   ans=max(ans,(a[i+1]-a[i]));
 }
 sum+=(a[0]+k-a[m-1]);
 ans=max(ans,(a[0]+k-a[m-1]));
cout<<sum-ans<<"\n";
 return 0;
}


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

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

using namespace std;

using ll = long long int;

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec)
{
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  return os;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, k;
  double result;
  cin >> n >> k;
  for(int i = 1; i <= n; ++i)
  {
    double r = 1.0/n;
    ll cur = i;
    while (cur < k)
    {
      cur *= 2;
      r /= 2;
    }
    result += r;
  }
  printf("%.12f\n", result);
}


Measured memory_bytes: 256
c = [list(map(int, input().split())) for _ in range(3)]

p = c[0][1] - c[0][0]#b2-b1
q = c[0][2] - c[0][1]#b3-b2
r = c[1][0] - c[0][0]#a2-a1
s = c[2][0] - c[1][0]#a3-a2

flg = True
for i in range(1, 3):
    if (p != c[i][1] - c[i][0]) or (q != c[i][2] - c[i][1]) or (r != c[1][i] - c[0][i]) or (s != c[2][i] - c[1][i]):
        flg = False
        break
print('Yes' if flg else 'No')

Measured memory_bytes: 3064
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int mod = 1e9 + 7;
const int Inf = (int)2e9 + 5;
const ll  Lnf = (ll)2e18 + 5;
const int N   = 4e5 + 5;


int solve() 
{
	
	ll n,w;
	cin>>n>>w;

	ll val[n+1],wt[n+1];
	/*for(int i=0;i<n;i++) cin>>val[i];
	for(int i=0;i<n;i++) cin>>wt[i];*/

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

	ll dp[n+1][w+1];

	memset(dp,0,sizeof dp);

	for(ll i=1;i<=n;i++){
		for(ll j=1;j<=w;j++){
			if(j>=wt[i-1]){
				dp[i][j] = max(dp[i-1][j-wt[i-1]]+val[i-1],dp[i-1][j]);
			}else{
				dp[i][j] = dp[i-1][j];
			}
		}
	}

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


	return 0;
}
int main(){
	int test = 1;
	//scanf("%d", &test);
	while (test--)solve();return 0;
}

Measured memory_bytes: 79104
N = int(input())
S = str(input())
s = S
count = 0
for i in range(10):
  i = str(i)
  for j in range(10):
    j = str(j)
    for k in range(10):
      k = str(k)
      if i in s:
        s=s[s.index(i)+1:]
        if j in s:
          s=s[s.index(j)+1:]
          if k in s:
            count += 1
      s = S
print(count)
        

Measured memory_bytes: 9308
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;
const int INF = 1e9;
const int MXN = 0;
const int MXV = 0;
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define FOR(i, L, R) for (int i = L; i != (int)R; ++i)
#define FORD(i, L, R) for (int i = L; i != (int)R; --i)
#define IOS                                                                    \
    cin.tie(nullptr);                                                          \
    cout.tie(nullptr);                                                         \
    ios_base::sync_with_stdio(false);

int main()
{
    // IOS;
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vector<LL> R(a), G(b), C(c);
    FOR(i, 0, a) { cin >> R[i]; }
    FOR(i, 0, b) { cin >> G[i]; }
    FOR(i, 0, c) { cin >> C[i]; }
    sort(R.begin(), R.end(), greater<LL>());
    sort(G.begin(), G.end(), greater<LL>());
    FOR(i, 0, x) { C.push_back(R[i]); }
    FOR(i, 0, y) { C.push_back(G[i]); }
    sort(C.begin(), C.end(), greater<LL>());
    LL ans = 0;
    FOR(i, 0, x + y) { ans += C[i]; }
    cout << ans << '\n';
}


Measured memory_bytes: 6384
s = input()

def validation(s):
    if s[0] != "A":
        return "WA "
    s = s[1:]
    if s[1:-1].count("C") != 1:
        return "WA "
    c = 0
    for i in s:
        if i.islower() != True:
            c += 1
    if c != 1:
        return "WA "
    return "AC"

print(validation(s))

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H, W;
		H = sc.nextInt();
		W = sc.nextInt();
		char a[][] = new char[H][W];

		for (int i = 0; i < H; i++) {
			String s = sc.next();
			for (int j = 0; j < W; j++) {
				a[i][j] = s.charAt(j);
			}
		}
		sc.close();

		for (int i = 0; i < H; i++) {
			int x = 0;
			for (int j = 0; j < W; j++) {
				if (a[i][j] == '.') {
					x++;
				}
			}
			if (x == W) {
				for (int j = 0; j < W; j++) {
					a[i][j] = '0';
				}
			}
		}

		for (int i = 0; i < W; i++) {
			int x = 0;
			for (int j = 0; j < H; j++) {
				if (a[j][i] == '.' || a[j][i] == '0') {
					x++;
				}
			}
			if (x == H) {
				for (int j = 0; j < H; j++) {
					a[j][i] = '0';
				}
			}
		}

		for (int i = 0; i < H; i++) {
			String s = "";
			for (int j = 0; j < W; j++) {
				if (a[i][j] != '0') {
					String ss = String.valueOf(a[i][j]);
					s = s + ss;
				}
			}
			if (s != "") {
				System.out.println(s);
			}
		}
	}
}

Measured memory_bytes: 26836
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	int N, M;
	cin >> N >> M;
	vector<double> L(N), a(N), b(N);
	for(int i = 0; i < N; ++i){ cin >> L[i] >> a[i] >> b[i]; }
	double answer = 0.0;
	for(int i = 0; i < (1 << N); ++i){
		if(__builtin_popcount(i) != M){ continue; }
		double sum = 0.0;
		for(int j = 0; j < N; ++j){
			if(!(i & (1 << j))){ continue; }
			for(int k = j + 1; k < N; ++k){
				if(!(i & (1 << k))){ continue; }
				sum += (L[k] - L[j]) * (L[k] - L[j]);
				sum += (a[k] - a[j]) * (a[k] - a[j]);
				sum += (b[k] - b[j]) * (b[k] - b[j]);
			}
		}
		answer = max(answer, sum);
	}
	cout << setiosflags(ios::fixed) << setprecision(20);
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 1296
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int A[3];
    for (int i=0; i < 3; i++) cin >> A[i];
    int max_ = max({A[0], A[1], A[2]});
    int min_ = min({A[0], A[1], A[2]});
    cout << max_ - min_ << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int n,p=0,w=0,g=0,y=0,i;
    scanf("%d",&n);
    char A[n];
    for(i=0;i<n;i++){
        scanf("%s",&A[i]);
        if(A[i]=='P') p++;
        if(A[i]=='W') w++;
        if(A[i]=='G') g++;
        if(A[i]=='Y') y++;
    }
    if(p&&w&&g&&y)
        printf("Four\n");
    else
        printf("Three\n");
}


Measured memory_bytes: 128
n,k=map(int,input().split())
p=list(map(int,input().split()))
pwa=[0 for i in range(n+1)]
ruiwa=[0 for i in range(n+1)]
ruiwa[0]=0
pwa[0]=0
for i in range(1,n+1):
  ruiwa[i]=ruiwa[i-1]+p[i-1]
for i in range(1,n-k+2):
  pwa[i]=ruiwa[i+k-1]-ruiwa[i-1]
ans=(max(pwa)+k)/2
print(ans)

Measured memory_bytes: 25060
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
using namespace std;

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

int main() {
	int a, b;
	cin >> a >> b;
	int ans = 0;
	rep2(i, a, b) {
		string x = to_string(i);
		if (x[0] == 0) {
			continue;
		}
		if (x[0] == x[4] && x[1] == x[3]) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.array, std.string;
import std.algorithm;
import std.container;
import std.range;
import core.stdc.stdlib;
import std.math;

void main() {
  auto N = readln.chomp;
  auto days = ["SUN","MON","TUE","WED","THU","FRI","SAT"];

  foreach(i; 0..7) {
    if (N == days[i]) {
      writeln(7-i);
    }
  }
}


Measured memory_bytes: 256
s = str(input())
n = len(s)
m = int(n)
d = int((n-1)/2)
e = int((n+3)/2)
a = s[:d]
b = s[e:m]
def yue(l):return 1 if l == l[::-1] else 0
S = yue(s)
A = yue(a)
B = yue(b)
if S + A == 2:
  print('Yes')
else:
  print('No')

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

int main(){
  int s=0,i,n;
  cin>>n;
  int a[n];
  
  for(i=0;i<n;i++) cin>>a[i];
  for(i=0;i<n;i++){
    int j=0;
    while(a[j]<=a[i]){
      if(j==i){
        s++;
        break;
      }
      j++;
    }
  }
  
  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,k;
  cin>>n>>k;
  long long int ans=k;
  for(int i=1; i<n; i++){
    ans*=k-1;
  }
  cout<<ans<<endl;
}

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

using namespace std;
#define ll long long
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
const ll mod = 1e9 + 7;
typedef pair<int,int>           PI;
typedef pair<ll,ll>             PL;
typedef vector<PI>               vip; 
typedef vector<int>             vi;
typedef vector<vi>              vvi;






int main (){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vi a(5);
    REP(i,5){
        cin >> a[i];
    }
    int last = 9;
    int index;
    bool fumiya = false;
    REP(i,5){
        if(a[i] % 10 != 0){
            int s = a[i] % 10;
            last = min(last,s);
            a[i] -= s;
            a[i] += 10;
            fumiya = true;
        }

    }
    int total = 0;
    REP(i,5){
        total += a[i];

    }
    if(fumiya)   total = total - 10 + last;
    else{}
    
    cout << total << endl;


    return 0;
}


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


int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) {
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  
  // 最適ケースでは、最初の人以外は一人のフレンドリーさが二人の心地よさになる
  // 他人の心地よさに貢献する人番号をiとする
  // 最初に入った人の心地よさは0、２番目に入った人の心地よさはa.at(0)
  ll ans = a.at(0); 
  int i = 1;
  while(2*i<n-1){
    ans += 2*a.at(i);
    i++;
  }
  if(2*i == n-1) ans += a.at(i);


  cout << ans << endl;

}

Measured memory_bytes: 3932
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

//#define debug(x) ;
#define debug(x) cerr << #x << " = " << x << "\n";

ostream& operator<<(ostream& cerr, vector<ll> aux) {
    cerr << "[";
    for (auto e : aux) cerr << e << ' ';
    cerr << "]";
    return cerr;
}

const int maxN = 200011;
const int maxLen = 3;

int n;
char s[maxN];
int dp[maxN][maxLen];

bool same(int i, int l1, int j, int l2) {
    //cerr << i << ' ' << l1 << ' ' << j << ' ' << l2 << '\n';
    if (l1 != l2) return false;

    for (int k = 0; k <= l1; k++)
        if (s[i - k] != s[j - k])
            return false;

    return true;
}

int main()
{
    //freopen("test.in","r",stdin);

    scanf("%s", s + 1);
    n = strlen(s + 1);
    s[0] = '@';

    for (int i = 1; i <= n; i++) {
        for (int len = 0; len < maxLen; len++) {
            dp[i][len] = -1;

            int j = i - len - 1;
            if (j < 0) break;

            for (int prv = 0; prv < maxLen; prv++) {
                int bg = j - prv;

                if (bg < 0) break;
                if (dp[j][prv] < 0) continue;

                if (!same(j, prv, i, len)) 
                    dp[i][len] = max(dp[i][len], dp[j][prv] + 1);
            }
        }
    }

    int answer = dp[n][0];
    for (int i = 1; i < maxLen; i++)
        answer = max(answer, dp[n][i]);
    cout << answer;


    return 0;
}


Measured memory_bytes: 2816
n, m = map(int, input().split())
a = [True]*(n+1)
for _ in range(m):
    i = int(input())
    a[i] = False

dp = [0]*(n+1)
dp[0] = 1

for i in range(n):
    for j in range(i+1, min(n+1, i+3)):
        if a[j]:
            dp[j] += dp[i]
            dp[j] %= 10**9+7

print(dp[n])


Measured memory_bytes: 13260
n,m = map(int,input().split())
ab = []
for _ in range(n):
    a, b = (int(x) for x in input().split())
    ab.append([a, b])
ab = sorted(ab, key=lambda x: x[0])
#print(ab)
ans = 0
for a, b in ab:
    if b < m:
        m -= b
        ans += a*b
    else:
        ans += a*m
        break
print(ans)

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

#define ll long long

using namespace std;

ll arr[100005][4];
ll dp[100005][4],n,k;

ll func(ll x,ll last)
{
    if(x>=n)
        return 0;
    ll &ret= dp[x][last];
    if(ret!=-1)
        return ret;

    ll way=0;
    for(ll i=0;i<3;i++)
    {
        if(last!=i)
        way=max(way,arr[x][i]+func(x+1,i));
    }
    return ret=way;
}

int main()
{
    memset(dp,-1,sizeof(dp));
    ll i,j,l,m;
    cin >> n;
    for(i=0;i<n;i++)
    {
        cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
    }
    //arr[n]=1e18;

    cout << func(0,3);
}


Measured memory_bytes: 14336
import heapq
import copy
n = int(input())

size = 2*10**5
def f(ary):
    t_ans = 10**100
    for i in range(len(ary)):
        t_ud = ary[i]
        if len(t_ud) != 0:
            #print(t_ud)
            t_ud.sort()
            t_u = -10**100
            for j in range(len(t_ud)):
                if t_ud[j][1] == 'U':
                    t_u = t_ud[j][0]
                elif t_u == -10**100:
                    continue
                else:
                    t_ans = min(t_ans, (t_ud[j][0] - t_u))
    return t_ans

xyu = []

for i in range(n):
    x,y,u = input().split()
    x = int(x)
    y = int(y)
    xyu.append([x,y,u])

ud = [[] for i in range(size+1)]
rl = [[] for i in range(size+1)]
ul = [[] for i in range(size*2+1)]
ur = [[] for i in range(size*2+1)]
dl = [[] for i in range(size*2+1)]
dr = [[] for i in range(size*2+1)]

for i in range(n):
    if xyu[i][2] == 'U':
        ud[xyu[i][0]].append([xyu[i][1],'U'])
        ul[xyu[i][1]-xyu[i][0]+size].append([xyu[i][1],'U'])
        ur[xyu[i][1]+xyu[i][0]].append([xyu[i][1],'U'])
    if xyu[i][2] == 'D':
        ud[xyu[i][0]].append([xyu[i][1],'D'])
        dl[xyu[i][0]+xyu[i][1]].append([xyu[i][1],'D'])
        dr[xyu[i][1]-xyu[i][0]+size].append([xyu[i][1],'D'])
    if xyu[i][2] == 'R':
        rl[xyu[i][1]].append([xyu[i][0],'U'])
        ur[xyu[i][1]+xyu[i][0]].append([xyu[i][1],'D'])
        dr[xyu[i][1]-xyu[i][0]+size].append([xyu[i][1],'U'])
    if xyu[i][2] == 'L':
        rl[xyu[i][1]].append([xyu[i][0],'D'])
        ul[xyu[i][1]-xyu[i][0]+size].append([xyu[i][1],'D'])
        dl[xyu[i][0]+xyu[i][1]].append([xyu[i][1],'U'])
                  
ans = 10**100
ans = min(ans,f(ud)*5)
ans = min(ans,f(rl)*5)
ans = min(ans,f(ul)*10)
ans = min(ans,f(ur)*10)
ans = min(ans,f(dl)*10)
ans = min(ans,f(dr)*10)
if ans == 10**100:
    print('SAFE')
else:
    print(ans)


Measured memory_bytes: 287936
// C++ includes
#include <bits/stdc++.h>
// 俳句
using namespace std;

// alias templates
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

// alias declaration
using ll = long long;
using str = string;

using vll = V<ll>;
using vvll = V<vll>;
using vs = V<str>;

// loops
#define FOR(i, a, b)  for (ll i = (a); i <= (ll)(b); i++) // [a,b]
#define rFOR(i, a, b) for (ll i = (b); i >= (ll)(a); i--) // [b,a]
#define REP(i, a) FOR((i), 0, (ll)(a)-1) // [0,a-1]

// for debug
#define dbg(a) cerr << "  " << (#a) << ": " << (a) << "\n";

// procon common constants
const ll MOD_BIG = 1e9 + 7;

int main(void){
    ll n;
    ll count = 1;
    string s;

    cin >> n;
    cin >> s;
    
    FOR(i,1,n-1){
        if(s[i-1]!=s[i]){
            count++;
        }
    }

    cout << count << endl;

}

Measured memory_bytes: 512
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	private static Map<String,Integer> hexMap = new HashMap<String,Integer>();

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String in1 = sc.nextLine();
		createMap();
		String[] inArray = in1.split(" ");

		int hex1 = toHex(inArray[0]);
		int hex2 = toHex(inArray[1]);
		if (hex1 > hex2){
			System.out.println(">");
		} else if (hex1 < hex2) {
			System.out.println("<");

		} else if (hex1 == hex2) {
			System.out.println("=");
		}


	}

	private static void createMap(){
		hexMap.put("A", new Integer(10));
		hexMap.put("B", new Integer(11));
		hexMap.put("C", new Integer(12));
		hexMap.put("D", new Integer(13));
		hexMap.put("E", new Integer(14));
		hexMap.put("F", new Integer(15));

	}

	private static int toHex(String str) {
		int ret = hexMap.get(str).intValue();
		return ret;
	}
}

Measured memory_bytes: 22868
import Foundation

private func readInt() -> [Int]{
    return readLine()!.split(separator: " ").map{Int($0)!}
}

func mainA() {
    let K = Int(readLine()!)!
    let line = readInt()
    let A = line[0]
    let B = line[1]
    
    for i in A...B {
        if i % K == 0 {
            print("OK")
            return
        }
    }
    
    print("NG")
}

mainA()


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

void sort(int* x){
  if(x[0]<x[1]){
    int x_0;
    x_0=x[0];
    x[0]=x[1];
    x[1]=x_0;
  }
  if(x[1]<x[2]){
    int x_1;
    x_1=x[1];
    x[1]=x[2];
    x[2]=x_1;
  }
  if(x[0]<x[1]){
    int x_0;
    x_0=x[0];
    x[0]=x[1];
    x[1]=x_0;
  }
}
int com(int x, int y){
  if(x>y){
    return x;
  }else{
    return y;
  }
}
int* f(int k){
  
}
int main(){
	int n;
	cin >> n;
	int a[n], b[n], c[n];
	for(int i=0;i<n;i++){
	  cin >> a[i] >> b[i] >> c[i];
	}
  int f[n][3];
  f[0][0] = a[0];
  f[0][1] = b[0];
  f[0][2] = c[0];
  for(int k=1;k<n;k++){
	    f[k][0]=a[k]+com(f[k-1][1],f[k-1][2]);
	    f[k][1]=b[k]+com(f[k-1][0],f[k-1][2]);
	    f[k][2]=c[k]+com(f[k-1][0],f[k-1][1]); 
  }
  sort(f[n-1]);
  cout << f[n-1][0] <<endl;
}

Measured memory_bytes: 2560
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for n in range(N)]
AB=sorted(AB)
money=0
n=0
D=0
while D<M:
    money+=AB[n][0]*AB[n][1]
    D+=AB[n][1]
    n+=1
money-=AB[n-1][0]*AB[n-1][1]
D-=AB[n-1][1]
print(money+AB[n-1][0]*(M-D))

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

int main()
{

	int inputA,inputB,inputC,inputX;
	int calcAmt;
	int calcResult;
  	cin >> inputA;
  	cin >> inputB;
  	cin >> inputC;
  	cin >> inputX;

	calcAmt = 0;
	calcResult = 0;

	for (int i1 = 0; i1 < inputA + 1; i1++)
	{

		for (int i2 = 0; i2 < inputB + 1; i2++)
		{

			for (int i3 = 0; i3 < inputC + 1; i3++)
			{
				calcAmt = 0;
				calcAmt = i1 * 500 + i2 * 100 + i3 * 50;
				if( calcAmt == inputX){
					calcResult = calcResult + 1;
			 	}
			}
		}
	}
	
	cout << calcResult;

	return 0;
}



Measured memory_bytes: 256
s=list(input())
cflag=0
fflag=0

for i in range(len(s)):
    if (cflag==0)and(s[i]=="C"):
        cflag=1
    if (cflag==1)and(s[i]=="F"):
        fflag=1
if (cflag+fflag)==2:
    print("Yes")
else:
    print ("No")


Measured memory_bytes: 38384
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
#include<unordered_map>
#include<sstream>
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1LL << 40;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};

// intやllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> A(N);
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  int cnt = 1;
  N -= K;
  if(N > 0){
    cnt += (N+K-2)/(K-1);
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 640