akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

#define INF INT_MAX

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m; cin>>n>>m;
    vector<vector<pi> > adj(n);
    rep(i,m){
        int l,r,d; cin>>l>>r>>d; l--; r--;
        adj[l].emplace_back(r,d);
        adj[r].emplace_back(l,-d);
    }
    vi dist(n,INF);
    rep(i,n){
        if (dist[i]==INF){
            queue<int> que;
            que.push(i);
            dist[i] = 0;
            while(que.size()){
                int v = que.front(); que.pop();
                for(auto e:adj[v]){
                    int u,d;
                    tie(u,d) = e;
                    if (dist[u]!=INF) continue;
                    dist[u] = dist[v]+d;
                    que.push(u);
                }
            }
        }
    }
    rep(i,n){
        for(auto e:adj[i]){
            int v,d;
            tie(v,d) = e;
            if (dist[v]-dist[i]!=d){
                cout<<"No\n";
                return 0;
            }
        }
    }
    cout<<"Yes\n";
    return 0;
}


Measured memory_bytes: 9344
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int area = a*b;
        int length = (2*a + 2*b);
        System.out.println(area+ " " +length);
        sc.close();
    }
}


Measured memory_bytes: 26080
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		while (sc.hasNext()) {

			int listA[] = createList();
			int listB[] = createList();

			int hit = 0;
			int blow = 0;

			for (int i = 0; i < 4; i++) {
				if (listA[i] == listB[i]) {
					hit++;
				}
			}
			for (int i = 0; i < 4; i++) {
				for (int j = 0; j < 4; j++) {
					if (listA[i] == listB[j]) {
						blow++;
					}
				}
			}
			blow = blow - hit;

			System.out.println(hit + " " + blow);
		}
	}

	public static int[] createList() {
		int list[] = new int[4];

		for (int i = 0; i < 4; i++) {
			list[i] = sc.nextInt();
		}
		return list;
	}
}

Measured memory_bytes: 26136
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	
	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String line1 = reader.readLine();
		String[] arr1 = line1.split(" ");
		int s = Integer.parseInt(arr1[0]);
		int w = Integer.parseInt(arr1[1]);
		if(w >= s) {
			System.out.println("unsafe");
		} else {
			System.out.println("safe");
		}
	}

}


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

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }	//最大公約数(Greatest Common Divisor)
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }			//最小公倍数(Least Common Multiple)

long long comb(long long m) {
	return (m * (m - 1)) / 2;
}


int main() {
	ll a, b, c, k;
	cin >> a >> b >> c >> k;

	ll ans = 0;
	if (k <= a) {
		ans += k;
		cout << ans << endl;
		return 0;
	}
	else {
		ans += a;
		k -= a;
		if (k <= b) {
			cout << ans << endl;
			return 0;
		}
		else {
			k -= b;
			ans -= k;
			cout << ans << endl;
			return 0;
		}
	}

}

Measured memory_bytes: 3596
#include <stdio.h>

using namespace std;

int main(){
	int a,b;
	char op;
	while(true){
		scanf("%d %c %d",&a,&op,&b);
		if(op == '?') break;
		switch(op){
		case '+':
			printf("%d\n",a+b);
			break;
		case '-':
			printf("%d\n",a-b);
			break;
		case '/':
			printf("%d\n",a/b);
			break;
		case '*':
			printf("%d\n",a*b);
			break;
		}
	}
}






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

// g++ -std=c++17 -O2 -Wall template.cpp -o template
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n, a, b;
    cin >> n >> a >> b;
    int sum = 0;
    for (int i = 1; i <= n; i++) {
        int cur = i;
        int sum_base = 0;
        while (cur) {
            sum_base += cur % 10;
            cur /= 10;
        }
        if (a <= sum_base && sum_base <= b) {
            sum += i;
        }
    }
    cout << sum << endl;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution
}


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

ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
	int n, m;
	cin >> n >> m;
	vector<int> a(m);
	rep(i, m) cin >> a[i];
	
	int dp[n + 10] = {};
	dp[0] = 1;
	
	for(int i = 0; i < m; ++i){
		dp[a[i]] = -1;
	}
	
	for(int i = 0; i <= n; ++i){
		if(dp[i] == -1) continue;
		if(dp[i+1] != -1){
			dp[i+1] += dp[i] % MOD;
			dp[i+1] %= MOD;
		}
		if(dp[i+2] != -1){
			dp[i+2] += dp[i] % MOD;
			dp[i+2] %= MOD;
		}
	}
	
	cout << dp[n] << endl;
	return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
	int n;
	cin>>n;
	vector<int> v(n);
	rep(i,n)cin>>v[i];
	int count=0;
	vector<int> vv;
	int idx=1;
	map<int,int> m;
	m[count]=idx;
	while(1){
		count++;
		idx=v[idx-1];
		if(idx==2){cout<<count<<endl;return 0;}
		if(m.find(idx)!=m.end()){cout<<-1<<endl;return 0;}
		m[idx]=idx;
	}
	return 0;
}


Measured memory_bytes: 5376
N,M=map(int, input().split())
E=[[] for _ in range(N)]
for _ in range(M):
    x,y,z=map(lambda i:int(i)-1, input().split())
    E[x].append(y)
    E[y].append(x)

#情報のつながりがあるカードでグルーピングする
#グループIDのリスト(0は未割り当て)
G=[0]*(N+1)

def dfs(root,g):
    stack=[root]
    G[root]=g
    while stack:
        node=stack.pop()
        for to in E[node]:
            if G[to]==0:
                G[to]=g
                stack.append(to)

ans=0
for i in range(N):
    if G[i]==0:
        ans+=1
        dfs(i,ans)

print(ans)


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

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

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

const int mod = 998244353;

int main(int, char**)
{
    int n, s;
    cin >> n >> s;

    vector<int> a(n);
    rep(i,n) cin >> a[i];

    vector< vector<ll> > dp(n+1, vector<ll>(s+1,0));
    dp[0][0] = 1;
    rep(i,n) rep(j,s+1) {
        dp[i+1][j] += dp[i][j] << 1;
        dp[i+1][j] %= mod;
        if (j + a[i] <= s) {
            dp[i+1][j+a[i]] += dp[i][j];
            dp[i+1][j+a[i]] %= mod;
        }
    }

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

    return 0;
}

Measured memory_bytes: 73676
#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
#define ll long long int
#define hell 1000000007LL
using namespace std;
ll power(ll x, ll y, ll z){ 
    if(y==0)
     return 1;
    else
    {
        ll p=power(x,y/2,z);
        if(y%2==0)
         return (p*p)%z;
        else
        return (x*((p*p)%z))%z;
    }}
ll gcd(ll x,ll y)
{
    if(y==0)
     return x;
    else
    return gcd(y,x%y);
}
ll po(ll x)
{
    ll c=0;
    while(x>0)
    {
        x=x&(x-1);
        c++;
    }
    return c;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
   ll a,b,c,k;
   cin>>a>>b>>c>>k;
   for(int i=0;i<=k;i++)
   {
       for(int j=0;j<=k;j++)
       {
           for(int p=0;p<=k;p++)
           {
               if(i+j+p==k)
               {
                   ll x=a*pow(2,i);
                   ll y=b*pow(2,j);
                   ll z=c*pow(2,p);
                   if(z>y&&y>x)
                   {
                       cout<<"Yes";
                       exit(0);
                   }
               }
           }
       }
   }
   cout<<"No";}

Measured memory_bytes: 4040
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
#include<numeric>
#include<queue>
#include<string>
#include<vector>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
ll mod = 1000000007;
using namespace std;
priority_queue<ll int>A;//きゅー
int main(void)
{
	int N,o=0;
	char S[100010];
	scanf("%d%s", &N, &S);
	for (int i = 0; i < N-1; i++) {
		if (S[i] == S[i + 1]) {
			o++;
		}
		//printf("%d\n", N);
	}
	printf("%d", N-o);
	return 0;

}


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

int main()
{
string s,t;
cin>>s>>t;
int counter=0;
for(int i=0;i<s.size();++i)
{

    if(s[i]!=t[i])
        counter++;
}
cout<<counter;
    return 0;
}


Measured memory_bytes: 3904
<?php
# 入力
fscanf(STDIN, '%d', $n);
$a = array_merge([0], array_map('intval', explode(" ", trim(fgets(STDIN)))));
$b = [];
$result = [];
for ($i = $n; $i > 0; $i--) {
    $sum = 0;
    for ($j = 2; $i * $j <= $n; $j++) {
        $sum += $b[$i * $j];
    }
    if ($sum % 2 != $a[$i]) {
        $b[$i] = 1;
        $result[] = $i;
    } else {
        $b[$i] = 0;
    }
}
$cnt = count($result);
echo $cnt.PHP_EOL;
if ($cnt > 0) {
    echo implode(" ", $result).PHP_EOL;
}
?>

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

int main() {
  int N;
    cin >> N;
  if(N <1000){
    cout<< 1000 - N << endl;
  }
  if(N%1000 ==0 ){
    cout << 0 <<endl;
  }
  if(N >1000 && N%1000 != 0){
    cout << 1000*(1 + N /1000) -N <<endl;
  }
}


Measured memory_bytes: 3632
using System;
using System.Linq;
using System.Collections.Generic;
class c
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var list = new List<string>();
        for (int i = 0; i < 3; i++)
        {
            list.Add(Console.ReadLine());
        }
        long ans = 0;
        for (int i = 0; i < n; i++)
        {
            var line = new List<char>();
            for (int j = 0; j < 3; j++)
            {
                line.Add(list[j][i]);
            }
            ans += line.Distinct().Count() - 1;
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13280
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
int n,h[500010];
int lowbit(int x){
	return x&-x;
}
int main(){
	cin>>n;
	if  (lowbit(n)==n) return puts("No"),0;
	puts("Yes");
	printf("1 2\n");
	printf("2 3\n");
	printf("3 %d\n",n+1);
	printf("%d %d\n",n+1,n+2);
	printf("%d %d\n",n+2,n+3);
	h[2]=2;
	h[3]=3;
	for (int i=4;i<n;i+=2){
		printf("%d %d\n",i,i+1);
		printf("%d %d\n",i+1,1);
		printf("%d %d\n",n+1,n+i);
		printf("%d %d\n",n+i,n+i+1);
		h[i]=n+i;
		h[i+1]=i+1;
	}
	if (n%2==0){
		printf("%d %d\n",n,h[n-lowbit(n)]);
		printf("%d %d\n",n+n,h[lowbit(n)^1]);
	}
	return 0;
}

Measured memory_bytes: 2944
k,n = map(int, input().split())
a = list(map(int, input().split()))
max_dis = 0
for i in range(n):
    if i == n-1:
        max_dis = max(max_dis,a[0]+k-a[i])
    else:
        max_dis = max(max_dis,a[i+1]-a[i])
print(k-max_dis)


Measured memory_bytes: 26420
#include<stdio.h>
#include<string.h>

int main() {
    int n;
    scanf("%d", &n);
    int a[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }

    for (int j = n - 1; j >= 0; j -= 2) {
        printf("%d ", a[j]);
    }
    for (int k = n % 2; k <= n - 2; k += 2) {
        printf("%d ", a[k]);
    }

    return 0;
}

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


int main()
{
    ll n;
    string s;
    cin >> n >> s;
    char temp = s[0];
    ll ans = 1;
    for(ll i = 1; i < s.length(); i++){
        if(temp != s[i]){
            temp = s[i];
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define f(X) for(c=0;c<X;c+=v[p--]);if(c-X)goto L;
main(){for(char n,v[99],s,p,c;p=s=n=atoi(gets(v));){for(;p;v[p--]=strlen(gets(v+70)));L:p=s--;f(5)f(7)f(5)f(7)f(7)printf("%d\n",n-s);}}

Measured memory_bytes: 1128
function Main(input) {
  const lines = input.split('\n');
  const a = lines[0];
  const d = lines[1].split(' ').map(val => Number(val));
  let ans = 0;
  for(let i = 0; i < a - 1; i++) {
    for (let j = i+1; j < a; j++) {
      ans += d[i] * d[j];
    }
  }
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
import java.util.*;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    for (int i=X; ; i++) {
      boolean b = false;
      for (int j=2; j<=X/2; j++) {
        if (i%j == 0) {
          b = true;
          break;
        }
      }
      if (!b) {
        System.out.println(i);
        break;
      }
    }
  }
}
//

Measured memory_bytes: 35560
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

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

A.sort()
max_distance = A[0] + K-A[-1]

old = None
for a in A:
    if not old:
        old = a
        continue
    distance = a - old
    if distance > max_distance:
        max_distance = distance
    old = a

answer = K - max_distance
print(answer)

Measured memory_bytes: 20424
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	int N;
	string S[2];
	cin >> N >> S[0] >> S[1];

	auto ans = 1ll;
	auto mod = (ll)1e9 + 7;
	auto vertical = false;
	for (auto i = 0; i < N; )
	{
		if (S[0][i] == S[1][i])
		{
			if (i == 0)
			{
				ans *= 3;
			}
			else if (vertical)
			{
				ans *= 2;
			}
			++i;
			vertical = true;
		}
		else
		{
			if (i == 0)
			{
				ans *= 6;
			}
			else if(vertical)
			{
				ans *= 2;
			}
			else
			{
				ans *= 3;
			}
			i += 2;
			vertical = false;
		}
		ans %= mod;
	}

	cout << ans << endl;

	return 0;
}

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

using namespace std;

#define DB( x ) cout << #x << " = " << x << endl;
#define LEFT(n) (2 * (n))
#define RIGHT(n) (2 * (n) + 1)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> node;
//typedef vector <vector <ll>> matrix;

const ll INF = 1e16;
const double EPS = 1e-9;
const ll MOD = (ll)(1e9 + 7);
const ll MAXV = (ll)(2e5 + 10);
const ll MAXE = (ll)(1e6 + 10);


int main(){
	cin.sync_with_stdio( 0 );cin.tie( 0 );


	ll n, x;

	cin >> n >> x;

	ll ans = 1;
	ll curr = 0;
	for(int i = 0;i < n;i ++){
		ll d;
		cin >> d;

		curr += d;

		if(curr <= x)
			ans ++;
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	
	public static void main(String [] args) {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		
		
		int [] arr = new int [n];
		
		
		int maxVal = Integer.MIN_VALUE;
		
		
		
		for(int i = 0; i < n; i++) {
			arr[i] = in.nextInt();
		}
		
		int biggestNum = arr[n - 1];
		
		for(int j = n - 1; j > 0; j--) {
			
			 biggestNum = Math.max(arr[j], biggestNum);
			
			 
			 if(biggestNum - arr[j - 1] > maxVal) {
				 maxVal = biggestNum - arr[j - 1];
			 }
			 	
	}
		
		System.out.println(maxVal);
		
		

	}
}



Measured memory_bytes: 70424
N, K = map(int, input().split())

H = [0]*N
for i in range(N):
  H[i] = int(input())
H.sort()
m = H[-1]-H[0]
for i in range(N-K+1):
  m = min(m,H[i+K-1]-H[i])
print(m)

Measured memory_bytes: 7472
#include <iostream>
#include <set>
#include <string>

using namespace std;

int main() {
		int N, K;
		cin >> N >> K;
		set<int> st;
		for (int i = 0; i < K; i++) {
				int t;
				cin >> t;
				st.insert(t);
		}

		bool flg = true;
		for (int i = 1; i < 100000; i++) {
				string S = to_string(i);
				if (i >= N) {
						int t = i;
						for (int j = 0; j < S.size(); j++) {
								if (st.find(t%10) != st.end()) {
										flg = false;
										break;
								} else {
										t /= 10;
								}
						}

						if (!flg) {
								flg = true;
						} else {
								cout << i << endl;
								return 0;
						}
				}
		}
		return 0;
}


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

int main()
{
	int N;
  	cin>>N;
  	int i,A[N],sum=0,j;
  	for(i=0;i<N;i++)
  	{
  		cin>>A[i];
  	}
  	for(i=0;i<N-1;i++)
    {
    	for(j=i+1;j<N;j++)
        {
        	sum+=A[i]*A[j];
        }
    
    }
	cout<<sum;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
p=list(map(int,input().split()))
cnt=0
i=1
while i<n-1:
    if p[i-1]<p[i]<p[i+1] or  p[i+1]<p[i]<p[i-1]:
        cnt+=1
    i+=1
print(cnt)




Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int GCD(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   if(_a % _b == 0){
      return _b;
   }
   else{
      return GCD(_b, _a % _b);
   }
}

int LCM(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   return (_a*_b)/(GCD(_a, _b));
}

int main(){
   int n;
   cin >> n;
   cout << "ABC" << n << endl;

   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include <list>
#include<algorithm>
#include<cstring>
using namespace std;

int main() {
	int n;
	scanf("%d", &n);
	list<int> v;
	char c[20]; int d;
	for (int i = 0;i < n;i++) {
		scanf("%s%d", c, &d);
		if (c[0] == 'i')
			v.push_front(d);
		else if (c[6] == 'F')
			v.pop_front();
		else if (c[6] == 'L')
			v.pop_back();
		else
		for(list<int>::iterator it=v.begin();it!=v.end();it++)
			if (*it == d) {
				v.erase(it);
				break;
			}
	}

	for (list<int>::iterator it = v.begin();it != v.end();it++)
	{
		if (it!=v.begin()) printf(" ");
		printf("%d", *it);
	}
	cout << endl;
}

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

using lli = long long int;
using Vint = vector<int>;
using Vlli = vector<lli>;
using Wint = vector<Vint>;
using Wlli = vector<Vlli>;
using pii = pair<int, int>;
using pll = pair<lli, lli>;

const int MOD = 1e9 + 7;
const int INFi = 2e9 + 1;
const lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1), make_pair(0, -1)};

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(i, vec) for(auto &(i) : (vec))


template <class T> inline int argmin(vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){a = max(a, b);}
template <class T> inline void chmin(T &a, T b){a = min(a, b);}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

string restore(Wint &DP, string &s, string &t, int i, int j){
  if(i == 0 || j == 0) return "";
  if(DP[i][j] == DP[i - 1][j]) return restore(DP, s, t, i - 1, j);
  if(DP[i][j] == DP[i][j - 1]) return restore(DP, s, t, i, j - 1);
  return restore(DP, s, t, i-1, j-1) + s.at(i-1);
}

int main(void){
  string s, t; cin >> s >> t;
  int ss = s.size(), ts = t.size();
  /* DP[i][j] := s_0s_1...s_(i-1)とt_0t_1...t_(j-1)の最長部分列の長さ <~ 文字列は長さで復元可能
  *              (ただし, 0 <= i <= s.size, 1<= j <= t.size)
  * DP[i][j] ~> DP(i + 1, j + 1) <- DP(i, j) + 1 if (s.at(i) == t.at(j))
  *          ~> DP(i, j + 1), DP(i + 1, j) <~ DP(i, j)
  * DP(0)(0) = 初期文字による
  */
  Wint DP(ss + 1, Vint(ts + 1, 0));
  REP(i, ss) REP(j, ts){
    if(s.at(i) == t.at(j)) chmax(DP[i + 1][j + 1], DP[i][j] + 1);
    chmax(DP[i + 1][j], DP[i][j]);
    chmax(DP[i][j + 1], DP[i][j]);
  }
  REP(i, ss) chmax(DP[i + 1][ts], DP[i][ts]);
  REP(j, ts) chmax(DP[ss][j + 1], DP[ss][j]);
  /*
  REP(i, ss + 1) REP(j, ts + 1){
    printf("DP(%d, %d) = %d\n", i, j, DP[i][j]);
  }*/
  cout << restore(DP, s, t, s.size(), t.size()) << "\n";
  return 0;
}

Measured memory_bytes: 35840
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
const ll MOD=998244353,inv2=499122177;
int n;
ll p[1<<18],a[1<<18],b[1<<18],c[1<<18];
ll quick_pow(ll x,ll a)
{
	ll ans=1;
	while(a)
	{
		if(a&1)ans=ans*x%MOD;
		x=x*x%MOD;
		a>>=1;
	}
	return ans;
}
void solve(int n,ll*p,ll*a,ll*b,ll*c,int t)
{
	if(n==1)
	{
		ll inv=quick_pow(1+MOD-p[0],MOD-2);
		a[1]=inv*p[1]%MOD;
		c[1]=inv*t%MOD;
		a[0]=1;
		return;
	}
	int m=1<<(n-1);
	for(int i=0;i<m;i++)
	{
		p[i]=(p[i]+p[i+m])%MOD;
		p[i+m]=(p[i]+2*MOD-2*p[i+m])%MOD;
	}
	solve(n-1,p,a,b,c,t);
	solve(n-1,p+m,a+m,b+m,c+m,0);
	for(int i=0;i<m;i++)
	{
		a[i]=b[i]=a[i]*inv2%MOD;
		a[i+m]=a[i+m]*inv2%MOD,b[i+m]=MOD-a[i+m];
		a[i]+=a[i+m],a[i+m]=a[i]+MOD-2*a[i+m];
		b[i]+=b[i+m],b[i+m]=b[i]+MOD-2*b[i+m];
		c[i]+=c[i+m],c[i+m]=c[i]+MOD-2*c[i+m];
		ll p1=(p[i]+p[i+m])*inv2%MOD;
		ll p2=(p[i]-p[i+m]+MOD)*inv2%MOD;
		p[i]=p1,p[i+m]=p2;
	}
	for(int i=0;i<(1<<n);i++)
	{
		a[m]=(a[m]+p[i]*a[m^i])%MOD;
		b[m]=(b[m]+p[i]*b[m^i])%MOD;
		c[m]=(c[m]+p[i]*c[m^i])%MOD;
	}
	b[m]--;
	ll inv=quick_pow(1+MOD-b[m],MOD-2);
	a[m]=a[m]*inv%MOD;
	b[m]=0;
	c[m]=(c[m]+t)*inv%MOD;
	for(int i=1;i<(1<<n);i++)
	{
		a[i]=(a[i]+b[i]*a[m])%MOD;
		c[i]=(c[i]+b[i]*c[m])%MOD;
		b[i]=0;
	}
}
int main()
{
	scanf("%d",&n);
	ll s=0;
	for(int i=0;i<(1<<n);i++)
	{
		scanf("%lld",&p[i]);
		s+=p[i];
	}
	s=quick_pow(s,MOD-2);
	for(int i=0;i<(1<<n);i++)p[i]=p[i]*s%MOD;
	solve(n,p,a,b,c,1);
	for(int i=0;i<(1<<n);i++)printf("%lld\n",c[i]);
	return 0;
}

Measured memory_bytes: 10880
#include<bits/stdc++.h>
#define For(i,a,b) for(i=a;i<=b;i++)
#define pb push_back
#define vi vector<int>
#define vii vector<vector<int>>
#define vll vector<long long>  
#define vd vector<double>
#define pi (int,int)
#define vpi vector<pair<int,int>>
#define vs vector<string>
#define mp make_pair
#define ll long long
#define vc vector<char>
#define rng(x) x.begin(),x.end()
#define B(x) x.begin()
#define E(x) x.end()
#define F first
#define S second
#define me max_element
#define ne min_element
#define LL "%I64d"
#define pi 3.1415926536
using namespace std;

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  
  double d,t,s;
  cin>>d>>t>>s;
  if((d/s)<=t) cout<<"Yes";
  else cout<<"No";
  return 0;  
}
        

Measured memory_bytes: 3736
#include<bits/stdc++.h>
#define int long long
using namespace std;
int const MOD=1e9+7;
int s,ans,f[2333][2333]={{1}};
signed main(){
	cin>>s;
	for(int i=1;i<=s/3;i++)
	    for(int j=(i-1)*3;j<=s;j++)
	        for(int k=3;k+j<=s;k++)
	            f[i][k+j]=(f[i][k+j]+f[i-1][j])%MOD;
	for(int i=1;i<=s/3;i++)ans=(ans+f[i][s])%MOD;
	cout<<ans<<endl;
}

Measured memory_bytes: 15584
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto M = RD;
	auto cnt = new long[](N);
	foreach (i; 0..M)
	{
		auto a = RD-1;
		auto b = RD-1;
		++cnt[a];
		++cnt[b];
	}
	bool ans = true;
	foreach (i; 0..N)
	{
		if (cnt[i] % 2 == 1)
		{
			ans = false;
			break;
		}
	}

	writeln(ans ? "YES" : "NO");
	stdout.flush;
	debug readln;
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()

int main(){
    VL H(2), M(2);
    cin >> H[0] >> M[0];
    cin >> H[1] >> M[1];
    ll K; cin>>K;
    ll ans=60*(H[1]-H[0])+(M[1]-M[0])-K;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

int main() {
    char X,Y,A=10,B=11,C=12,D=13,E=14,F=15;
    cin>>X>>Y;
    if(X>Y) cout<<">"<<endl;
    if(X<Y)cout<<"<"<<endl;
    if(X==Y)cout<<"="<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int N; cin >> N;
    vector<int> A(N);
    REP(i, 0, N) cin >> A[i];

    int cur = 0;
    vector<int> ans(N);
    REP(i, 1, N) cur ^= A[i];
    ans[0] = cur;
    REP(i, 1, N) {
        cur ^= A[i - 1];
        cur ^= A[i];
        ans[i] = cur;
    }

    for (auto a : ans) cout << a << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 4756
#include <iostream>
#include <algorithm>
using namespace std;
using llong = long long;

int main() {
    llong n;
    llong s2 = 0;
    llong s5 = 0;

    cin >> n;

    if (n % 2 != 0) {
        cout << 0 << endl;
        return 0;
    }

    llong s = n;
    while (s > 0) {
        s2 += s / 2;
        s /= 2;
    }

    s = n;
    while (s > 0) {
        s5 += s / 10;
        s /= 5;
    }

    cout << min(s2, s5) << endl;

    return 0;
}


Measured memory_bytes: 3588
macro_rules! read_line {
    () => {{
        let mut input = String::new();
        std::io::stdin().read_line(&mut input).unwrap();
        input
    }};
}

fn read_trim() -> String {
    read_line!().trim().to_owned()
}

fn main() {
    let input = read_trim();
    let mut state: i32 = 0;

    for c in input.as_bytes() {
        state ^= 1 << (c -0x61) 
    }

    println!("{}", if state == 0 {"Yes"} else {"No"})
}

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

using namespace std;

#define REP(i, n) for (int i=0; i<(n); ++i)
#define RREP(i, n) for (int i=(int)(n)-1; i>=0; --i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)
#define RFOR(i, a, n) for (int i=(int)(n)-1; i>=(a); --i)

#define SZ(x) ((int)(x).size())
#define all(x) begin(x),end(x)

#define dump(x) cerr<<#x<<" = "<<(x)<<endl
#define debug(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;

template<class T>
ostream &operator<<(ostream &os, const vector <T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair <T, U> &p) {
    return os << "(" << p.first << " " << p.second << ")";
}

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

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;

// O(NlogN)
template<typename T>
vector<T> fast_zeta_transform(const vector<T>& f) {
    // Return g(s):
    // s.t. g(s) = \sum_{s \subset t} f(t)
    int n = f.size();
    vector<T> g = f;
    for (int i = 0; (1 << i) < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (j >> i & 1) {
                g[j] = min(g[j], g[j & ~(1<<i)]);
            }
        }
    }
    return g;
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    for (;;) {
        int n, m; cin >> n >> m;
        if (n == 0) break;
        vi s(n);
        REP(i, n) cin >> s[i];
        vi d(m);
        REP(i, m) cin >> d[i];
        sort(all(d));

        vvi dp(m+1, vi(1<<n, INF));
        dp[0][0] = 0;
        REP(i, m) {
            dp[i+1] = fast_zeta_transform(dp[i]);
            REP(bit, 1<<n) {
                int sum = 0;
                REP(i, n) if (bit >> i & 1) sum += s[i];
                dp[i+1][bit] += abs(sum - d[i]);
            }
        }
        cout << *min_element(all(dp[m])) << endl;
    }

    return 0;
}



Measured memory_bytes: 16336
n = int(input())
a = input().split()
a = [int(m) for m in a]
ans = float("INF")

for i in range(-100, 101):
    tmp = 0
    for j in range(n):
        tmp += (a[j] - i) ** 2
    if ans > tmp:
        ans = tmp
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<string>
#include<math.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int) (n);i++)
using ll = long long;
using P = pair<int,int>;

void solve_8(){//7m
    string a, b;
    cin >> a >> b;
    string tmp =  a+b;
    int c = atoi(tmp.c_str());
    //cout << c << endl;
    int c_square = sqrt(c);
    cout << (c_square * c_square == c? "Yes": "No") << endl;
    
}

void solve_8re(){
    string a, b;
    cin >> a >> b;
    //stoi -> int
    //stol -> long
    //stof -> float
    int c = stoi(a+b);
    int c_square = sqrt(c);
    cout << (c_square * c_square == c? "Yes": "No")<< endl;
}

void solve_B(){
    
}

void solve_C(){
    
}

void solve_D(){
    
}

void solve_E(){
    
}

void solve_F(){
    
}

int main(){
    solve_8re();
    //solve_B();
    //solve_C();
    //solve_D();
    //solve_E();
    //solve_F();
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int length = line.length();
        for(int i=0;i<length;i++){
            char c = line.charAt(i);
            if(Character.isLowerCase(c)){
                char newc=Character.toUpperCase(c);
                System.out.print(newc);
            }else{
                char newc=Character.toLowerCase(c);
                System.out.print(newc);
            }
        }
        System.out.println("");
        sc.close();
    }
}


Measured memory_bytes: 26800
package main

import "fmt"

func sumDigits(n int) int {
	res := 0
	for n > 0 {
		res += n % 10
		n /= 10
	}
	return res
}

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)
	ans := 0
	for i := 1; i <= n; i++ {
		sd := sumDigits(i)
		if a <= sd && sd <= b {
			ans += i
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f3f3f3f3f3f
#define pi 3.1415926535898
#define N 500050
using namespace std;
char a[10010];
int n,k,ans,f[1050][5];//表示第i位有J个非零数位的方案数
int main()
{
    cin>>a+1;
    cin>>n;
    int len=strlen(a+1);
    for(int i=1; i<=len; i++)
        a[i]-='0';
    f[0][0]=1;
    for(int i=1; i<=len; i++)
    {
        f[i][0]=f[i-1][0];
        for(int j=1; j<=3; j++)
        {
            f[i][j]=f[i-1][j]+9*f[i-1][j-1];//预处理
        }
    }
    int cnt=0;
    for(int i=1; i<=len; i++)
    {

        if(a[i])
        {
            if(n-cnt>=0)
                ans+=f[len-i][n-cnt];//接下来还有（len-i）位数，n-cnt的非零位
        }

        if(a[i]>1)
        {
            if(n-cnt-1>=0)
                ans+=(a[i]-1)*f[len-i][n-cnt-1];//本位可以取非零位
        }
        if(a[i])
            ++cnt;
    }
    if(cnt==n)
        ++ans;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3652
X = int(input())
ans = 0
if X >= 1800:
    ans = 1
elif X >= 1600:
    ans = 2
elif X >= 1400:
    ans = 3
elif X >= 1200:
    ans = 4
elif X >= 1000:
    ans = 5
elif X >= 800:
    ans = 6
elif X >= 600:
    ans = 7
elif X >= 400:
    ans = 8
print(ans)


Measured memory_bytes: 61596
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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 qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}


signed main(){
  int n;

  int x;
  cin >> x;
  int a=1;
  int ans = 1;
  while(ans<x){
    a++;
    ans+=a;
  }
  cout << a fin;
  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void initialize(){
  head = tail = 0;
}

int isEmpty(){
  return head == tail;
}

int isFull(){
  return head == (tail + 1) % LEN;
}

void enqueue(P x){
  if(isFull()){
    printf("エラー（オーバーフロー）\n");
  }
  Q[tail] = x;
  if(tail + 1 == LEN) tail = 0;
  else tail++;
}

P dequeue(){
  if(isEmpty()){
    printf("エラー（アンダーフロー）\n");
  }
  P x;
  x = Q[head];
  if(head + 1 == LEN) head = 0;
  else head++;
  return x;
}


int main(){
  int elaps = 0;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1;
  tail = n + 1;
  while(head != tail){
    if(Q[head].t - q > 0){
      u = dequeue();
      u.t -= q;
      elaps += q;
      enqueue(u);
    }
    else{
      u = dequeue();
      elaps += u.t;
      printf("%s %d\n", u.name, elaps);
    }
  }
  
  return 0;
}



Measured memory_bytes: 11880
import java.util.Scanner;

public class Main{
	public Main(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int f = 0;
		
		
		while(sc.hasNext()){
			String str = (sc.nextLine()).replace("Hoshino", "Hoshina");
			System.out.print(str);
			if(f != 0){
				System.out.println();
			} else {
				f = 1;
			}
		}
	}
	
	public static void main(String[] args){
		Main test = new Main();
	}
}

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

#define FOR(i,a,b)    for (int i=(a)  ;i<(b) ;i++)
#define RFOR(i,a,b)   for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)      for (int i=0    ;i<(n) ;i++)
#define RREP(i,n)     for (int i=(n)-1;i>=0  ;i--)
#define EACH(i,a,b)   for (int i=(a)  ;i<=(b);i++)
#define REACH(i,a,b)  for (int i=(b)  ;i>=(a);i--)
#define ALL(a)        (a).begin(),  (a).end()
#define RALL(a)       (a).rbegin(), (a).rend()

const int MOD = 1e9 + 7;
const int INF = 1 << 29;
const double EPS = 1e-10;

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

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

  int N;
  cin >> N;

  int ans = 0;
  EACH(i,0,8) {
    int x = 1;
    REP(_,i) x *= 2;
    if (x <= N) ans = x;
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3588
#include <iostream>
#include <set>

using namespace std;

bool ok(int N, const set<int> &D)
{
	for (; N != 0; N /= 10) {
		if (D.count(N % 10)) {
			return false;
		}
	}
	return true;
}

int main()
{
	int N, K;
	cin >> N >> K;
	set<int> D;
	for (int i = 0; i < K; ++i) {
		int x;
		cin >> x;
		D.insert(x);
	}
	for (; !ok(N, D); ++N);
	cout << N << endl;
}


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

int main() {
  int n; cin >> n;
  vector<vector<int>> a(9, vector<int>(9, 0));
  for(int i = 1; i < n + 1; i++){
    int mat = i % 10; mat--;
    if(mat < 0) continue;
    int sen = i;
    while(sen / 10 != 0) sen /= 10;
    sen--;
 //   cout << mat << " " << sen;
    if(mat == sen) a.at(mat).at(sen)++;
    if(mat != sen){
      a.at(sen).at(mat)++;
    }
  }
  long long out = 0;
  for(int i = 0; i < 9; i++){
    for(int j = i + 1; j < 9; j++){
      out += 2 * a.at(i).at(j) * a.at(j).at(i);
    //  cout << out << endl;
    }
  }
  for(int i = 0; i < 9; i++){
    out += a.at(i).at(i) * a.at(i).at(i);
  }
  cout << out;
/*  for(int i = 0; i < 9; i++){
    for(int j = i; j < 9; j++){
      cout << a.at(i).at(j) << " " << a.at(j).at(i) << endl;
    }
  }*/
}


Measured memory_bytes: 256
def main():
    n,m=map(int,input().split())
    a=[0]*m
    c=[0]*m
    INF=10**9
    dp=[INF]*2**n
    for i in range(m):
        a[i]=int(input().split()[0])
        c[i]=sum([1<<(int(i)-1) for i in input().split()])
    dp[0]=0
    for i in range(2**n):
        for cos,pat in zip(a,c):
            npat=i|pat
            if dp[npat]>cos+dp[i]:
                dp[npat]=cos+dp[i]
    if dp[2**n-1]==INF:
        print(-1)
    else:
        print(dp[2**n-1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
#include <iostream>
#include <string.h>
using namespace std;
char A[15];
int  main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>A;
    int t=strlen(A);
    if(t%2!=0) cout<<"No"<<endl;
    else{
        int flag=0;
        for(int i=0;i<t;i+=2){
            if(A[i]=='h'&&A[i+1]=='i') continue;
            else flag=1;
        }
        if(flag==0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


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

int main(){
    int k;
    int ans;
    ans = 0;
    cin >> k;
    for(int i = 1; i < k+1; i++){
        for(int j = 1; j < k+1; j++){
            for(int l = 1; l < k+1; l++){
                ans += gcd(gcd(i,j),l);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"  << " " << __FILE__ << endl;

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int n,m;
    cin >> n >> m;
    int ans = min(n,m/2);
    n-=ans;
    m-=ans*2;
    ans += m/4;
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
 
 
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const double EPS = 1E-10;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)


//ここから編集

 
ll modPow(ll x, ll n, ll mod = MOD){
    ll res = 1;
    while(n){
        if(n&1) res = (res * x)%mod;
 
        res %= mod;
        x = x * x %mod;
        n >>= 1;
    }
    return res;
}
 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  string s;
  cin >> s;

  bool ok = false;
  for(int i=0; i<s.size(); i++){
    for(int j=i; j<s.size(); j++){

      string t = "";
      for(int k=0; k<i; k++){
        t += s[k];
      }
      for(int k=j; k<s.size(); k++){
        t += s[k];
      }

      if(t == "keyence"){
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}

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

const int MAXN = 50 + 10, P = 1e9 + 7;

int n;
ll k;

struct Matrix {
    int data[MAXN][MAXN];
    Matrix () { memset(data, 0, sizeof data); for (int i = 1; i <= n; ++i) data[i][i] = 1; }
    void init() { memset(data, 0, sizeof data); }
    int* operator [](int a) { return data[a]; }
    int getsum() {
        int ans = 0;
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                ans = (ans + data[i][j] > P) ? ans + data[i][j] - P : ans + data[i][j];
            }
        }
        return ans;
    }
    Matrix operator *(Matrix b) {
        Matrix res;
        res.init();
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                for (int k = 1; k <= n; ++k) {
                    res[i][j] = (res[i][j] + (1ll * data[i][k] * b[k][j]) % P) % P;
                }
            }
        }
        return res;
    }
};

Matrix qpower(Matrix a, ll x) {
    Matrix res;
    for (; x; x >>= 1, a = a * a) x & 1 ? res = res * a : a;
    return res;
}

int main() {
    scanf("%d %lld", &n, &k);
    Matrix test;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            scanf("%d", &test[i][j]);
        }
    }
    printf("%d\n", qpower(test, k).getsum());
    return 0;
}

Measured memory_bytes: 384
n = int(input())
a = list(map(int, input().split(' ')))
result = 0
counter = 0
if a[0] == 0:
    counter += 1
    result += 1
else:
    counter += a[0]

for i in range(1, n):
    if counter < 0:
        counter += a[i]
        if counter == 0:
            counter += 1
            result +=1
        elif counter > 0:
            continue
        else:
            result += 1-counter
            counter = 1
    else:
        counter += a[i]
        if counter == 0:
            counter -= 1
            result += 1
        elif counter < 0:
            continue
        else:
            result += counter+1
            counter = -1
out = []
out.append(result)
result = 0
counter = 0
if a[0] == 0:
    counter -= 1
    result +=1
elif a[0]< 0:
    counter += 1
    result += 1-a[0]
else:
    counter -= 1
    result += 1+a[0]

for i in range(1, n):
    if counter < 0:
        counter += a[i]
        if counter == 0:
            counter += 1
            result += 1
        elif counter > 0:
            continue
        else:
            result += 1-counter
            counter = 1
    else:
        counter += a[i]
        if counter == 0:
            counter -= 1
            result +=1
        elif counter < 0:
            continue
        else:
            result += counter+1
            counter = -1
out.append(result)
print(min(out))

Measured memory_bytes: 14332
#include<cstdio>
#include<cstring>
#define MAXN 8+5
int ans=0,n,m;
bool graph[MAXN][MAXN];
//graph邻接矩阵存放图形
bool vis[MAXN];//vis[i]标志i这个点是否被访问过 

void visit(int x,int step){//step当前这条路径访问了多少个点 
	if(step>=n){
		ans++;
	}
	else 
		for(int i=1;i<=n;i++){
			if(graph[x][i]&&!vis[i]){//i与x相连，并且i没有被访问过 
				vis[i]=1,step++;
				visit(i,step);
				vis[i]=0,step--;
			}
		}
} 

int main(){
	int x,y;
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d %d",&x,&y);
		graph[x][y]=1,graph[y][x]=1;
		//1表示两点之间有边 
	}
	
	vis[1]=1;
	visit(1,1);//最开始访问第一个点 
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128