akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(){
  int N, M;
  scanf("%d", &N);
  scanf("%d", &M);

  for(int i = (int)(M/N)+1; i > 0; i--){
    if (M%i == 0 && M/i >= N){
      printf("%d\n",i);
      break;
    }
  }
  return 0;
}


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

bool self(vector<vector<int> >& G, int s, int t, vector<pair<int, int> >& stock_idx, vector<int>& searched){
    if (searched[s] == 1) return false;
    searched[s] = 1;
    if (G[s][t] != -1 && stock_idx.size() > 1) {
        stock_idx.push_back(make_pair(s, t));
        return true;
    }
    for (int i = 0; i < G[s].size(); i++) {
        if (G[s][i] != -1) {
            stock_idx.push_back(make_pair(s, i));
            if (self(G, i, t, stock_idx, searched)) return true;
            stock_idx.pop_back();
        }
    }
    return false;
}

bool DFS(vector<vector<int> >& G, int s, int t, vector<pair<int, int> >& stock_idx){
    vector<int> searched(G.size(), 0);
    return self(G, s, t, stock_idx, searched);
}

void cut(vector<vector<int> >& G, vector<pair<int, int> >& stock_idx){
    pair<int, int> max_idx = stock_idx[0];
    for (int i = 0; i < stock_idx.size(); i++) {
        if (G[stock_idx[i].first][stock_idx[i].second] > G[max_idx.first][max_idx.second]) {
            max_idx = stock_idx[i];
        }
    }
    G[max_idx.first ][max_idx.second] = -1;
    G[max_idx.second][max_idx.first ] = -1;
    stock_idx.clear();
}

int main(){
    int n;
    cin >> n;
    vector<vector<int> > G(n, vector<int>(n));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> G[i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        vector<pair<int, int> > stock_idx;
        while (DFS(G, i, i, stock_idx)) cut(G, stock_idx);
    }
    int sum = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (G[i][j] != -1) sum += G[i][j];
        }
    }
    cout << sum << endl;
    // for (int i = 0; i < n; i++) {
    //     for (int j = 0; j < n; j++) {
    //         cout << " " << G[i][j];
    //     }
    //     cout << endl;
    // }

    return 0;
}



Measured memory_bytes: 3200
#include<stdio.h>
int main(void){
  int a,b,c;
  int tmp;
  int ans;
  scanf("%d %d %d",&a,&b,&c);
  tmp=a-b;
  ans=c-tmp;
  if(ans<0)
   ans=0;  
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
using namespace std;
const int N=660,M=100010;
const int MAX=2e9;
const long long Mod=1e9+7;
int vis[N][N];
int n,d1,d2,bd,tot,tar;
void deal(int dis){
    int g=0;
    while(!(dis%4)){
        dis/=4;
        g++;
    }
    if(dis&1){
        for(int i=0;i<bd;i++){
            for(int j=0;j<bd;j++){
                if((i>>g)+(j>>g)&1) vis[i][j]=1;
            }
        }
    }
    else{
        for(int i=0;i<bd;i++){
            for(int j=0;j<bd;j++){
                if((i>>g)&1) vis[i][j]=1;
            }
        }
    }
    return ;
}
int main(){
    //freopen("problem.in","r",stdin);
    //freopen("problem.out","w",stdout);
    scanf("%d%d%d",&n,&d1,&d2);
    bd=n<<1;
    deal(d1);
    deal(d2);
    tar=n*n;
    for(int i=0;i<bd;i++){
        for(int j=0;j<bd;j++){
            if(!vis[i][j]){
                printf("%d %d\n",i,j);
                tot++;
            }
            if(tot==tar) return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = getInt(sc);
		int b = getInt(sc);
		int x = getInt(sc);

		if (a <= x && a + b >= x) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をlongで返却
	 *
	 * @return
	 */
	public static long getLong(Scanner sc) {

		return Long.parseLong(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をintで返却
	 *
	 * @return
	 */
	public static int getInt(Scanner sc) {

		return Integer.parseInt(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をStringで返却
	 *
	 * @return
	 */
	public static String getString(Scanner sc) {

		return sc.next();
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をint配列で返却
	 *
	 * @return
	 */
	public static int[] getIntArray(Scanner sc) {
		String line = "";
		// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策
		while (line.equals("")) {
			line = sc.nextLine();
		}

		String[] strArray = line.split(" ");
		int[] intArray = new int[strArray.length];
		for (int i = 0; i < strArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}

}


Measured memory_bytes: 23764
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<complex>
using namespace std;

struct Dice{
  int n[6];
  void roll(char c){
    int nn;
    if(c == 'E'){
      nn = n[0];
      n[0] = n[3];
      n[3] = n[5];
      n[5] = n[2];
      n[2] = nn;
    }else if(c == 'W'){
      nn = n[0];
      n[0] = n[2];
      n[2] = n[5];
      n[5] = n[3];
      n[3] = nn;
    }else if(c == 'N'){
      nn = n[0];
      n[0] = n[1];
      n[1] = n[5];
      n[5] = n[4];
      n[4] = nn;
    }else if(c == 'S'){
      nn = n[0];
      n[0] = n[4];
      n[4] = n[5];
      n[5] = n[1];
      n[1] = nn;
    }else if(c == '!'){
      nn = n[1];
      n[1] = n[3];
      n[3] = n[4];
      n[4] = n[2];
      n[2] = nn;
    }

  }
  int top(){
    //cout << n[0] << endl;
    return n[0];
  }
  int right(){
    //cout << n[2] << endl;
    return n[2];
  }
  int left(){
    //cout << n[3] << endl;
    return n[3];
  }
  int front(){
    return n[1];
  }
  int back(){
    return n[4];
  }
  int under(){
    return n[5];
  }
};


int main(){
  Dice d,dd;
  for(int i = 0; i < 6; i++) cin >> d.n[i];
  for(int i = 0; i < 6; i++) cin >> dd.n[i];
  bool flg = true;
  int a = d.top(); int b = d.front();
  if(dd.right() == a) dd.roll('W');
  if(dd.left() == a) dd.roll('E');
  if(dd.front() == a) dd.roll('N');
  if(dd.back() == a) dd.roll('S');
  if(dd.under() == a){
    dd.roll('E');
    dd.roll('E');
  }
  if(dd.under() == b) flg = false;
  else{
    while(dd.front() != b) dd.roll('!');
    if(dd.right() != d.right()) flg = false;
    if(dd.back() != d.back()) flg = false;
    if(dd.left() != d.left()) flg = false;
  }
  if(flg) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>

using namespace std;

const int MOD = 1000000007;
typedef long long ll;

std::vector<bool> IsPrime;

void sieve(size_t max){
  if(max+1 > IsPrime.size()){
    IsPrime.resize(max+1,true);
  } 
  IsPrime[0] = false;
  IsPrime[1] = false;

  for(size_t i=2; i*i<=max; ++i)
    if(IsPrime[i]){
      for(size_t j=2; i*j<=max; ++j){
        IsPrime[i*j] = false;
      }
    }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int Q;
  cin>>Q;
  sieve(100000);
  vector<int> sum(100000,0);
  for(int i=3;i<100000;i+=2){
    if(IsPrime[i] && IsPrime[(i+1)/2]){
      sum[i]=sum[i-2]+1;
    }else{
      sum[i]=sum[i-2];
    }
  }
  for(int i=0;i<Q;i++){
    int r,l;
    cin>>l>>r;
    if(l==1){
      cout<<sum[r]<<endl;
    }else{
      cout<<sum[r]-sum[l-2]<<endl;
    }

  }
}


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

char t[1 << 18], d[1 << 18];
int n, q; string s;

int sta(int x) {
	for(int i = 0; i < q; i++) {
		if (s[x] == t[i]) {
			if (d[i] == 'L')x--;
			else x++;
		}
		if (x < 0)return 1;
		else if (x >= n)return 2;
	}
	return 0;
}

int main() {
	cin >> n >> q >> s;
	for(int i = 0; i < q; i++) {
		cin >> t[i] >> d[i];
	}
	int le = 0, ri = n;
	while (ri - le > 1) {
		int mid = (le + ri) / 2;
		if (sta(mid) == 1)le = mid;
		else ri = mid;
	}
	int cle = 0, cri = n;
	while (cri - cle > 1) {
		int mid = (cle + cri) / 2;
		if (sta(mid) == 2)cri = mid;
		else cle = mid;
	}
	int ans = cle - ri + 1;
	if (ans < 0)ans = 0;
	cout << ans << endl;
}


Measured memory_bytes: 1028
#include<iostream>
#include<math.h>
#include<algorithm>
#include<unordered_map>
using namespace std;
int main(){
    int N, M, X;
    int A[10010];
    cin >> N >> M >> X;
    int r[1110] = {0};
    for(int i = 1;i <= M;i++){
        cin >> A[i];
        r[A[i]] = 1;
    }
    int ans1 = 0;
    int ans2 = 0;
    for(int i = X;i <= N;i++){
        if(r[i] > 0){ans1++;}
    }
    for(int i = X;i >= 0;i--){
        if(r[i] > 0)ans2++;
    }
    cout << min({ans1, ans2});
}


Measured memory_bytes: 256
#include<cstdio>
#include<map>
#include<queue>
#include<algorithm>
using namespace std;
typedef pair<int, int> P;
static const int MAX_N = 1000;

int w, h;
int n;
int X1[MAX_N], Y1[MAX_N], X2[MAX_N], Y2[MAX_N];
int W, H;

int field[3 * MAX_N][3 * MAX_N];
int dy[] = {0, -1, 0, 1};
int dx[] = {1, 0, -1, 0};

int compress(int *x1, int *x2, int W){
	map<int, int> mpa;
	for(int i = 0; i < n; i++){
		mpa[x1[i]]++;
		mpa[x2[i]]++;
	}
	mpa[0]++;
	mpa[W]++;
	map<int, int>::iterator itr;
	int cnt = 0;
	for(itr = mpa.begin(); itr != mpa.end(); itr++){
		itr->second = cnt;
		cnt++;
	}
	for(int i = 0; i < n; i++){
		x1[i] = mpa[x1[i]];
		x2[i] = mpa[x2[i]];
	}
	return cnt - 1;
}

void bfs(int y, int x){
	queue<P> qa;
	qa.push(P(y, x));
	field[y][x] = 1;
	while(!qa.empty()){
		P p = qa.front(); qa.pop();
		int cy = p.first, cx = p.second;
		for(int i = 0; i < 4; i++){
			int ny = cy + dy[i], nx = cx + dx[i];
			if(ny < 0 || nx < 0 || ny >= H || nx >= W) continue;
			if(field[ny][nx] != 0) continue;
			qa.push(P(ny, nx));
			field[ny][nx] = 1;
		}
	}
	return ;
}

int main(){
	for(;;){
		scanf("%d %d", &w, &h);
		if(w == 0 && h == 0) break;
		scanf("%d", &n);
		for(int i = 0; i < n; i++) scanf("%d %d %d %d", &X1[i], &Y1[i], &X2[i], &Y2[i]);
		W = compress(X1, X2, w);
		H = compress(Y1, Y2, h);
		fill(field[0], field[H], 0);
		for(int i = 0; i < n; i++){
			for(int j = Y1[i]; j < Y2[i]; j++){
				field[j][X1[i]]++;
				field[j][X2[i]]--;
			}
		}
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				if(j == 0) continue;
				field[i][j] += field[i][j - 1];
			}
		}
		int res = 0;
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				if(field[i][j] == 0){
					bfs(i, j);
					res++;
				}
			}
		}
		printf("%d\n", res);
	}
	return 0;
}



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

#define REP(i,N) for(int i = 0; i < N; i++)

using namespace std;


int main(){
    int a,b,c;
    cin >> a >> b;
    c = (a + b) % 24;
    cout << c << endl;
     
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {

            List<int> n = new List<int>();

            for (int i = 0; i < 10; i++)
                n.Add(int.Parse(Console.ReadLine()));

            n.Sort();
            n.Reverse();

            for (int i = 0; i < 3; i++)
            {
                Console.WriteLine(n[i]);
            }

        }
    }
}

Measured memory_bytes: 9348
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
   int a[3],f=0,s=0;
   for(int i=0;i<3;i++)
   {
       cin>>a[i];
       if(a[i]==5)
       {
           f++;
       }
       if(a[i]==7)
       {
           s++;
       }
   }
   if(f==2 && s==1)
   {
       cout<<"YES"<<endl;
   }
    else{
        cout<<"NO"<<endl;
    }
}

Measured memory_bytes: 764
#include<stdio.h>
int main(){
	int a,b,d,r;
	scanf("%d %d",&a,&b);
	double f;
	d=a/b;
	r=a%b;
	f=(double)a/b;
	printf("%d %d %f\n",d,r,f);
	return 0;
}


Measured memory_bytes: 2048
n = int(input())
t = [0]
x = [0]
y = [0]
ok = True #ok

for i in range(0,n):
    tin, xin, yin = (int(i) for i in input().split())
    t.append(tin)
    x.append(xin)
    y.append(yin)

for i in range(1,n+1):
    TimeGap = t[i]-t[i-1]
    DisGap = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1])
    if TimeGap%2 != DisGap%2 or TimeGap < DisGap:
        ok = False
if ok == True:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 11764
/*
                       _oo0oo_
                      o8888888o
                      88" . "88
                      (| -_- |)
                      0\  =  /0
                    ___/`---'\___
                  .' \\|     |// '.
                 / \\|||  :  |||// \
                / _||||| -:- |||||- \
               |   | \\\  -  /// |   |
               | \_|  ''\---/''  |_/ |
               \  .-\__  '-'  ___/-. /
             ___'. .'  /--.--\  `. .'___
          ."" '<  `.___\_<|>_/___.' >' "".
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `_.   \_ __\ /__ _/   .-` /  /
     =====`-.____`.___ \_____/___.-`___.-'=====
                       `=---='
                   JAY KHODIYAR MAA
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 JENISH MONPARA S.      IIT PATNA      ADITI GOEL IS LOVE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// while(scanf("%d",&n)!=EOF)

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define ii int64_t
#define lli long long int
#define li long int
#define deb(x) cout<<"\nhi"<<x<<"\n"
#define mod 1000000007
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;



int main()
{
    fio;
    ii i,j,k,x,y,n,cnt[4]={0};
    cin>>n;
    double dp[n+2][n+2][n+2];
    memset(dp, 0, sizeof(dp));
    
    for(i=0;i<n;i++){cin>>x;++cnt[x];}
    
    for(k=0;k<=cnt[3];k++)
    {
        for(j=0;j<=cnt[2]+cnt[3]-k;j++)
        {
            //cout<<j;
            for(i=((k>0||j>0)?0:1);i<=n-j-k;i++)
            {
                //cout<<i;
                dp[i][j][k]+=n;
                
                if(i>0)
                    dp[i][j][k]+=(i)*dp[i-1][j][k];
                if(j>0)
                    dp[i][j][k]+=(j)*dp[i+1][j-1][k];
                if(k>0)
                    dp[i][j][k]+=(k)*dp[i][j+1][k-1];
                
                dp[i][j][k]/=(i+j+k);
                //cout<<i<<" "<<j<<" "<<k<<" "<<dp[i][j][k]<<"\n";

            }
        }
    }
    cout<<setprecision(10)<<fixed<<dp[cnt[1]][cnt[2]][cnt[3]];
    //cout<<dp[0][0][0];
    
}


Measured memory_bytes: 215424
#include<iostream>
using namespace std;
struct p{
	int num;
	bool flag;
}a[4][4];
int b[10000];
int main(){
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			cin>>a[i][j].num;
			a[i][j].flag=false;
		}
	}
	int n;
	bool ff=false;
	int m=1;
	cin>>n;
	for(int k=0;k<n;k++){
		cin>>b[k];
		for(int i=1;i<=3;i++){
			for(int j=1;j<=3;j++){
				if(a[i][j].num==b[k])
				a[i][j].flag=true;
			}
		}
	}
	for(int i=1;i<=3;i++){
		if(a[i][m++].flag&&a[i][m++].flag&&a[i][m++].flag){
			ff=true;break;
		}
		m=1;
	}
	m=1;
	for(int i=1;i<=3;i++){
		if(a[m++][i].flag&&a[m++][i].flag&&a[m++][i].flag){
			ff=true;break;
		}
		m=1;
	}
	if(a[1][1].flag&&a[2][2].flag&&a[3][3].flag){
		ff=true;
	}
	if(a[1][3].flag&&a[2][2].flag&&a[3][1].flag){
		ff=true;
	}
	if(ff){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  
  vector<vector<int>> D(N, vector<int>(2));  // N行2列
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 2; j++) {
      cin >> D.at(i).at(j);
    }
  }
  
  vector<bool> zorome(N);
  for (int i = 0; i < N; i++) {
    if (D.at(i).at(0) == D.at(i).at(1)) {
      zorome.at(i) = 1;
    }
  }
  
  bool zorome3 = 0;
  for (int i = 2; i < N; i++) {
    if (zorome.at(i) == 1 && zorome.at(i-1) == 1 && zorome.at(i-2) == 1) {
      zorome3 = 1;
      break;
    }
  }
  
  if (zorome3 == 0) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 3604
# -*- coding: utf-8 -*-

(N, K) = (int(i) for i in input().split())

# N // K = NKを求める
NK = N // K

# N - K * NKかN - K * (NK + 1)の絶対値が小さいほうを出力
ans = min(abs(N - K * NK), abs(N - K * (NK + 1)))

print(ans)

Measured memory_bytes: 3064
<?php
$s = trim(fgets(STDIN));
$a = intval(substr($s, 0,2));
$b = intval(substr($s, 2));

if(1<=$a && $a<=12 && 1<=$b && $b<=12){
    $result = "AMBIGUOUS";
}elseif(1<=$a && $a<=12){
    $result = "MMYY";
}elseif(1<=$b && $b<=12){
    $result = "YYMM";
}else{
    $result = "NA";
}
echo $result;

?>


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T,class U>
istream& operator >> (istream&is, P<T,U>&p){
  is >> p.first >> p.second;
  return is;
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v){
    is >> e;
  }
  return is;
}

int main(){
  int n; cin >> n;
  cout << 0 << endl;
  flush(cout);
  string s; cin >> s;
  char fst=s.front();
  if(fst == 'V'){
    cout << 0 << endl;
    return 0;
  }
  int l = 0, r = n;
  for(;;){
    int mid = (l+r)/2;
    cout << mid << endl;
    flush(cout);
    cin >> s;
    char c = s.front();   
    if(c == 'V'){
      cout << mid << endl;
      return 0;
    }
    if(((c == fst)&1) ^ (mid%2))l = mid;
    else r = mid;
  }
}


Measured memory_bytes: 3796
#include<map>
#include<set>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<math.h>
#include<list>
#include<complex>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,x) unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;


ll const MOD = 1e9 + 7;
ll mod_p(ll x, ll y) {
	x %= MOD;
	y %= MOD;
	return (x + y + MOD) % MOD;
}

ll mod_m(ll x, ll y) {
	x %= MOD;
	y %= MOD;
	return x * y%MOD;
}

ll mod_pow(ll x, ll t) {
	x %= MOD;
	if (t == 0) {
		return 1;
	}
	else {
		ll v = mod_pow(x, t / 2);
		if (t % 2 == 0) {
			return v * v % MOD;
		}
		else {
			return v * v%MOD * x %MOD;
		}
	}
}

ll mod_inv(ll x) {
	return mod_pow(x, MOD - 2);
}

struct edge
{
	ll from; long long to; long long len;
	bool operator<(const edge& rhs) const {
		return len > rhs.len;
	}
};

ll const MAX = 1e5 + 5;
vll G[MAX];
ll n;
ll visited[MAX] = {};

ll f(ll start) {
	visited[start] = 1;
	ll res = 0;
	for (auto next : G[start]) {
		if (visited[next]) {
			continue;
		}
		else {
			ll t = f(next);
			if (t >= 2) {
				return 2;
			}
			else if(t == 0){
				res++;
			}
		}
	}
	return res;
}

int main() {
	cin >> n;
	REP(i, 1, n - 1) {
		ll a, b;
		cin >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	ll start = 1;
	ll tmp = f(start);
	if (tmp >= 2 || tmp == 0) {
		cout << "First" << endl;
	}
	else {
		cout << "Second" << endl;
	}
}

Measured memory_bytes: 6912
#include <stdio.h>

int main(void)
{
  int i,j;
  int H,W;

  while(1){
    scanf("%d %d",&H,&W);
    if(H == 0 && W == 0)break;
    else
      for(i=1;i<=H;i++){
	for(j=1;j<=W;j++){
	  if(i % 2 == 0 && j % 2 == 0){
	    printf("#");
	  }
	  else if(i % 2 == 0 && j % 2 != 0){
	    printf(".");
	  }
	  else if(i % 2 != 0 && j % 2 == 0){
	    printf(".");
	  }
	  else printf("#");
	}
	printf("\n");
      }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 572
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

int main() {
    int r, g, b;
    cin >> r >> g >> b;

    cout << ((g * 2 + b) % 4 == 0 ? "YES" : "NO") << endl;

    return 0;
}

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

using namespace std;

void Main() {
    int N, K;
    cin >> N >> K;
    set<string> usable;
    for (int i = 0; i <= 9; ++i) {
        usable.insert(to_string(i));
    }
    for (int i = 0; i < K; ++i) {
        string d;
        cin >> d;
        if (usable.count(d) > 0) {
            usable.erase(d);
        }
    }

    int ans = 0;
    while (true) {
        string N_str = to_string(N);
        bool pay = true;
        for (int i = 0; i < N_str.size(); ++i) {
            if (usable.count(N_str.substr(i, 1)) == 0) {
                pay = false;
                break;
            }
        }
        if (pay) {
            ans = N;
            break;
        }
        ++N;
    }
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

int main() {
    string s, t;
    cin >> s >> t;
    int ans = 0;
    rep(i, 0, 3) if(s[i] == t[i]) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
//ABC134 T3
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#define R register
#define MAXN 200010
using namespace std;
int C[MAXN<<2],A[MAXN],n;
void build(int l,int r,int o)
{
	if(l > r || l == 0) return;
	if(l == r) {C[o] = A[l]; return;}
	int mid = l + r >> 1;
	build(l,mid,o<<1); build(mid+1,r,o<<1|1);
	C[o] = max(C[o<<1],C[o<<1|1]);
}
int query(int l,int r,int o,int al,int ar)
{
	if(al > ar) return -2333;
	if(l >= al && r <= ar) return C[o];
	int mid = l + r >> 1;
	int tmp1 = 0,tmp2 = 0;
	if(mid >= al) tmp1 = query(l,mid,o<<1,al,ar);
	if(mid < ar) tmp2 = query(mid+1,r,o<<1|1,al,ar);
	return max(tmp2,tmp1);
}
int main()
{
	scanf("%d",&n);
	for(R int i = 1; i <= n; i++) scanf("%d",A+i);
	build(1,n,1);
	for(R int i = 1; i <= n; i++)
		printf("%d\n",max(query(1,n,1,1,i-1),query(1,n,1,i+1,n)));
	return 0;
}

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

using namespace std;

typedef unsigned long long int ULL;
typedef long long LL;
typedef long double LD;

const LL inf = 1000000000000000;
const LL mod = 1000000007;

int main()
{
	LL h, w, k;
	cin >> h >> w >> k;

	char g[h][w];

	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			cin >> g[i][j];
		}
	}

	LL z[h][w] = {0};

	LL cnt = 1;
	for (int i = 0; i < h; ++i) {
		bool f = false;
		for (int j = 0; j < w; ++j) {
			if (g[i][j] == '#') {
				z[i][j] = cnt;
				cnt++;
				f = true;
			}
			else {
				if (f) {

					z[i][j] = cnt-1;
				}
				else {

					z[i][j] = 0;
				}
			}
		}
		if (z[i][w-1] != 0) {
			LL cnt2 = 0;
			for (int j = 0; j < w; ++j) {
				if (z[i][j] != 0) {
					cnt2 = z[i][j];
					break;
				}
			}
			for (int j = 0; j < w; ++j) {
				if (z[i][j] == 0) {
					z[i][j] = cnt2;
				}
				else {
					break;
				}
			}
		}
	}
	LL p1 = 0, p2 = h-1;

	for (int i = 0; i < h; ++i) {
		if (z[i][w-1] == 0) {
			p1++;
		}
		else {
			break;
		}
	}

	for (int i = 0; i < p1; ++i) {
		for (int j = 0; j < w; ++j) {
			cout << z[p1][j] << " ";
		}cout << endl;
	}

	for (int i = h-1; i >= 0; --i) {
		if (z[i][w-1] == 0) {
			p2--;
		}
		else {
			break;
		}
	}

	LL lnz = p1;
	for (int i = p1; i < p2; ++i) {
		if (z[i][w-1] != 0) {
			lnz = i;
		}
		for (int j = 0; j < w; ++j) {
			cout << z[lnz][j] << " ";
		}cout << endl;
	}

	for (int i = p2; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			cout << z[p2][j] << " ";
		}cout << endl;
	}

}

Measured memory_bytes: 1536
<?php

// ファイルパス指定し、任意のファイルを読み取り専用でファイルオープン
$line = fgets(STDIN);

$y = str_split($line);

$x = ['C','O','D','E','F','E','S','T','I','V','A','L','2','0','1','6'];

$count = 0;

for($i=0, $end = 15; $i <= $end; $i++) {
   if($y[$i] !== $x[$i]) {
       $count = ++$count;
   }
}

echo $count;

?>


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

long long n,m,x;
vector<long long> a;
long long b[200001];


bool asc(const pair<long long,long long>& l, const pair<long long,long long>& r){
  if(l.second<=r.second)return 1;
  else return 0;
}


int main(){
  long long i,j;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> b[i];
    a.push_back(b[i]);
  }
  m= n/2;
  sort(a.begin(),a.end());
  x = a[m];
  for(i=0;i<n;i++){
    if(b[i]<x)cout << x << endl;
    else cout << a[m-1] << endl;
  }
  

  return 0;
}


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

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

  int a, b, c;
  cin >> a >> b >> c;

  if (a + b >= c) cout << "Yes\n";
  else cout << "No\n";

  return (0);
}


Measured memory_bytes: 3640
'use strict';

const pipe=Symbol();Function.prototype[pipe]=function(nextFunc){const that=this;return function(I){return nextFunc(that(I));};};
const curry=Symbol();Function.prototype[curry]=function(){  const that=this;  return function(firstArg){    const a=firstArg;    return function(){      return that(a,...arguments);    };  };};
const exec=Symbol();Function.prototype[exec]=function(input){  const that=this;  return that(input);};

function pre1(input){
  return input.
  split(/\n|\r/).
  map(
    str=>
      str.
      split(/\s+/).
      map(x=>x-0)
  );
}

function pre2(input){
  return [
    [null].concat(input[1]),
    input.slice(2),
    [false].concat(new Array(input[0][0]).fill(true)),
  ];
}

function compare(input){
  const H=input[0];
  const M=input[1];
  const G=input[2];
  
  M.forEach(function(AB){
    const [i,j]=AB;
    const Hi=H[i];
    const Hj=H[j];
    if(Hi===Hj){
      G[i]=G[j]=false;
    }else{
      G[(Hi<Hj?i:j)]=false;
    }
  });
  //console.log(G);
  return G;
} 

function count(G){
  return G.reduce(
    (acc,crr)=>acc+(crr?1:0),
    0
  );
}

function showResult(val){
  console.log(val);
  return null;
}

pre1
[pipe](pre2)
[pipe](compare)
[pipe](count)
[pipe](showResult)
[exec](
  require('fs').
  readFileSync('/dev/stdin','utf-8')
);



Measured memory_bytes: 78508
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;
void  print(int n)    {printf("%d ", n);}
void  printl(long long n)     {printf("%I64d ", n);}
long long  readline(){long long x;scanf("%I64d", &x);return x;}
template <typename T> inline void readline(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';n = n * f;}
template <typename T, typename TT> inline void readline(T &n, TT &m) { readline(n); readline(m); }
template <typename T, typename TT, typename TTT> inline void readline(T &n, TT &m, TTT &l) { readline(n, m); readline(l);}
#define error(args...) {vector<string>_v=split(#args,',');err(_v.begin(),args);cout<<endl;}
vector<string> split(const string &s, char c) {vector<string>v; stringstream ss(s); string x;
  while (getline(ss, x, c))v.emplace_back(x); return move(v);} void err(vector<string>::iterator it) {}
template<typename T, typename... Args>void err(vector<string>::iterator it, T a, Args...args) {
cout << it->substr((*it)[0] == ' ', it->length()) << " = " << a << " "; err(++it, args...);}
#define   all(n) n.begin(),n.end()
#define  pb             push_back
#define  ll             long long int
#define  nl             printf("\n");
#define  happy          cin.tie(0);
#define  coding         ios::sync_with_stdio(false);
int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
const int mod           = 1e9 + 7;
const int inf           = (int)2e9 + 5;
const ll  Inf           = (ll)2e18 + 5;

typedef   pair<int, int> ii;
typedef   std::vector<ii> vii;
#define   vi   std::vector<int>
#define   vll  std::vector<ll>
#define  mpsi std::map<string, int>

const int N             = 4e5 + 5;
const int N1            = 1e5 + 5;
int a[N];

int solve() 
{
	//happy coding
	
	int n,m;
	readline(n,m);
	cout<<(n*(n-1))/2+(m*(m-1)/2)<<endl;
	
	
	return 0;
	//error();
}
int main(){
	int test = 1, tc = 0;
	//scanf("%d", &test);//(void)getchar();
	while (test--)solve();
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# モジュールのインポート
import math


def get_input() -> tuple:
    """
    標準入力を取得する.

    Returns:\n
        tuple: 標準入力
    """
    X, Y = list(map(int, input().split()))
    return X, Y


def main(X: int, Y: int) -> None:
    """
    求解処理を行う.

    Args:
        X (int): 庭の動物の総数
        Y (int): 庭の動物の足の総数
    """
    # 求解処理
    ans = "No"
    for crane in range(X + 1):
        turtle = X - crane
        # if math.isclose(2 * crane + 4 * turtle, Y):
        if 2 * crane + 4 * turtle == Y:
            ans = "Yes"
            break

    # 結果出力
    print(ans)


if __name__ == "__main__":
    X, Y = get_input()
    main(X, Y)


Measured memory_bytes: 9208
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 998244353
#define int long long
#define inf 200000000000
const int maxnodes=1005;
#define ll long long
#define N 101
#define EPS 0.01
#define ld long double

int32_t main()
{
    IOS;

    int a,b;
    cin >> a >> b;
    cout << max({a+b,a-b,a*b});
}   

Measured memory_bytes: 256
num = int(input())
ban = list(input())
count = 0
Rcount = 0

for i in range(len(ban)):
    if ban[i] == "R":
        Rcount += 1

for i in range(len(ban)):
    if ban[i] == "R" and Rcount <= i:
        count += 1

print(count)

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

int main(){
    int dice[4][4];
    int nextd[4][4];
    string s;
    int north=0,east=0;
    bool n;

    cin >> dice[0][0] >> dice[3][0] >> dice[0][1] >> dice[0][3] >> dice[1][0] >> dice[0][2];
    cin >> s;

    dice[2][0] = dice[0][2];
    dice[2][1] = dice[0][1];
    dice[2][2] = dice[0][0];
    dice[2][3] = dice[0][3];
    for(int i=1;i<4;i++){
        dice[3][i] = dice[3][0];
        dice[1][i] = dice[1][0];
    }

    for(int j=0;j<s.length();j++){
        n=false;
        if(s[j]=='N'){
            north=1;
            n=true;
        }else if(s[j]=='S'){
            north=3;
            n=true;
        }else if(s[j]=='E') east=1;
        else if(s[j]=='W') east=3;

        if(n){
            for(int k=0;k<north;k++){
                nextd[0][0] = dice[3][1];
                nextd[0][1] = dice[2][1];
                nextd[0][2] = dice[1][3];
                nextd[0][3] = dice[0][3];
                nextd[2][0] = dice[1][1];
                nextd[2][1] = dice[0][1];
                nextd[2][2] = dice[3][3];
                nextd[2][3] = dice[2][3];
                for(int l=0;l<4;l++){
                    nextd[1][l] = dice[0][0];
                    nextd[3][l] = dice[2][0];
                }

                for(int a=0;a<4;a++){
                    for(int b=0;b<4;b++){
                        dice[a][b]=nextd[a][b];
                    }
                }
            }
        }else{
            for(int m=0;m<east;m++){
                nextd[0][0] = dice[0][3];
                nextd[0][1] = dice[0][0];
                nextd[0][2] = dice[0][1];
                nextd[0][3] = dice[0][2];
                nextd[2][0] = dice[2][1];
                nextd[2][1] = dice[2][2];
                nextd[2][2] = dice[2][3];
                nextd[2][3] = dice[2][0];
                for(int c=0;c<4;c++){
                    nextd[1][c] = dice[1][0];
                    nextd[3][c] = dice[3][0];
                }

                for(int a=0;a<4;a++){
                    for(int b=0;b<4;b++){
                        dice[a][b]=nextd[a][b];
                    }
                }                
            }
        }
    }

    cout << dice[0][0] << endl;
}

Measured memory_bytes: 1204
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String[] input = sc.nextLine().split(" ");
            int result = Integer.parseInt(input[0]) * Integer.parseInt(input[1]);
            if (result % 2 == 0) {
                System.out.println("Even");
            } else {
                System.out.println("Odd");
            }
        }
        sc.close();
    }
}

Measured memory_bytes: 21844
#include <stdio.h>

int main(void){
  int a[4],b[4];
  int hit,blow;
  int i,j;
  while((scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3]))!=EOF){
    scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]);
    hit=0; blow=0;
    for(i=0;i<4;i++){
      for(j=0;j<4;j++){
	if(a[i]==b[j]){
	  if(i==j){
	    hit++;
	  }else{
	    blow++;
	  }
	}
      }
    }
    printf("%d %d\n",hit,blow);
  }
  return 0;
}

Measured memory_bytes: 596
#include <stdio.h>
int main() {
	int n, equal = 0;
	scanf("%d",&n);
	char str[n+1];
	scanf("%s",&str);

	for (int i = 0, j = n/2; i < n/2; i++,j++)
	{
		if (str[i] == str[j])
		{
			equal++;
		}
	}
	if (n % 2 == 1)
	{
		puts("No\n");
		return 0;
	}
	equal == n/2 ? puts("Yes\n") : puts("No\n");
	return 0;
}

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

using namespace std;

typedef long long ll;

const int MAXN = 1e5+10;

int n;
ll arr[ MAXN ];

int g( ll x ) {
	if( x < 0 ) return -1;
	if( x == 0 ) return 0;
	return 1;
}

ll f( ll sgn ) {
	ll r = 0, acc = 0;
	for( int i = 0; i < n; ++i ) {
		acc += arr[i];
		if( g(acc) != sgn ) {
			r += abs(sgn-acc);
			acc = sgn;
		}
		sgn *= -1;
	}
	return r;
}

int main( ) {

	ios_base::sync_with_stdio( 0 );
	cin.tie( 0 );

#ifdef LOCAL
	freopen( "input", "r", stdin );
#endif

	while( cin >> n ) {
		ll ans = 0;
		for( int i = 0; i < n; ++i ) {
			cin >> arr[i];
		}
		ans = min( f(1), f(-1) );
		cout << ans << '\n';
	}


	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define nibu(K,x) binary_search(K.begin(),K.end(),x)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define out(x) cout<<x<<endl
#define put(x) out(x)
#define in(x) cin>>x
#define maxx(a,b,c) max(a,max(b,c))
#define minn(a,b,c) min(a,min(b,c))
using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
const double pi = 3.14159265358979;
const ll mod = 1000000007;

int main() {
 int N;
  in(N);
  vs S(N);
  rep(i,N) in(S[i]);
  map<string,int> P;
  int ans =0;
  rep(i,N){
    if(P[S[i]]==0) ans++;
    P[S[i]]++;
  }
  out(ans);
}

Measured memory_bytes: 25112
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<string.h>
#include<queue>
#define LL long long
using namespace std;
inline int read( )
{
  int sum=0;char c=getchar( );bool f=0;
  while(c<'0'||c>'9') {if(c=='-') f=1;c=getchar( );}
  while(c>='0'&&c<='9') {sum=sum*10+c-'0';c=getchar( );}
  if(f) return -sum;
  return sum;
}
const int N=200005;
const LL INF=1e18;
struct ex{LL x,y;ex(){}ex(LL _,LL __){x=_;y=__;}}G[N*40];
inline bool operator < (const ex &a,const ex &b) {return a.x<b.x;}
int n,a[N];LL dep[N],LIM;
struct e{int num,next,w;}map[N];
int head[N],len;
inline void link(int x,int y,int w) {map[++len]=(e){y,head[x],w};head[x]=len;}
int LS[N],RS[N],sz[N],rl[N];
vector<ex>S[N];
inline void dfs(int k)
{
  int i,x;
  for(i=head[k];i;i=map[i].next)
    {
      x=map[i].num;
      dep[x]=dep[k]+map[i].w;dfs(x);
      LS[k]?RS[k]=x:LS[k]=x;
    }
  if(LS[k]) sz[k]=sz[LS[k]]+sz[RS[k]],S[k].resize(min(sz[LS[k]],sz[RS[k]])<<1);
  else sz[k]=1,S[k].resize(1);
}
inline bool DFS(int k)
{
  if(!LS[k]) {rl[k]=0;S[k][0]=ex(dep[k],dep[k]);return 1;}
  int L=LS[k],R=RS[k];
  if(!DFS(L)||!DFS(R)) return 0;
  if(rl[L]>rl[R]) swap(L,R);
  int i,j,inc=-1;LL P=dep[k]<<1;
  for(i=0,j=rl[R];i<=rl[L]&&j>=0;i++)
    {
      while(j>=0&&S[L][i].x+S[R][j].x-P>LIM) j--;
      if(!i&&j<0) return 0;
      if(j>=0)
	{
	  G[++inc]=ex(S[L][i].y,S[R][j].y);
	  G[++inc]=ex(S[R][j].y,S[L][i].y);
	}
    }
  sort(G,G+inc+1);P=INF;
  for(i=0,j=-1;i<=inc;i++)
    if(G[i].y<P) S[k][++j]=G[i],P=G[i].y;
  rl[k]=j;return 1;
}
int main( )
{
  int i,x,w;LL T=0;
  n=read( );
  for(i=2;i<=n;i++) 
    {
      x=read( ),w=read( );
      link(x,i,w);T+=w;
    }
  dfs(1);
  LL l=0,r=T;
  while(l<=r)
    {
      LIM=(l+r)>>1;
      if(DFS(1)) r=LIM-1;
      else l=LIM+1;
    }
  printf("%lld",l);
  return 0;
}


Measured memory_bytes: 34048
#pragma GCC optimize ("O3")
#include<bits/stdc++.h>

#include <iostream>
#include <cstdio>
#include <queue>
#include <set>
#include <string>
#include <stdbool.h>

#include <cstring>

#define pb push_back
#define p push

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define ll long long

#define getI(a) scanf("%d",&a)
#define getII(a, b) scanf("%d%d",&a,&b)
#define getIII(a, b, c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a, b) scanf("%lld%lld",&a,&b)
#define getLLL(a, b, c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfb(a) printf("%.10lf\n",a);
#define pfi(a) printf("%d",a);
#define pfii(a, b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a, b) printf("%lld%lld",a,b);
#define pfd(a) printf("%.12lf ",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);
#define endl "\n"

#define MOD  ( int)(1e9 + 7)
#define MAXN (ll) ((1e6+5))
#define K 25
#define  ALPHABET_SIZE  26
#define N (int)(1e5+10)
#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define INF (ll )1e18
#define int ll
using namespace std;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<pair<int,int>>> vvpi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<vi> graph ;


signed main() {

    string s ;
    cin >> s;
    if( s.size()&1 ){
        cout<< "No";
        return 0;
    }
    for (int i = 0; i <s.size() ; ++i) {
        if(i &1){
            if(s[i] != 'i'){
                cout <<"No";
                return 0;
            }
        }else{
            if(s[i] != 'h'){
                cout <<"No";
                return 0;
            }
        }
    }
    cout <<"Yes";
    return 0;









}

Measured memory_bytes: 256
def get_input():
  return list(map(lambda s: int(s), input().split(' ')))

n = get_input()[0]
l = []
for _ in range(n):
  c = get_input()
  if c[0] == 0: # pushBack(x)
    l.append(c[1])
  elif c[0] == 1: # randomAccess(p)
    print(l[c[1]])
  elif c[0] == 2: # popBack()
    l = l[0:len(l)-1]



Measured memory_bytes: 13372
/********************************************
 *Author*        :ZZZZone
 *Created Time*  : 二 10/ 3 19:23:38 2017
 * Ended  Time*  : 二 10/ 3 19:30:30 2017
*********************************************/
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
typedef long long LL;
LL n, a, b, c;

int main(){
	while(~scanf("%lld", &n)){
		bool flag = true;
		for(int i = 1; i <= 3500 && flag; i++){
			for(int j = 1; j <= 3500 && flag; j++){
				a = i, b = j;
				LL tmp = 4LL*a*b-n*(a+b);
				if(tmp == 0) continue;
				if((n*a*b) % tmp == 0){
					c = (n*a*b)/tmp;
					if(c > 0) flag = false;
				}
			}
		}
		printf("%lld %lld %lld\n", a, b, c);
	}
	return 0;
}


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

using namespace std;

bool canStore(uint64_t p, vector<uint16_t>& w, uint32_t k);

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

	uint32_t n, k, max;
	uint64_t P, left, right, mid, sum;

	cin >> n >> k;

	max = 0;
	sum = 0;
	vector<uint16_t> w(n);
	for(auto& e : w) {
		cin >> e;
		if(max < e) {
			max = e;
		}
		sum += e;
	}

	if(1 == k) {
		P = sum;
	} else if(n == k) {
		P = max;
	} else {
		left = 0;
		right = sum + 1;

		while(right - left > 1) {
			mid = left + (right - left) / 2;
			if(canStore(mid, w, k)) {
				right = mid;
			} else {
				left = mid;
			}
		}
		P = right;
	}
	cout << P << endl;

	return 0;
}

bool canStore(uint64_t p, vector<uint16_t>& w, uint32_t k) {
	uint32_t truckid = 0;
	uint64_t tempSum = 0;

	for(const auto e : w) {
		if(e > p) {
			return false;
		}
		if(tempSum + e <= p) {
			tempSum += e;
		} else {
			truckid++;
			if(truckid >= k) {
				return false;
			}
			tempSum = e;
		}
	}
	return true;
}


Measured memory_bytes: 3260
sx, sy, tx, ty = map(int, input().split())

distance_x = tx - sx
distance_y = ty - sy

# 時計回りで移動することとする
route_str = ''
# 1回目の (sx, sy) -> (tx, ty) -> (sx, sy) は、最短経路で移動する
route_str += 'U' * distance_y
route_str += 'R' * distance_x
route_str += 'D' * distance_y
route_str += 'L' * distance_x
# 2回目は、行きは左上、帰りは右下にそれぞれ1ずつ膨れて移動する
route_str += 'L'
route_str += 'U' * (distance_y + 1)
route_str += 'R' * (distance_x + 1)
route_str += 'D'
route_str += 'R'
route_str += 'D' * (distance_y + 1)
route_str += 'L' * (distance_x + 1)
route_str += 'U'

print(route_str)


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

using namespace std;

int main(){
    int R;
    cin >> R;
    if(R<1200){
        cout << "ABC" << endl;
        return 0;
    }
    if(R<2800){
        cout << "ARC" << endl;
        return 0;
    }
    cout << "AGC" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int N, L[105];
  int max = 0;
  int sum = 0;

  scanf("%d",&N);
for (int i = 0; i <= N - 1;i++){
    scanf("%d",&L[i]);
    sum += L[i];
    if (max < L[i]){
        max = L[i];
    }
}

if(sum - max > max){
    printf("Yes\n");
}else{
    printf("No\n");
}

  return 0;
}

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

int main()
{
    int n;
    cin>>n;
    ll h[n];
    for(int i=0;i<n;i++)
        cin>>h[i];
    ll dp[n];
    for(int i=0;i<n;i++)
        dp[i]=1000000000000;
    dp[0]=0;
    for(int i=0;i<n-1;i++){
        if(i+1<n)
            dp[i+1]=min(dp[i]+abs(h[i+1]-h[i]),dp[i+1]);
        if(i+2<n)
            dp[i+2]=min(dp[i]+abs(h[i+2]-h[i]),dp[i+2]);
    }
    cout<<dp[n-1];
}


Measured memory_bytes: 1792
N, M = map(int, input().split())
A = [list(map(int, input().split())) for i in range(N)]

S_list = {}
for i in range(M):
    S_list[i+1] = 0

participants = 10000
while len(S_list) > 0:
    for i in range(N):
        for j in range(M):
            if A[i][j] in S_list:
                S_list[A[i][j]] += 1
                break
    participants = min(participants,max(S_list.values()))
    if participants == 1:
        break
    for i in S_list.keys():
        if S_list[i] == max(S_list.values()):
            del S_list[i]
            break
    for i in S_list.keys():
        S_list[i] = 0

print(participants)


Measured memory_bytes: 4300
/* 
 * Project: AtCoder Beginners Contest 087 A - Buying Sweets
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/08
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
using namespace std;

int a, b, x;

void solve() {

    int last = (x - a) % b;
    printf("%d\n", last);

}

int main() {

    scanf("%d", &x);
    scanf("%d", &a);
    scanf("%d", &b);

    solve();

}

Measured memory_bytes: 256
import std.conv, std.stdio;
import std.algorithm, std.array, std.range, std.string;
import std.numeric;
void main()
{
    auto n = readln.chomp.to!ulong;
    if (n & 1)
        return 0.writeln;
    n /= 2;
    ulong ret;
    while (n)
    {
        n /= 5;
        ret += n;
    }
    ret.writeln;
}


Measured memory_bytes: 256
//g++  7.4.0

#include <iostream>
#include <vector>

using namespace std;
int main()
{
    int n;
    cin >> n;
    std::vector<unsigned long long int> v;
    for(int i=0; i<n; i++){
        unsigned long long int tmp;
        cin >> tmp;
        if(tmp == 0){
            cout << "0" << endl;
            return 0;
        }
        v.push_back(tmp);
    }
    unsigned long long int sum = 1;
    for(int i=0; i<n; i++){
        if(1000000000000000000 / sum < v[i]){
            cout << -1 << endl;
            return 0;
        }
        sum *= v[i];
    }
        
    cout << sum << endl;
}

Measured memory_bytes: 4296
#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout<<x<<" "<<endl;
#define gg(x,y) cout<<x<<" & "<<y<<" "<<endl
#define jam(t) cout<<"Case #"<<t<<": "
#define ggg(x,y,z) cout<<x<<" & "<<y<<" & "<<z<<" "<<endl
#define all(x) x.begin(),x.end()
#define input_from_file  freopen("input.txt", "r", stdin);
#define mod 1000000007ll
#define sz 400005
#define bitcnt(x) __builtin_popcountll(x)

using namespace std;
ll a[14][14];
ll c[14];
void solve(){
  ll n,m,x;
  cin >> n >> m >> x;
  for(ll i=1;i<=n;i++){
    for(ll j=1;j<=m+1;j++){
      cin >> a[i][j];
    }
  }
  //ll cost = 0;
  ll ans = inf;


  for(ll i=1;i < (1<<n);i++ ){
    ll cost =  0;
    for(ll j=0;j<n;j++){
      if((1<<j)&(i)){
        cost += a[j+1][1];
        for(ll w=2;w<=m+1;w++){
          c[w-1] += a[j+1][w];
        }
      }
    }
    bool ok = true;
  ///  cout << i << endl;
    for(ll f=1;f<=m;f++){

     // cout << c[f] << " ";
      if(c[f] < x)
        ok = false;
      c[f] = 0;
    }
   // cout << endl;
    if(ok)
      ans = min(ans,cost);

  }
  if(ans == inf)
  {
    g(-1);
  }
  else
  {
     g(ans);
  }
 

}
int main()
{
#ifndef ONLINE_JUDGE
input_from_file
#endif
 
    FASTIO
    cin.tie(NULL);
    fflush(stdout);
    ll t = 1;
   // cin >> t;
    for(ll tcase = 1;tcase <= t;tcase++){
      solve();
        
    }
return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	vector<int> a(3);
	rep(i, 3) cin >> a[i];
	sort(all(a));
	if (a[0] + a[1] == a[2]) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int T = sc.nextInt();
		
		for(int i=0; i<T; i++) {
			int N = sc.nextInt();
			long[] A = new long[N];
			for(int j=0; j<N; j++)
				A[j] = sc.nextLong();
			char[] s = sc.next().toCharArray();
			
			System.out.println(solve(A, s));
		}
		
		sc.close();
	}
	
	static int solve(long[] A, char[] s) {
		int N = A.length;

		long[] m = new long[N];
		int size = 0;
		for(int i=N-1; i>=0; i--) {
			if(s[i]=='0') {
				m[size] = A[i];
				size++;
			} else {
				long[] work = new long[size+1];
				work[0] = A[i];
				for(int j=0; j<size; j++)
					work[j+1] = m[j];
				if(!couldBeZero(work)) {
					return 1;
				}
			}
		}
		
		return 0;
	}
	
	static boolean couldBeZero(long[] m) {
		int N = m.length;
		for(int i=0; i<60; i++) {
			int baseIndex = -1;
			for(int j=1; j<N; j++) {
				if((m[j]&(1l<<i))!=0) {
					baseIndex = j;
					break;
				}
			}
			if(baseIndex<0)
				continue;
			long base = m[baseIndex];
			for(int j=0; j<N; j++) {
				if((m[j]&(1l<<i))!=0) {
					m[j] ^= base;
				}
			}
		}
		return m[0] == 0;
	}
}


Measured memory_bytes: 46292