akhauriyash/Code-Regression huggingface dataset:
// フェルマーの小定理
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	m = 998244353
)

func mpow(x, y int) int {
	result := 1
	for y != 0 {
		if y&1 == 1 {
			result *= x
			result %= m
		}
		x *= x
		x %= m
		y >>= 1
	}
	return result
}

var (
	fac []int
)

func initFactorialTable(n int) {
	fac = make([]int, n+1)
	fac[0] = 1
	for i := 0; i < n; i++ {
		fac[i+1] = fac[i] * (i + 1) % m
	}
}

func mcomb(n, k int) int {
	if n == 0 && k == 0 {
		return 1
	}
	if n < k || k < 0 {
		return 0
	}
	return (fac[n] * mpow(fac[n-k], m-2) % m) * mpow(fac[k], m-2) % m
}

func main() {
	defer flush()

	N := readInt()
	M := readInt()
	K := readInt()

	initFactorialTable(N)

	result := 0
	for i := 0; i < K+1; i++ {
		t := M * mcomb(N-1, i)
		t %= m
		t *= mpow(M-1, N-1-i)
		t %= m
		result += t
		result %= m
	}
	println(result)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}

var stdoutWriter = bufio.NewWriter(os.Stdout)

func flush() {
	stdoutWriter.Flush()
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdoutWriter, args...)
}


Measured memory_bytes: 3448
import sys
import numpy as np

A,B,C = list(map(int, input().split()))
K = int(input())


for i in range(K):
    if A >= B:
        B = B*2
    elif B >= C:
        C = C*2

if A < B and B < C:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 26856
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <cmath>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
int c[3][3];

int main(int argc, char const* argv[])
{
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      cin >> c[i][j];
    }
  }
  bool flag = true;
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      int tmp = c[i][0] - c[j][0];
      for(int k = 1; k < 3;k++){
        if(tmp != c[i][k] - c[j][k])flag = false;
      }
      tmp = c[0][i] - c[0][j];
      for(int k = 1; k < 3;k++){
        if(tmp != c[k][i] - c[k][j])flag = false;
      }
    }
  }
  if(flag)cout << "Yes" << endl;
  else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    void solve() {
        Scanner in = new Scanner(System.in);
//        int n = in.nextInt();
        String string = in.nextLine();
//        if()
        System.out.println(string.substring(0,string.length() - 8));
    }

    public static void main(String[] args) {
        new Main().solve();
    }
}


Measured memory_bytes: 23252
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int p[] = new int[N];
		for(int i = 0; i < N; i++) {
			p[i] = sc.nextInt() - 1;
		}
		
		int ans = 0;
		for(int i = 0; i < N - 1; i++) {
			if(p[i] == i) {
				int temp = p[i];
				p[i] = p[i + 1];
				p[i + 1] = temp;
				ans++;
			}
		}
		if(p[N - 1] == N - 1) {
			ans++;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 51040
def comb(n, a):
    x = 1
    y = 1
    for i in range(a):
        x = x * (n - i) % mod
        y = y * (i + 1) % mod
    return x * pow(y, mod-2, mod) % mod

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

ans = pow(2, n, mod)
ans -= 1
ans -= comb(n, a)
ans -= comb(n, b)

print(ans % mod)



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

void explore(const int i, const int j, const int w, const int h, const std::array<std::array<int, 50>, 50>& state, std::array<std::array<bool, 50>, 50>& visited)
{
    for (int a = -1; a < 2; a++) {
        for (int b = -1; b < 2; b++) {
            if (0 <= i + a && i + a < h && 0 <= j + b && j + b < w && (a != 0 || b != 0) && !visited.at(i + a).at(j + b) && state.at(i + a).at(j + b) == 1) {
                visited.at(i + a).at(j + b) = true;
                explore(i + a, j + b, w, h, state, visited);
            }
        }
    }
}

int main()
{
    while (true) {
        int w, h;
        std::cin >> w >> h;
        if (w == 0 && h == 0) {
            break;
        }
        int max_land_id = 0;
        std::array<std::array<int, 50>, 50> state;
        std::array<std::array<bool, 50>, 50> visited;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                std::cin >> state.at(i).at(j);
                visited.at(i).at(j) = false;
            }
        }
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (state.at(i).at(j) == 1 && !visited.at(i).at(j)) {
                    visited.at(i).at(j) = true;
                    explore(i, j, w, h, state, visited);
                    ++max_land_id;
                }
            }
        }
        std::cout << max_land_id << std::endl;
    }
    return 0;
}



Measured memory_bytes: 3392
#include <iostream>

int main(){
    long n;
    std::cin >> n;

    int nBuf = n;
    int val = 0;
    while(0 != nBuf){
        val += nBuf % 10;
        nBuf = nBuf / 10; 
    }

    if(0 == n % val){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }

    return 0;
}

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define DEBUG(x) std::cerr << #x << " : " << (x) << std::endl;
//#define DEBUG(x) ;

int dx[4]{0, 1, 0, -1};
int dy[4]{1, 0, -1, 0};

int main(int argc, char **argv)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll N; cin >> N;
	vector<ll> A(N);REP(i, N) cin >> A[i];

	ll r{0}, sum{0}, res{0};
	REP(l, N)
	{
		while (r < N && !(sum & A[r]))
		{
			sum ^= A[r] ;
			++r;
		}

		res += (r - l);

		if (r == l) ++r;
		else sum ^= A[l];
	}

	std::cout << res << std::endl;
	
	
	return 0;
}


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

int main()
{
	vector<int> arr(100001);
	unordered_set<int> s;
	int n, q, a, b, c;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a;
		s.insert(a);
		arr[a]++;
	}
	cin >> q;
	long long sum = 0;
	for (int i = 0; i < q; i++)
	{
		cin >> b >> c;
		int up = (c - b) * arr[b];
		arr[c] += arr[b];
		arr[b] = 0;
		s.insert(c);
		s.erase(b);
		if (i != 0) sum += up;
		else {
			for (auto it = s.begin(); it != s.end(); it++)
			{
				sum += (long long)arr[*it] * (*it);
			}
		}
		cout << sum << endl;
	}

	return 0;
}

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

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << var << "\n"
#define scn(var)         cin >> var;
#define pYes()           prt("Yes")
#define pNo()            prt("No")
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << "\n"

//----------------------------------------------------------------
ll f(ll n){
  if(n%2==0){
    return n/2;
  } else {
    return n*3+1;
  }
}

int main(void) {
  ll n;
  cin >> n;

  ll ans=1;
  while(n!=4 && n!=2 && n!=1){
    n=f(n);
    ans++;
  }
  prt(ans+3);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_upd>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
*/
using namespace std;

#define LL long long
#define LD long double
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()

const LL MOD = 998244353;
const LD EPS = 0.0000001 ;

LL pows(LL a, LL b)
{
	if (b == 0) return 1LL;
	LL temp = pows(a, b / 2);
	temp = (temp * temp) % MOD;
	if (b % 2) temp = (temp * a) % MOD;
	return temp;
}

int main(void)
{
	string s; cin >> s;
	bool flag = true;
	int n = s.size();
	for (int i = 0; i < n; i++){
		if (s[i] != s[n - 1 - i]) {
			cout << "No\n";
			return 0;
		}
	}

	int m = (n - 1) / 2;
	for (int i = 0; i < m; i++){
		if (s[i] != s[m - 1 - i]){
			cout << "No\n";
			return 0;
		}
	} 

	for (int i = 0; i < m; i++){
		if (s[m + 1 + i] != s[n - 1 - i]){
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";

	return 0;
}




Measured memory_bytes: 256
import scala.io.StdIn

object Main extends App {
  val s = StdIn.readLine.split(" ")

  val res = s.filter(_.charAt(0) == 'A')
    .filter(l => l.count(_.isUpper) == 2)
    .map(_.toCharArray)
    .map(l => l.slice(2,l.length-1))
    .exists(l => l.count(ch => ch == 'C') == 1)

  println(if (res) "AC" else "WA")
}

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

int main(){
	int k, t; cin >> k >> t;
	int maxv = 0;
	for(int i = 0; i < t; ++i){
		int a; cin >> a;
		maxv = max(a, maxv);
	}
	if(maxv > k / 2){
		cout << k - (k - maxv) * 2 - 1 << endl;
	}else{
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    ll t[n] , a[n];
    cin >> t[0] >> a[0];
    ll x = t[0] , y = a[0];
    for (int i = 1; i < n ; i++) {
        cin >> t[i] >> a[i];
        ll b = x , c = y;
        x = t[i] * max( ( b - 1) / t[i] + 1 , ( c - 1 ) / a[i] + 1 );
        y = a[i] * max( ( b - 1) / t[i] + 1 , ( c - 1 ) / a[i] + 1 );
    }
    cout << x + y;
}


Measured memory_bytes: 256
#define _GIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double EPS = 1e-10;


int main(void) {
  int N;
  cin >> N;
  map<char, ll> mp;
  rep(i, N) {
    string S;
    cin >> S;
    mp[S[0]]++;
  }

  ll ans = 0;
  ans += mp['M'] * mp['A'] * mp['R'];
  ans += mp['M'] * mp['A'] * mp['C'];
  ans += mp['M'] * mp['A'] * mp['H'];
  ans += mp['M'] * mp['R'] * mp['C'];
  ans += mp['M'] * mp['R'] * mp['H'];
  ans += mp['M'] * mp['C'] * mp['H'];
  ans += mp['A'] * mp['R'] * mp['C'];
  ans += mp['A'] * mp['R'] * mp['H'];
  ans += mp['A'] * mp['C'] * mp['H'];
  ans += mp['R'] * mp['C'] * mp['H'];

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

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define For(i, a, b) for(register int (i) = (a); (i) <= (b); ++(i))
#define ForDown(i, a, b) for(register int (i) = (a); (i) >= (b); (i)--)
using namespace std;
template<class Tp>
Tp F() {
	register Tp x = 0, ch = getchar(), f = 0;
	while(!isdigit(ch)) f |= (ch == '-'), ch = getchar();
	while(isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}
template<class Tp>
bool chkmin(Tp &a, Tp b) {
	return b > a ? a = b, 1 : 0;
}
template<class Tp>
bool chkmax(Tp &a, Tp b) {
	return b < a ? a = b, 1 : 0;
}
const int MAXN = 3e5 + 10;
const int mod = 1e9 + 7;
int n, ans;
long long a[MAXN];
int main() {
	n = F<int>();
	For(i, 1, n) a[i] = F<long long>();
	For(i, 0, 60) {
		int cnt = 0;
		For(j, 1, n) if((a[j] >> i) & 1) ++cnt;
		ans = (ans + (1ll << i) % mod * cnt % mod * (n - cnt)) % mod;
	}
	printf("%d\n", ans);
	return 0;
}

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

const int MAXN = 200005;

int n, a[MAXN];
long long pre_sum[MAXN], suf_sum[MAXN];

int main()
{
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		a[i] -= i;
	}
	sort(a+1, a+n+1);
        for (int i = 1; i <= n; i++) pre_sum[i] = pre_sum[i-1]+a[i];
	for (int i = n; i >= 1; i--) suf_sum[i] = suf_sum[i+1]+a[i];
	long long ans = 1e18;
	for (int i = 1; i <= n; i++) 
		ans = min(ans, (long long)(i-1)*a[i]-pre_sum[i-1]+suf_sum[i+1]-(long long)(n-i)*a[i]);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4224
import math
a,b,x = map(float,input().split())
area = x / a
tri_area = 0.5 * a * b
if area == tri_area:
    shahen = (a**2 + b**2) ** 0.5
    rad = math.acos(a/shahen)
    print(math.degrees(rad))
elif area < tri_area:
    teihen = area*2 / b
    shahen = (teihen**2 + b**2) ** 0.5
    rad = math.acos(teihen/shahen)
    print(math.degrees(rad))
else:
    height = b - x / a**2
    teihen = a / 2
    shahen = (height**2 + teihen**2) ** 0.5
    rad = math.acos(teihen / shahen)
    print(math.degrees(rad))


Measured memory_bytes: 3064
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    x = int(input())

    for b in range(10 ** 3):
        for a in range(10 ** 3):
            if pow(a, 5) - pow(b, 5) == x:
                print(a, b)
                exit()
            if pow(-a, 5) - pow(b, 5) == x:
                print(-a, b)
                exit()
            if pow(a, 5) - pow(-b, 5) == x:
                print(a, -b)
                exit()
            if pow(-a, 5) - pow(-b, 5) == x:
                print(-a, -b)
                exit()


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 67972
#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 DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#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;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
string a, b;
void next() {
	a.back()++;
	RFOR(i,1, a.size()) {
		if (a[i] == '9' + 1) {
			a[i] = '0';
			a[i - 1]++;
		}
	}
}
bool check(string &s) {
	REP(i, s.size() / 2) {
		if (s[i] != s[s.size() - 1 - i])return false;
	}
	return true;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> a >> b;
	int cnt = 0;
	while (a <= b) {
		if (check(a))cnt++;
		next();
	}
	cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep0(i,b) for(int i=0 ; i< b ;i++)
#define rep1(i,b) for(int i=1 ; i<=b ;i++)
#define reps(i,a,b) for(int i=a ; i< b.length() ;i++)
typedef long long ll;
#define MOD 1000000007
# define M_PI     3.14159265358979323846

using namespace std;


int main()
{

  int n,k,rep=0,d,a;
  std::vector<int> v;
  set<int> s;
  cin>>n>>k;
  for(int i=0 ; i<k ; i++){
      cin>>d;
      for(int j=0 ;j<d ; j++){
        cin>>a;
        s.insert(a);
      }
  }
  cout<<n-s.size()<<endl;



  return 0 ;
}


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

int main(void){
   int H,W;
   cin>>H>>W;
   vector<vector<char>> A(H,vector<char>(W));
   for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
         cin>>A[i][j];
      }
   }
   int h_max=0;
   for(int i=0;i<W;i++){
      if(A[0][i]=='#') h_max=max(h_max,i);
   }
   bool flag=true;
   for(int i=1;i<H;i++){
      int judge=W+1;
      for(int j=0;j<W;j++){
         if(A[i][j]=='#'){
            judge=min(judge,j);
         }
      }
      if(judge<h_max){
         flag=false;
         break;
      }
      for(int j=0;j<W;j++){
         if(A[i][j]=='#'){
            h_max=max(h_max,j);
         }
      }
   }
   if(flag) cout<<"Possible"<<endl;
   else cout<<"Impossible"<<endl;
   return 0;
}


Measured memory_bytes: 3588
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
int p[110][10];
int q[110][12];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		for(int j=0;j<10;j++)scanf("%d",&p[i][j]);
	}
	for(int i=0;i<a;i++){
		for(int j=0;j<=10;j++)scanf("%d",&q[i][j]);
	}
	int ret=-mod;
	for(int i=1;i<(1<<10);i++){
		int tmp=0;
		for(int j=0;j<a;j++){
			int cnt=0;
			for(int k=0;k<10;k++){
				if((i&(1<<k))&&p[j][k])cnt++;
			}
			tmp+=q[j][cnt];
		}
		ret=max(ret,tmp);
	}
	printf("%d\n",ret);
}

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

int main()
{
   int a,b,x;
    cin >> x>>a >>b;
  
  x-=a;
    while(true){
      if (x-b>=0){
        x=x-b;
      }else{
        break; 
      }
      
    }


    cout << x <<endl;
  

    return 0;
}






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

int main() {

	long long int h, i = 1, sum = 0;

	cin >> h;

	while (h != 1) {
		h /= 2;
		i *= 2;
		sum += i;
	}

	sum += 1;

	cout << sum << 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;
typedef long long ll;
 
int main() {
	char c;
	cin >> c;
	if(isupper(c)){
		cout << "A" << endl;
	}else{
		cout << "a" << endl;
	}
	return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>

int main( )
{
    int n , num[500] , i , j , sum= 0 , temp ;
    scanf("%d" , &n);
    
    for( i = 1 ; i <= n ; i++)
        scanf("%d" , &num[i] );
    
    for( i = 1 ; i <= n ; i++)
    {
        for( j = 1 ; j < n ; j++)
        {
            if( num[j] > num[j+1] )
            {
                temp = num[j] ;
                num[j] = num[j+1] ;
                num[j+1] = temp ;
            }
        }
    }
    
    for( i = 1 ; i < n ; i++)
        sum = sum + num[i] ;
    
    if( num[n] < sum)
        printf("Yes\n");
    else 
        printf("No\n");
    
    return 0;
}


Measured memory_bytes: 1644
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int T,card[16];
int win();
bool is_good_set(int,int,int);
bool is_same_number(int,int,int);
bool is_sequence(int,int,int);
bool is_good_set();
bool is_all_good_set();

int main(){
  cin >> T;
  for(int t=0;t<T;t++){
    for(int i=0;i<9;i++){
      cin >> card[i];
    }
    string color;
    for(int i=0;i<9;i++){
      cin>>color;
      if(color=="G") card[i]+=10;
      else if(color=="B") card[i]+=20;				      
    }
    if(win()){
      cout<<1<<endl;
    }else{
      cout<<0<<endl;
    }
  }
  return 0;
}

bool is_good_set(int a,int b,int c){
  return is_same_number(a,b,c)||is_sequence(a,b,c);
}

bool is_same_number(int a,int b,int c){
  return a==b&&b==c;
}
bool is_sequence(int a,int b,int c){
  return a+2==c&&b+1==c;
}

bool is_all_good_set(){
  return is_good_set(card[0],card[1],card[2])&&is_good_set(card[3],card[4],card[5])&&is_good_set(card[6],card[7],card[8]);
}
int win(){
  sort(card,card+9);
  do{
    if(is_all_good_set()){
      return 1;
    }
  }while(next_permutation(card,card+9));
  return 0;
}

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include <climits>
#include<fstream>
using namespace std;
//---------------------------------------------------
//library zone!!!!!
typedef long long ll;
typedef long double ld;
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ld mod_pow(ld x, ll n, ll p) {
	ld res = 1;
	while (n > 0) {
		if (n & 1) res = res * x;
		x = x * x;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
bool a[500][500];
bool b[500][500];
bool c[500][500];
signed main() {
	int h, w;
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < w; j++) {
			if (s[j] == '#') a[i][j] = 1;
		}
	}
	queue<H>q;
	int ans = 0, black = 0, white = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j]&&!b[i][j]) {
				black = 1, white = 0;
				q.push(H{ i,j });
				b[i][j] = 1;
				while (!q.empty()) {
					H t = q.front(); q.pop();
					if (c[t.x][t.y]) continue;
					c[t.x][t.y] = 1;
					if (t.x > 0 && a[t.x - 1][t.y] != a[t.x][t.y] && !b[t.x - 1][t.y]) {
						b[t.x - 1][t.y] = 1;
						if (a[t.x - 1][t.y]) black++;
						else white++;
						q.push(H{ t.x - 1,t.y });
					}
					if (t.x < h-1 && a[t.x + 1][t.y] != a[t.x][t.y] && !b[t.x + 1][t.y]) {
						b[t.x + 1][t.y] = 1;
						if (a[t.x + 1][t.y]) black++;
						else white++;
						q.push(H{ t.x + 1,t.y });
					}
					if (t.y > 0 && a[t.x][t.y - 1] != a[t.x][t.y] && !b[t.x][t.y - 1]) {
						b[t.x][t.y - 1] = 1;
						if (a[t.x][t.y - 1]) black++;
						else white++;
						q.push(H{ t.x,t.y - 1 });
					}
					if (t.y < w-1 && a[t.x][t.y + 1] != a[t.x][t.y] && !b[t.x][t.y + 1]) {
						b[t.x][t.y + 1] = 1;
						if (a[t.x][t.y + 1]) black++;
						else white++;
						q.push(H{ t.x,t.y + 1 });
					}
				}
				ans += black * white;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 896
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))

using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}


const int MOD = 1000000007;

map<int, int>mp;
int main() {
	int N; cin >> N;
	int cnt = 0;
	REP(i, N) {
		int a; cin >> a;
		mp[a]++;
	}
	for (auto x : mp) {
		if (x.second >= 2)cnt += x.second - 1;
	}
	int ans = 0;
	if (cnt % 2 == 0) {
		ans = N - cnt;
	}
	else {
		ans = N - cnt - 1;
	}
	cout << ans << endl;
}




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


int main(void){
  long N,ans = 0;
  scanf("%ld",&N);
  long a,A[100002];
  long count;

  for(int i = 0;i < 100002;i++) A[i] = 0;
  for(int i = 0;i < N;i++){
    scanf("%ld",&a);
    A[a]++;
  }

  for(int i = 1;i < 100001;i++){
    count = A[i-1]+A[i]+A[i+1];
    if(ans < count) ans = count;
  }
  printf("%ld\n",ans);
  return 0;
}


Measured memory_bytes: 896
#define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144 * 4LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}


#define int ll

unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x ^ (x << 11));
    x = y; y = z; z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

int depth[200000];
vector<int> vertexs[200000];
int back[30][200000];
void dfs(int now) {
    for (auto x : vertexs[now]) {
        depth[x] = depth[now] + 1;
        back[0][x] = now;
        dfs(x);
    }
}
int lca(int a, int b) {
    if (depth[a] > depth[b])swap(a, b);
    int ans = 0;
    for (int q = 20; q >= 0; --q) {
        if (depth[a] <= depth[b] - (1 << q)) {
            ans += 1 << q;
            b = back[q][b];
        }
    }
    for (int q = 20; q >= 0; --q) {
        if (back[q][a] != back[q][b]) {
            ans += 1 << (q + 1);
            a = back[q][a];
            b = back[q][b];
            q++;
        }
    }
    if (a != b) ans += 2;
    return ans;
}
void solve() {
    int n;
    cin >> n;
    REP(i, n-1) {
        int a;
        cin >> a;
        vertexs[a - 1].push_back(i + 1);
    }
    dfs(0);
    for (int q = 1; q < 30; ++q) {
        REP(i, n) {
            back[q][i] = back[q - 1][back[q-1][i]];
        }
    }
    queue<int> next;
    int backing = 0;
    next.push(0);
    int ans = 0;
    while (next.empty() == false) {
        int now = next.front();
        next.pop();
        ans += lca(now, backing);
        backing = now;
        for (auto x : vertexs[now]) {
            next.push(x);
        }
    }
    cout << ans << endl;
}

#undef int
int main() {
    init();
    solve();
}



Measured memory_bytes: 38404
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		  int N = nextInt();
		  ArrayList<Integer> list = nextIntArray();
		  Collections.sort(list);
		  myout(list.get(N / 2) - list.get((N / 2) - 1));
	}
	//Method addition frame start




	//Method addition frame end
}


Measured memory_bytes: 48864
#include <iostream>
using namespace std;
int main()
{
    int k, s;
    cin >> k >> s;
    int cnt = 0;
    for (int i = 0; i <= k; ++i)
    {
        for (int j = 0; j <= k; ++j)
        {
            if (s - i - j <= k && i + j <= s)
                ++cnt;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
// Template {{{
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef long long LL;

#ifdef LOCAL
#include "contest.h"
#else
#define dump(x) 
#endif

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x < w; }

void iostream_init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(12);
}
//}}}

struct UnionFind {
    vector<int> data;
    UnionFind(int N) : data(N, -1) { }
    // xとyを併合する
    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[x] > data[y]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    // xとyが同じ集合にあるか判定する
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    // xを含む集合の要素数を求める
    int size(int x) {
        return -data[root(x)];
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
};

int main(){
    iostream_init();
    int N, M;
    cin >> N >> M;
    UnionFind uf(N + M);
    REP(i, N) {
        int K;
        cin >> K;
        REP(j, K) {
            int x;
            cin >> x;
            x--;
            uf.unite(i, N + x);
        }
    }
    bool ok = true;
    REP(i, N) if(uf.root(i) != uf.root(0)) ok = false;
    cout << (ok ? "YES" : "NO") << endl;
    return 0;
}


Measured memory_bytes: 1024
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define SORTD(a) sort(a.rbegin(), a.rend());
#define UNIQUE(a) unique(a.begin(), a.end())
#define ll long long
#define INF 1000000000000000000
#define INT_MAX 2147483647

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <cctype>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <utility>
#include <ios>
#include <iomanip>
#include <sstream>
#include <map>

using namespace std;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

const ll mod = 1e9+7;

int main() {
	int x, n;
	cin >> n >> x;
	int ans = 1;
	int d = 0;
	int l;
	REP(i, n) {
		cin >> l;
		d += l;
		if (d <= x) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import atexit
import io
import sys

buff = io.BytesIO()
sys.stdout = buff


@atexit.register
def write():
    sys.__stdout__.write(buff.getvalue())

s = raw_input()
n = len(s)
ans = 0
l = ['A', 'C', 'T', 'G']
for i in xrange(n):
	for j in xrange(i,n):
		valid = 1
		for k in xrange(i,j+1):
			if s[k] not in l:
				valid = 0
				break
		if valid:
			ans = max(ans, j-i+1)	
print ans

Measured memory_bytes: 28524
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll n;
    cin >> n;
    ll res = 0;
    REP(i, n){
        ll num = i + 1;
        ll d = 0;
        while(num){
            d++;
            num /= 10;
        }
        if(d % 2) res++;
    }
    cout << res << endl;
    return 0;
}

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

ss = dict()
for i in range(N):
    s = input()
    ss[s] = ss.get(s, 0) + 1
sss = [(-b, a) for a, b in ss.items()]
sss.sort()
maxa = sss[0][0]
for a, b in sss:
    if maxa != a:
        break
    print(b)


Measured memory_bytes: 46860
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

int main(){
    ll a,b,c; cin>>a>>b>>c;
    cout << (a/2)*((a+1)/2)<<ednl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int a[200];
    int n,l,b=0;
    cin>>n>>l;
    for(int i=1;i<n+1;i++){
       a[i]=l+i-1;
    }
    for(int i=0;i<101;i++){
        for(int j=1;j<n+1;j++){
            if(a[j]==i){
                a[j]=0;
                b=1;
                break;
            }
            if(a[j]==i*-1){
                a[j]=0;
                b=1;
                break;
            }
        }
        if(b==1){
            break;
        }
        
    }
    b=0;
    for(int i=1;i<n+1;i++){
        b+=a[i];
    }
    cout<<b;
    // Your code here!
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

int main(){
  
  int n;
  cin>>n;
  vector<int> l(n);
  REP(i,n){
    cin>>l[i];
  }
  sort(l.begin(), l.end());
  long long dp[n] = {};
  long long cnt[n+1][2010] = {};
  for(long long k = 2;k<=(long long)n;k++){
    for(int v = 0; v<=2000; v++){
      cnt[k][v] += cnt[k-1][v];
      long long L = -1;
      long long R = k-2;
      while(R-L>1){
        long long m = (L+R)/2;
        if(l[m]>v-l[k-1]){
          R = m;
        }else{
          L = m;
        }
      }
      if(R==k-2 && l[k-2]<=v-l[k-1]){
        continue;
      }
      cnt[k][v] += k-2-R+1;
    }
  }
  
  for(int i=1; i<n; i++){
    dp[i] = dp[i-1] + cnt[i][l[i]];
  }
  long long ans = dp[n-1];
  cout<<ans<<endl;
  return 0;
}

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

#define pb push_back
#define mp make_pair
#define taskname "A"

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<ll,int> ii;
typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const int maxn = 2e5 + 5;
const int inf = 1e9 + 1;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    string s;
    cin >> s;
    string tmp = "";
    while(tmp.size() < s.size())tmp += "hi";
    if(tmp == s)cout << "Yes";
    else cout << "No";
}




Measured memory_bytes: 764
#include<iostream>
#include<string>
#include<algorithm>


using namespace std;
bool match(int x, int y);
int N, M;
string A[60], B[60];

int main()

{
	bool can = false;
	cin	>> N >>M;
	
	for (int i = 0; i < N; ++i) cin >> A[i];
	for (int j = 0; j < M; ++j) cin >> B[j];

	for (int k = 0; k < N - M + 1; ++k) {
		for (int l = 0; l < N - M + 1; ++l) {
			if (match(k, l)) can = true;

		}
	}

	cout << (can ? "Yes":"No") << endl;
	return 0;

}

bool match(int x, int y) {
	for (int i = 0; i < M; i++) {
		for (int j = 0; j < M; j++) {
			if (A[x + i][y + j] != B[i][j]) {
				return false;
			}
		}
		
	}
	return true;
}

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

using namespace std;

int main()
{
	int n, m, l, i, j, k;
	scanf("%d %d %d", &n, &m, &l);
	
	long long A[n][m], B[m][l], C[n][l] = {};
	
	for(i = 0; i < n; i++)
		for(j = 0; j < m; j++)
			scanf("%lld", &A[i][j]);
		
	for(i = 0; i < m; i++)
		for(j = 0; j < l; j++)
			scanf("%lld", &B[i][j]);
   
	for(i = 0; i < n; i++)
		for(j = 0; j < l; j++)
		{
			for(k = 0; k < m; k++)
		   		C[i][j] += A[i][k] * B[k][j];
			cout << C[i][j] << (j==l-1?"\n":" ");
		}
	return 0;
}


Measured memory_bytes: 3380
using System;
using System.Linq;
using System.Collections.Generic;


namespace ABC162
{
    class A
    {
        static void Main(string[] args)
        {
            var N = Console.ReadLine();
            for (int i = 0; i < 3; i++)
            {
                if (N[i] == '7') { Console.WriteLine("Yes"); return; }
            }
            Console.WriteLine("No");
        }
    }
}



Measured memory_bytes: 25888
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef pair<ll,ll> pr;
typedef vector<ll> vc;
typedef unordered_map<ll,ll> umap;
#define pb emplace_back
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
const ll mod = 1e9+7;
const ll max_n = 1e5+5;
vc g[max_n];
ll dp[max_n][3];

void dfs(ll now, ll pr){
	dp[now][1] = dp[now][0] = 1;
	for(auto to: g[now]){
		if(to == pr) continue;
		dfs(to, now);
		dp[now][0] = dp[now][0] * (dp[to][0] + dp[to][1]) % mod;
		dp[now][1] = dp[now][1] * dp[to][0] % mod;
	}
}

int main(){
	ll n;
	cin >> n;
	rep(i,1,n-1){
		ll x,y;
		cin >> x >> y;
		g[x].pb(y);
		g[y].pb(x);
	}
	dfs(1, 0);
	cout << (dp[1][0] + dp[1][1]) % mod << endl;
    return 0;
}


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

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

using namespace std;
typedef long long int ll;
const ll INF = 1000000000000000000;
const double PI = 3.1415926535897932;
const ll MOD = 1000000007;

int main()
{
    double a, b;
    double x;
    cin >> a >> b >> x;

    bool is_small = x < (a * a * b / 2.0);
    double ans = 0.0;
    if (is_small) {
        double t = (a * b * b) / (2.0 * x);
        ans = atan(t) * 180.0 / PI;
    }
    else {
        double t = (2.0 * a * a * b - 2.0 * x) / (a*a*a);
        ans = atan(t) * 180.0 / PI;
    }
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<limits>
#include<iomanip>
#include<cmath>
#include<climits>
using namespace std;

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

const int mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin >> a >> b >> c;
    cout << (a*c<b?c:b/a) << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  ll x; scanf("%lld", &x);
  ll ans = -1;
  ll q = x / 11, r = x % 11;
  if (r == 0) { ans = q * 2; }
  else if (r <= 6) { ans = q * 2 + 1; }
  else { ans = q * 2 + 2; }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 256
N = int(input())
lf  = [int(x) for x in list(str(N-1))]
count = N//2 + 1
min = 1 + sum(lf)
for i in range(1,count):
    l = [int(j) for j in list(str(i))]+[int(j) for j in list(str(N-i))]
    num =sum(l)
    if num <= min:
        min = num
print(min)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define loope(i,a,b) for(ll i=a;i<=b;i++)
#define test() ull t;cin>>t;while(t--)
#define pll pair<ll,ll>
#define puu pair<ull,ull>
#define f first
#define s second
#define pb push_back
#define mkp make_pair
#define ins insert
#define Vint vector<int>
#define Vll vector<ll>
#define Vull vector<ull>
#define nl cout<<endl
#define sp cout<<" "
#define MOD 1000000007
#define all(x) x.begin(),x.end()

int main() 
{
	// ios::sync_with_stdio(0);
	// cin.tie(0);
	// cout.tie(0);
	ll n;
	cin>>n;

	vector<ll> v(n);


	loop(i,0,n)
		cin>>v[i];

	ull result = 0;
	ll mx = 0;
	loop(i,0,n){
		mx = max(v[i],mx);

		result+= mx-v[i];
	}

	cout<<result;
}

Measured memory_bytes: 4764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 2e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int x, y, z, k;
    cin >> x >> y >> z >> k;
    vector<ll> a(x), b(y), c(z);
    rep(i, 0, x) cin >> a[i];
    rep(i, 0, y) cin >> b[i];
    rep(i, 0, z) cin >> c[i];

    vector<ll> ab;
    rep(i, 0, x) {
        rep(j, 0, y) {
            ab.push_back(a[i] + b[j]);
        }
    }

    sort(all(ab), greater<ll>());
    ab.resize(k);

    vector<ll> abc;
    rep(i, 0, k) {
        rep(j, 0, z) {
            abc.push_back(ab[i] + c[j]);
        }
    }

    sort(all(abc), greater<ll>());

    rep(i, 0, k) cout << abc[i] << endl;
    return 0;
}


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

int main(){
    int H, W;
    
    while(1){
        cin >> H >> W;
        if(H == 0 and W == 0){
            break;
        }
    
        //hが偶数の時、wが偶数が#、奇数が.
        //hが奇数の時、wが奇数が#、偶数が.
    
        for(int h = 0; h < H; h++){
            for(int w = 0; w < W; w++){
                if((h % 2 == 0 && w % 2 == 0) || (h % 2 != 0 && w % 2 != 0)){
                    cout << "#";
                }else{
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}



Measured memory_bytes: 3092
#include <bits/stdc++.h> 
#define ll long long int 
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
 
using namespace std; 
 
ll gcd(ll a, ll b)
{ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a);  
}

ll lcm(ll a, ll b)  
{  
return (a*b)/gcd(a, b);  
} 
 
int main() 
{
    ll a,b;
    cin>>a>>b;

    cout<<lcm(a, b)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL mod=1e9+7;
const int maxn=2e5+10;
const LL inf=1e18;
int a[maxn];
int main()
{
    LL n,k;
    cin>>n>>k;
    printf("%lld\n",min(n%k,abs((n%k)-k)));
    return 0;
}


Measured memory_bytes: 256