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

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

    int a, b;
    cin >> a >> b;
    if ((a * b) % 2 == 0) {
        cout << "Even";
    } else {
        cout << "Odd";
    }
}

Measured memory_bytes: 256
#include <iostream>

int main() {
  // 入力
  int num;
  std::cin >> num;

  // 良い整数判定
  int thousands_place = num / 1000;
  int hundreds_place = num % 1000 / 100;
  int tens_place = num % 100 / 10;
  int ones_place = num % 10;
  std::string is_good_integer;
  if ((thousands_place == hundreds_place && hundreds_place == tens_place) || 
    (hundreds_place == tens_place && tens_place == ones_place)) {
      is_good_integer = "Yes";
  } else {
    is_good_integer = "No";
  }

  // 出力
  std::cout << is_good_integer << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm> //sort,二分探査など
//#include<bitset>
//#include<cmath>//pow,logなど
//#include<deque>
//#include<functional>
//#include<iterator>
//#include<map>
//#include<numeric>//gcd,lcm
//#include<queue>
//#include<set>
//#include<stack>
//#include<string>
//#include<utility>//pair

//QCFium法
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

//浮動小数点処理高速化
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
using i64 = int64_t;
using f80 = __float80;
using u64 = uint_fast64_t;

constexpr i64 INF = 1010000000000000017LL;
constexpr u64 MOD = 1000000007LL;
constexpr f80 PI = 3.14159265358979323846;

#define _overload3(_1, _2, _3, name, ...) name
#define repi(i, start, end) for (int i = (int)(start); i < (int)(end); ++i)
#define _rep(i, n) repi(i, 0, n)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(i, start, end) for (int i = (int)(start); i > (int)(end); --i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()

#define v(T) vector<T>
#define vv(T) v(v(T))
#define vvv(T) v(v(v(T)))
typedef v(int) vi;

#define show(x) cout << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>

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

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
  rep(i, v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v)
{
  for (T &in : v)
    is >> in;
  return is;
}

i64 pow_mod(i64 a, i64 b, i64 m)
{
  i64 ret = 1;
  while (b > 0)
  {
    if (b & 1)
    {
      ret = ret * a % m;
    }
    a = a * a % m;
    b >>= 1;
  }
  return ret;
}

//sort(rng(P),[](const vi &a, const vi &b){return a[1]<b[1];});

void Main()
{
  int S;
  cin >> S;
  S -= 3;

  i64 ans = 0;
  int i = 0;

  v(i64) f(2001, 1);
  rep(i, 1, 2001)
  {
    f[i] = f[i - 1] * i;
    f[i] %= MOD;
  }

  while (S >= 0)
  {
    i64 x = f[S+i];
    x *= pow_mod(f[i], MOD - 2, MOD);
    x %= MOD;
    x *= pow_mod(f[S], MOD - 2, MOD);
    x %= MOD;
    ans += x;
    ans %= MOD;

    S -= 3;
    i += 1;
  }
  cout << ans << "\n";
}

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

Measured memory_bytes: 3644
#-------------------------------------------------------------------
import sys
def p(*a):
  s=" ".join(map(str,a))
  #print(s)
  sys.stderr.write(s+"\n")
#-------------------------------------------------------------------

N, K = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

Cnt=[0]*(N+1)
A=[0]*(N+1)

for iDice in range(1,N+1):
	i=0
	while iDice * (2**i) < K:
		i+=1
	
	Cnt[iDice]=i
	A[iDice]=((1/2)**i)/N

print(sum(A))


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

int main()
{
   int N;
   cin >> N;
   vector<string> r_card(N);
   for (int i = 0; i < N; i++)
   {
      cin >> r_card.at(i);
   }
   
   int M;
   cin >> M;
   vector<string> b_card(M);
   for (int i = 0; i < M; i++)
   {
      cin >> b_card.at(i);
   }


   int ppoint = 0;
   int tmp = 0;
   for (int i = 0; i < N; i++)
   {
      for (int j = 0; j < N; j++)
      {
         if (r_card.at(i)==r_card.at(j))
         {
            tmp++;
         }
      }
      for (int j = 0; j < M; j++)
      {
         if (r_card.at(i)==b_card.at(j))
         {
            tmp--;
         }
      }
      ppoint < tmp ? ppoint = tmp : ppoint = ppoint;
      tmp = 0;
   }
   
   cout << ppoint << endl;
}

Measured memory_bytes: 256
N = int(input())
A = [int(n) for n in input().split(' ')]
boss = {}
for i in range(N-1):
  try:
    boss[A[i]] += 1
  except:
    boss[A[i]] = 1
    
for i in range(1, N+1):
  try:
    print(boss[i])
  except:
    print(0)

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

#include <cstdio>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define swap(a, b, type) { type _tmp = a; a = b; b = _tmp; }
typedef long long ll;
typedef unsigned long long ull;

#define MOD (998244353)
int cnt[100001] = { 0 };

int main()
{
	int N, D, maxi = 0, maxD = 0;
	bool OK = true;
	ll ans = 1;

	cin >> N;
	rep(i, N) {
		cin >> D;
		if (i == 0 && D != 0) OK = false;

		cnt[D]++;

		if (maxD < D) {
			maxi = i;
			maxD = D;
		}
	}

	repc(i, 1, maxD) {
		if (cnt[i] == 0) OK = false;
	}
	if (cnt[0] != 1) OK = false;
	if (!OK) {
		cout << 0 << endl;
		return 0;
	}

	repc(i, 2, maxD) {
		rep(j, cnt[i]) {
			ans = (ans * cnt[i - 1]) % MOD;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <math.h>
#include <vector>

using namespace std;

void Print(int wide, int height);

void Print(int wide, int height)
{
	for(int h = 0; h < height; h++){
		for(int w = 0; w < wide; w++){
			if(h % 2 == 0 && w % 2 == 0){
				cout << "#";
			} else if( h % 2 != 0 && w % 2 != 0){
				cout << "#";
			} else{
				cout << ".";
			}
		}
		cout << endl;
	}
}

int main(){
	int w, h;
	vector<int> wide;
	vector<int> height;
	
	wide.clear();
	height.clear();
	while(1){
		cin >> h;
		cin >> w;
		if(h == 0 && w == 0)	break;
		height.push_back(h);
		wide.push_back(w);
	}
	
	for(int i = 0; i < height.size(); i++){
		Print(wide[i], height[i]);
		cout << endl;
	}
	
}

Measured memory_bytes: 1212
import kotlin.math.abs
import kotlin.math.pow

fun main() {
    println(solve())
}

val solve: () -> Any = {
    val N = readInt()
    val A = readLongList()
    var res = 0

    val L = A
        .withIndex()
        .map { (i, v) -> i - v }
        .groupingBy { it }
        .eachCount()

    val R = A
        .withIndex()
        .map { (i, v) -> i + v }
        .groupingBy { it }
        .eachCount()

    L.map { (k, v) -> v.toLong() * (R[k] ?: 0) }.sum()
}

val mod: Int = 1_000_000_007

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

fun <T> T.alsoPrintln() = also { println(this) }

fun Boolean.toYesOrNo(yes: String = "Yes", no: String = "No") = if (this) yes else no

Measured memory_bytes: 110796
import collections
N = int(input())
ai = list(map(int, input().split()))
c = collections.Counter(ai)
# print(c)
val=0
for i in c.values():
    val+=i*(i-1)//2

for i in range(len(ai)):
    b=c[ai[i]]
    print(val-b+1)

Measured memory_bytes: 26780
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;
int main(int argc, char const *argv[])
{
    unsigned int A, B; cin >> A >> B;

    if((A+B)%2 == 0)
        cout << (A+B)/2 << endl;
    else
        cout << "IMPOSSIBLE" << endl;


    return 0;
}


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

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll gcd(ll a,ll b){
  while(b!=0){
    a%=b;
    swap(a,b);
  }
  return a;
}

ll kaizyou(ll N){
  ll num=1;
  for(ll i=1;i<=N;i++){
  num*=i;
  }
  return num;
}

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

ll mod=1e9+7;

int main(){
  vector<vector<int>>A(3,vector<int>(3));
  rep(i,3){
    rep(j,3){
      cin >> A[i][j];
    }
  }
  int N;
  cin >> N;
  vector<int>b(N);
  rep(i,N){
    cin >> b[i];
  }
  rep(i,N){
    rep(j,3){
      rep(k,3){
        if(A[j][k]==b[i]){
          A[j][k]=0;
        }
      }
    }
  }
  if(A[0][0]==0&&A[0][1]==0&&A[0][2]==0){
    cout << "Yes" << endl;
    return 0;
  }
  if(A[0][0]==0&&A[1][1]==0&&A[2][2]==0){
    cout << "Yes" << endl;
    return 0;
  }
  if(A[0][0]==0&&A[1][0]==0&&A[2][0]==0){
    cout << "Yes" << endl;
    return 0;
  }
  if(A[0][1]==0&&A[1][1]==0&&A[2][1]==0){
    cout << "Yes" << endl;
    return 0;
  }
  if(A[0][2]==0&&A[1][2]==0&&A[2][2]==0){
    cout << "Yes" << endl;
    return 0;
  }
  if(A[2][0]==0&&A[1][1]==0&&A[0][2]==0){
    cout << "Yes" << endl;
    return 0;
  }
  if(A[1][0]==0&&A[1][1]==0&&A[1][2]==0){
    cout << "Yes" << endl;
    return 0;
  }
  if(A[2][0]==0&&A[2][1]==0&&A[2][2]==0){
    cout << "Yes" << endl;
    return 0;
  }
  else{
    cout << "No" << endl;
  }
}
      
  
  
  

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

typedef long long ll;

#define MIN(a, b) ((a) < (b) ? (a) : (b))

int main()
{
	ll x, k, d;
	scanf("%lld %lld %lld", &x, &k, &d);

	x = llabs(x); // x >= 0として良い
	ll r = x / d;
	ll q = x % d;
	ll ans;
	if (x / d >= k)
	{ // 0を越えない
		ans = (x - k * d);
	}
	else
	{
		if ((k - r) % 2 == 0)
		{
			ans = q;
		}
		else
		{
			ans = (d - q);
		}
	}
	printf("%lld", ans);

	return 0;
}

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

struct grid {
    int x;
    int y;
};

array<grid, 4> dir4 { { { 1, 0 }, { 0, 1 }, { -1, 0 }, { 0, -1 } } };

struct maze_grid {
    grid g;
    int cost;
};

void main_()
{
    ll H, W;
    cin >> H >> W;
    vector<string> sss;
    sss.emplace_back(W + 2, '#');
    for (ll i = 0; i < H; ++i) {
        string s;
        cin >> s;
        sss.push_back('#' + s + '#');
    }
    sss.emplace_back(W + 2, '#');

    ll empty_grid_count = 0;
    for (auto&& s : sss) {
        empty_grid_count += count(begin(s), end(s), '.');
    }

    queue<maze_grid> que;
    que.push({ { 1, 1 }, 0 });
    sss[1][1] = 'q';

    ll goal_cost = 0;
    while (!que.empty()) {
        auto m = que.front();
        que.pop();

        sss[m.g.y][m.g.x] = '*';
        if (m.g.y == H && m.g.x == W) {
            goal_cost = m.cost;
            break;
        }

        for (auto&& d : dir4) {
            int nx = m.g.x + d.x;
            int ny = m.g.y + d.y;
            if (sss[ny][nx] == '.') {
                que.push({ { nx, ny }, m.cost + 1 });
                sss[ny][nx] = 'q';
            }
        }
    }

    ll ans = (goal_cost > 0) ? empty_grid_count - goal_cost - 1 : -1;
    cout << ans << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0; i<(int)(n); ++i)
#define REP(i,m,n) for(ll i=(ll)(m); i<(ll)(n); ++i)
#define F first
#define S second
const double PI=acos(-1);
//fixed<<setprecision(11)<<

int main(){
  vector<vector<int>> a(3, vector<int>(3));
  rep(i, 3){
    rep(j, 3)
    cin >> a[i][j];
  }
  int n;
  cin >> n;
  vector<int> b(n);
  rep(i, n) cin >> b[i];

  rep(k, n){
    rep(i, 3){
      rep(j, 3)
      if(a[i][j] == b[k]) a[i][j] = 0;
    }
  }

  if(a[0][0] == 0 && a[1][0] == 0 && a[2][0] == 0){
    cout << "Yes" << endl;
    return 0;
  }
  else if(a[0][1] == 0 && a[1][1] == 0 && a[2][1] == 0){
    cout << "Yes" << endl;
    return 0;
  }
  else if(a[0][2] == 0 && a[1][2] == 0 && a[2][2] == 0){
    cout << "Yes" << endl;
    return 0;
  }
  else if(a[0][0] == 0 && a[0][1] == 0 && a[0][2] == 0){
    cout << "Yes" << endl;
    return 0;
  }
  else if(a[1][0] == 0 && a[1][1] == 0 && a[1][2] == 0){
    cout << "Yes" << endl;
    return 0;
  }else if(a[2][0] == 0 && a[2][1] == 0 && a[2][2] == 0){
    cout << "Yes" << endl;
    return 0;
  }
  else if(a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0){
    cout << "Yes" << endl;
    return 0;
  }
  else if(a[2][0] == 0 && a[1][1] == 0 && a[0][2] == 0){
    cout << "Yes" << endl;
    return 0;
  }
  else cout << "No" << endl;
return 0;
}

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

map<int, int64_t> dp[200010][2];
const int64_t INF = 1e18;
int main() {
	int n; cin >> n;
	int64_t a[n]; for(int i = 0; i < n; ++i) cin >> a[i];
	for(int i = 0; i <= n; ++i) {
		for(int j = 0; j < 2; ++j) {
			for(int k = (i - 1) / 2; k <= (i + 1) / 2; ++k) {
				dp[i][j][k] = -INF;
			}
		}
	}
	dp[0][0][0] = 0;
	for(int i = 0; i < n; ++i) {
		for(int k = (i - 1) / 2; k <= (i + 1) / 2; ++k) {
			dp[i + 1][1][k + 1] = max(dp[i + 1][1][k + 1], dp[i][0][k] + a[i]);
			dp[i + 1][0][k] = max(dp[i + 1][0][k], dp[i][0][k]);
			dp[i + 1][0][k] = max(dp[i + 1][0][k], dp[i][1][k]);
		}
	}
	cout << max(dp[n][0][n / 2], dp[n][1][n / 2]) << '\n';
	return 0;
}

Measured memory_bytes: 86448
#include<iostream>
#include<string>
typedef long long INT;


int main(){
    INT N;

    std::cin >> N;

    INT hyaku = N % 100;
    INT juu = hyaku % 10;

    std::string out ;

    switch(juu){
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
        out = "hon";
        break;
    case 0:
    case 1:
    case 6:
    case 8:
        out= "pon";
        break;
    default :
        out = "bon";
        break;
    }

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

Measured memory_bytes: 3596
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll a,b;
  cin >> a >> b;
  if(a<=5) b = 0;
  else if(a<=12) b = b/2;
  cout << b << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.io.*;

public class Main{
	public static int judge(double[] x, double[] y, double[] p){
		double a = 0;
		if( x[0] != y[0] ){
			a = ((y[1]-x[1])/(y[0]-x[0]))*(p[0]-x[0])+x[1];
		}
		if( x[0] == y[0] ){
			if( p[0] < x[0] ){
				return -1;
			} else {
				return 1;
			}
		}
		if( a < p[1] ){
			return 1;
		} else {
			return -1;
		}
	}
		
	public static String solve(double[][] x, double[] p){
		for(int i = 0; i < 3; i++){
			int max = i;
			for(int j = i+1; j < 3; j++){
				if( x[j][0] > x[max][0] || ( x[j][0] == x[max][0] && x[j][1] < x[max][1] ) ){
					max = j;
				}
			}
			double tempX = x[max][0];
			double tempY = x[max][1];
			x[max][0] = x[i][0];
			x[max][1] = x[i][1];
			x[i][0] = tempX;
			x[i][1] = tempY;
		}
		if( p[0] > x[0][0] || p[0] < x[2][0] ){
				return "NO";
		}
		int key = judge(x[0], x[2], p);
		if( key*judge(x[0], x[1], p) < 0 && key*judge(x[1], x[2], p) < 0 ){
			return "YES";
		} else {
			return "NO";
		}
	}
	
	public static void main(String[] args) throws IOException{
		Scanner stdIn = null;
		int index = 0;
		
		try{
			stdIn = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
			double[][] x = new double[3][2];
			double[] p = new double[2];
			String[] result = new String[100];
			
			while( stdIn.hasNext() ){
				if( stdIn.hasNextDouble() ){
					for(int i = 0; i < 3; i++){
						for(int j = 0; j < 2; j++){
							x[i][j] = stdIn.nextDouble();
						}
					}
					p[0] = stdIn.nextDouble();
					p[1] = stdIn.nextDouble();
					result[index] = solve(x,p);
					index++;
				} else {
					stdIn.next();
				}
			}
			
			for(int i = 0; i < index; i++){
				System.out.println(result[i]);
			}
		} finally {
			if( stdIn != null ){
				stdIn.close();
			}
		}
	}
}

Measured memory_bytes: 12000
import sys
sys.setrecursionlimit(500000)

def dfs(i):
    global visited,neighbor
    visited[i] = 1
    for j in [k for k in range(N) if neighbor[i][k]==1]:
        if visited[j] == 1:
            continue
        dfs(j)


N,M = map(int,input().split())
ab = []
ans = 0
for i in range(M):
    a,b = map(int,input().split())
    ab.append([a-1,b-1])

neighbor = [[0 for i in range(N)] for j in range(N)]
for i in range(M):
    neighbor[ab[i][0]][ab[i][1]] = 1
    neighbor[ab[i][1]][ab[i][0]] = 1
for i in range(M):
    neighbor[ab[i][0]][ab[i][1]] = 0
    neighbor[ab[i][1]][ab[i][0]] = 0
    visited = [0 for i in range(N)]
    dfs(0)
    neighbor[ab[i][0]][ab[i][1]] = 1
    neighbor[ab[i][1]][ab[i][0]] = 1
    if sum(visited) != N:
        ans += 1
print(ans)


Measured memory_bytes: 43356
/* include c++ libraries */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <queue>
#include <set>

/* include c-lang libraries */
#include <climits>
#include <cmath>

/* include my libraries */
//#include <show_vec.hh>

using namespace std;

#define LINE DEBUG{ printf("LINE : %d\n", __LINE__); }
#define DEBUG if(false)

using ll = long long;
template<class T> using vec = vector<T>;

const int MOD = 1000000007;

int main(){
  int N;
  cin >> N;
  vec<int> A(N+1, 0);
  int t;
  for(int i = 0; i < N-1; i++){
    cin >> t;
    A[t]++;
  }
  for(int i = 1; i <= N; i++){
    cout << A[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 4028
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
const int mod = 1e9 + 7;

int main() {
    int N;
    cin >> N;

    map<string,int> m;
    string S[N];
    int mx = 0;
    for(ll i = 0; i < N; ++i) cin >> S[i];

    for(int i = 0; i < N; ++i){
        //key add
        if(m.count(S[i]) == 0) m.insert(make_pair(S[i],1));
        //value++
        else m[S[i]] = ++m[S[i]];
        //max count
        mx = max(mx, m[S[i]]);
    }

    if(mx > 1) cout << "NO" << endl;
    else cout << "YES" << endl;

}


Measured memory_bytes: 26368
#include <bits/stdc++.h>
     
#define pll pair <long long,long long>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define vll vector <ll>
#define NFS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define M 1000000007   
using namespace std;

void solve()
{
	int n;
	cin>>n;
	map<string,int> mp;
	for(int i=0;i<n;i++)
	{
		string s;
		cin>>s;
		mp[s]++;
	}
	cout<<mp.size();
}
 
int main()
{
    NFS
 	int t=1;
 	//cin>>t;
 	while(t--)
 	{
 		solve();
 	}
    return 0;
}

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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


int main()
{
  string s;
  string t = "keyence";
  cin >> s;
  forll(i, 0, s.size() + 1){
	if (s.substr(0, i) == t.substr(0, i) && s.substr(s.size()-t.size()+i) == t.substr(i)){
	  cout << "YES" << endl;
	  return 0;
	}
  }
  cout << "NO" << endl;
}


Measured memory_bytes: 256
while True:
	nums = list(map(int, input().split(" ")))
	h = nums[0]
	w = nums[1]
	if h == 0 and w == 0:
		break

	for i in range(h):
		for j in range(w):
			if (i + j) % 2 == 0:
				print("#", end="")
			else:
				print(".", end="")
		print("")
	
	print("")


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

const long long MOD = 2;

void solve(long long N, long long P, std::vector<long long> A) {
	int one  = 0;
  long long tmp = 0;
  for(int i  =0 ;i<N;i++)if(A[i]%2)one = 1;
     if(one == 0){
		if(P == 1)tmp = 0;
       else tmp = 1ll<<N;
     }
      else tmp = 1ll<<N-1;
  cout<<tmp<<'\n';
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
  long long N;
  scanf("%lld", &N);
  long long P;
  scanf("%lld", &P);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, P, std::move(A));
  return 0;
}


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

#define int long long
#define endl '\n'

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n, x, y; cin >> n >> x >> y;
    vector<int> ans(n, 0);
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            int dist = min(j - i, 1 + min(abs(i - x) + abs(j - y), abs(i - y) + abs(j - x)));
            ans[dist]++;
        }
    }
    for (int k = 1; k < n; k++)
        cout << ans[k] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

int main(){
	int x, y, s;
	while(cin >> x >> y >> s, x||y||s){
		int maxi = 0;
		for(int i = 1; i < s; i+=1){
			range(j,1,s){
				if(i * (100 + x) / 100 + j * (100 + x) / 100 == s){
					maxi = max(maxi, i * (100 + y) / 100 + j * (100 + y) / 100);
				}
			}
		}
		cout << maxi << endl;
	}
}



Measured memory_bytes: 3080
package main

import "fmt"

func main() {
	arr := make([]int, 5)
	for i := 0; i < 5; i++ {

		if _, err := fmt.Scan(&arr[i]); err != nil {
			panic(err)
		}
	}

	replaced := 0

	for i := 0; i < 5; i++ {
		if arr[i] == 0 {
			replaced = i + 1
			break
		}
	}
	fmt.Print(replaced)
}


Measured memory_bytes: 1768
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
#define SIZE 131072
class BIT
{
public:
	ll bit[SIZE + 1];
	void init()
	{
		fill(bit, bit + SIZE + 1, 0);
	}
	void add(int a, ll b)
	{
		a++;
		for (;;)
		{
			bit[a] += b;
			a += a&-a;
			if (a > SIZE)return;
		}
	}
	ll get(int a)
	{
		a++;
		ll ret = 0;
		for (;;)
		{
			ret += bit[a];
			a -= a&-a;
			if (a == 0)return ret;
		}
	}
};
BIT bi;
typedef pair<double, double>pdd;
typedef pair<double, int>pdi;
pdd d[100000];
int num;
double calc()
{
	//for (int i = 0; i < num; i++)printf("y = %lf x + %lf\n", d[i].first, d[i].second);
	double beg = -1000000000.0, end = 1000000000.0;
	for (int p = 0; p < 100; p++)
	{
		double med = (beg + end) / 2;
		vector<pdi>vec;
		for (int i = 0; i < num; i++)vec.push_back(make_pair(med*d[i].first + d[i].second, i));
		sort(vec.begin(), vec.end());
		bi.init();
		ll r = 0;
		for (int i = 0; i < num; i++)
		{
			r += i - bi.get(vec[i].second);
			bi.add(vec[i].second, 1);
		}
		if (r + r >= (ll)(num)*(ll)(num - 1) / 2)end = med;
		else beg = med;
	}
	return beg;
}
int main()
{
	scanf("%d", &num);
	for (int i = 0; i < num; i++)
	{
		double za, zb, zc;
		scanf("%lf%lf%lf", &za, &zb, &zc);
		d[i] = make_pair(-za / zb, zc / zb);
	}
	sort(d, d + num);
	reverse(d, d + num);
	double a = calc();
	for (int i = 0; i < num; i++)d[i] = make_pair(1.0 / d[i].first, -d[i].second / d[i].first);
	sort(d, d + num);
	reverse(d, d + num);
	double b = calc();
	printf("%.20lf %.20lf\n", a, b);
}

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

vector<int> degrees;
vector<int> fa;
map<int, vector<int>> mp;

int main() {
    int n, m;
    cin >> n >> m;
    degrees.resize(n + 1, 0);
    fa.resize(n + 1, 0);

    for (int i = 0; i < n + m - 1; i++) {
        int x, y;
        cin >> x >> y;
        mp[x].push_back(y);
        degrees[y]++;
    }
    queue<int> q;
    for (int i = 1; i <= n; i++) {
        if (degrees[i] == 0) {
            q.push(i);
            break;
        }
    }
    while (q.size()) {
        int top = q.front();
        q.pop();
        vector<int>& t = mp[top];
        for (int k : t) {
            degrees[k]--;
            if (degrees[k] == 0) {
                fa[k] = top;
                q.push(k);
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        cout << fa[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 12544
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

#define all(v) (v).begin(),(v).end()

using namespace std ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;




int main()
{
  int n ;
  cin >> n ;
  
  if(n%2==0){
    cout <<n*n/4<<endl ;
  }
  else{
    cout <<(n/2)*(n/2+1)<<endl ;
  }
    return 0 ;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    int count=0;
    for(int i=0;i<3;i++){
      if(a.charAt(i)==b.charAt(i)){
        count++;
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 23892
#include <iostream>

using namespace std;

int main()
{
    int k, s;
    cin >> k >> s;
    int ans = 0;
    for (int x = 0; x <= k; ++x) {
        for (int y = 0; y <= k; ++y) {
            int z =  s - x - y;
            if (z >= 0 && z <= k) ++ans;
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
  int N,X;
  cin >> N >> X;
  vector<int>vec;
  int sum = 0;
  for(int i = 0 ; i < N ; i++){
    int m; cin >> m;
    vec.push_back(m);
    sum += m;
  }
  sort(vec.begin(),vec.end());
  X -= sum;
  cout << N + X/vec[0] << endl;
  return 0;
}


Measured memory_bytes: 256
import itertools

n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))


a=list(itertools.permutations(range(1,n+1)))

for x in range(len(a)):
  if a[x]==p:
    g=x
  if a[x]==q:
    f=x

print(abs(g-f))

Measured memory_bytes: 13804
#include <iostream>
#include <vector>

using namespace std;

int main() {
	vector< vector<long int> > a, b, c;
	int n, m, l;

	cin >> n >> m >> l;

	a.resize(n);
	b.resize(m);

	for (int i = 0; i < n; ++i) {
		a[i].resize(m);
		for (int j = 0; j < m; ++j) {
			cin >> a[i][j];
		}
	}

	for (int i = 0; i < m; ++i) {
		b[i].resize(l);
		for (int j = 0; j < l; ++j) {
			cin >> b[i][j];
		}
	}

	c.resize(n);
	for (int i = 0; i < n; ++i) {
		c[i].resize(l);
		for (int j = 0; j < l; ++j) {
			for (int k = 0; k < m; ++k) {
				c[i][j] += a[i][k] * b[k][j];
			}
		}
	}
	int k;

	for (auto i : c) {
		k = 0;
		for (auto j : i) {
			cout << j;
			++k;
			if (k < l) {
				cout << " ";
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3280
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
 
#define rep for(int i = 0;i<n;i++)
const long long MOD = 1000000007;

int main(){
  int n;cin >> n;
  int k;cin >> k;
  int h[n];rep{
    cin >> h[i];
  }
  int ans = 0;
  rep{
    if(h[i]>=k) ans += 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
from collections import Counter
N, K = map(int,input().split())
A = list(map(int,input().split()))
CA = Counter(A)
values, counts = zip(*CA.most_common())
counts = counts[::-1]
LA = len(CA)
L = max(LA - K,0)
ans = 0
for i in range(L):
    ans += counts[i]
print(ans)

Measured memory_bytes: 53528
import java.util.Scanner;

public class Main {
	
	public static int max(int A, int B) {
		int ans = A;

		if (B > ans) {
			ans = B;
			B--;
		} else {
			A--;
		}

		if (A >= B) {
			ans += A;
		} else {
			ans += B;
		}
		return ans;
	}
	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		int ans = max(A, B);
		System.out.println(ans);
		scanner.close();
	}
}


Measured memory_bytes: 21844
#include <stdio.h>

char s[222222];

int main(void) {
	int i, A = -1, Z = -1;
	if (scanf("%222221s", s) != 1) return 1;
	for (i = 0; s[i] != '\0'; i++) {
		if (A < 0 && s[i] == 'A') A = i;
		if (s[i] == 'Z') Z = i;
	}
	printf("%d\n", Z - A + 1);
	return 0;
}


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

Measured memory_bytes: 580
#include<cstdio>
#include<iostream>
#include<vector>
#include<set>
#include<queue>
#include<algorithm>
#include<utility>
#include<cmath>
#define pb push_back
#define ll long long
#define inf 1000000009
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<ll> b;
	b.pb(inf);
	for(int i=0;i<n-1;i++){
		ll x;
		cin>>x;
		b.pb(x);
	}
	b.pb(inf);
	ll ans = 0;
	for(int i=0;i<n;i++){
		ans += min(b[i],b[i+1]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Set<String> set = new HashSet<>();
        int n = sc.nextInt();
        for(int i=0; i<n; i++) {
            set.add(sc.next());
        }
        System.out.println(set.size());
    }

}

Measured memory_bytes: 78612
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
typedef long long i64;
int main(){
    int N;
    cin >> N;
    if(N<105) cout << 0 << endl;
    else if(N==105) cout << 1 << endl;
    else {
        int count2=1;
        for(int i=107;i<=N;i+=2){
            int count = 0;
            for(int j=1;j<=i;j+=2){
                if(i%j==0) count++;
            }
            if(count==8)count2++;
            count=0;
        }
        cout << count2 << endl;
    }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

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

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int n, m;
long long int fr[110][110] = {};

long long int ans = 0;
vector<int> v;

void func(int pos){
    if(v.size() >= 2){
        long long int S = 0;
        for(int i = 0; i < v.size(); i++){
            long long int num = INF;
            for(int j = 0; j < v.size(); j++){
                if(i == j){
                    continue;
                }
                num = min(num, fr[v[i]][v[j]]);
            }
            S += num;
        }
        ans = max(ans, S);
    }
    for(int i = pos; i <= n; i++){
        long long int cost = INF;
        for(int j = 0; j < v.size(); j++){
            cost = min(cost, fr[i][v[j]]);
        }
        if(cost > 0){
            v.push_back(i);
            func(i + 1);
            v.pop_back();
        }
    }
}

int main(){
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        int u, v, f;
        cin >> u >> v >> f;
        fr[u][v] = f;
        fr[v][u] = f;
    }
    func(1);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3228
//#pragma GCC optimize(2)
// Happy TLE and WA every day!
// by: zxb the vegetable chicken
#include<bits/stdc++.h>
#define mp              make_pair
#define rep(i,n)        for(int i = 0; i < n; i++)
#define foreach(i,c)    for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define BINF            0x7fffffff
#define INF             0x3f3f3f3f
#define LINF            3223372036854775807
#define END(s)          {cout<<s; return 0;}
#define CON(s)          {cout<<s; continue;}
#define BRE(s)          {cout<<s; break;}
#define pb              push_back
#define All(a)          a.begin(), a.end()  //with A in CAPITAL!!!
#define sz(a)           (int)a.size()
#define F               first
#define S               second
#define Time            clock()/CLOCKS_PER_SEC
//#define usingFiles
using namespace std;

typedef unsigned int ui;
typedef pair<int, int> pii;
typedef long long ll;

inline bool Read(int& x){
	x = 0;
	int c;
	int sign = 1;
	while( (c = getchar()) < '0' || c > '9' ) if(c == '-') sign = -1;
	x = c ^ '0';
	while( (c = getchar()) >= '0' && c <= '9' ) x = (x<<3) + (x<<1) + (c ^ '0');
	x *= sign;
	return 1;
}

inline bool Write(int x){
	if(x >= 10) Write(x / 10);
	putchar(x % 10 + '0');
	return 1;
}

const int rp = 666666;
const bool debug = 1;
const bool I_good_vegetable_a = 1;

int n, k;
int a[100100];
int dp[100100];

signed main(){
	ios::sync_with_stdio(false);
	#ifdef usingFiles
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	cin >> n >> k;
	rep(i, n) cin >> a[i];
	memset(dp, 0x3f, sizeof(dp));
	dp[0] = 0;
	rep(i, n){
		for(int j = i; j < i + k + 1; j++){
			dp[j] = min(dp[j], dp[i] + abs(a[i] - a[j]));
		}
	}
	cout << dp[n - 1] << endl;
	return 0;
}

Measured memory_bytes: 1024
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
#include "../debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

using TLL = tuple<ll, ll, ll>;
const ll inf = 5e15;

int main() {
    ll N, Q;
    cin >> N >> Q;
    V<TLL> cons;
    V<ll> D;

    for(ll i = 0; i < N; i++) {
        ll s, t, x;
        cin >> s >> t >> x;
        cons.emplace_back(s - x, t - x, x);
    }

    for(ll i = 0; i < Q; i++) {
        ll d;
        cin >> d;
        D.push_back(d);
        cons.emplace_back(d, inf, inf);
    }

    sort(ALL(cons));
    map<ll, ll> cnt;
    priority_queue<PLL, V<PLL>, greater<PLL>> pq;

    for(const auto ele : cons) {
        ll s, t, x;
        tie(s, t, x) = ele;
        
        while(pq.size()) {
            ll tt, tx;
            tie(tt, tx) = pq.top();
            if(tt > s) break;
            auto ite = cnt.find(tx);
            ite->second--;
            if(ite->second == 0) cnt.erase(ite);
            pq.pop();
        }
        
        if(x == inf) {
            cout << (cnt.empty() ? -1 : cnt.begin()->first) << endl;
        } else {
            pq.emplace(t, x);
            cnt[x]++;
        }
    }

    return 0;
}


Measured memory_bytes: 29288
def main():
  n = int(input())
  hs = [int(i) for i in input().split()]

  a, b = 0, abs(hs[1] - hs[0])

  for i in range(2, n):
    c = hs[i]
    d1 = a + abs(c - hs[i-2])
    d2 = b + abs(c - hs[i-1])
    a, b = b, d1 if d1 <= d2 else d2

  print(b)

if __name__ == "__main__":
  main()


Measured memory_bytes: 13976
h,w = gets.strip.split.map(&:to_i)
data = []
ay = Array.new(w+2,"#")
data << ay.join("").to_s
h.times do
  ax = gets.strip.to_s
  data << "#"+ax+"#"
end
data << ay.join("").to_s
for i in 0..h+1
  puts data[i].to_s
end

Measured memory_bytes: 14260
import sys
from collections import Counter
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    S = [input() for _ in range(n)]
    m = int(input())
    T = [input() for _ in range(m)]

    D_S = Counter(S)
    D_T = Counter(T)
    res = 0
    for k, v in D_S.items():
        cnt = v - D_T.get(k, 0)
        res = max(res, cnt)

    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <cmath>
#include <atcoder/modint>

#include <atcoder/math>
#include <atcoder/fenwicktree>
#include <atcoder/convolution>

#include <cstdio>

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

using namespace std;
typedef long long ll;

using namespace atcoder;

ll mod2 = 998244353;

int main()
{
    ll n, m;
    scanf("%lld %lld", &n, &m);
    vector<ll> A(n);
    vector<ll> B(m);
    vector<ll> C(n+m-1);

    FOR(i, 0, n) {
        scanf("%lld", &A[i]);
    }
    FOR(i, 0, m) {
        scanf("%lld", &B[i]);
    }
    C = convolution(A, B);
    FOR(i, 0, n+m-1) {
        printf("%lld ", C[i]);
    }
    return 0;
}

Measured memory_bytes: 32040
/* Stack */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int top, s[1000];

void push(int x)
{
    top++;
    s[top] = x;
}

int pop()
{
    top--;
    return s[top+1];
}

int main()
{
    int a, b;
    top=0;
    char s[100];
    
    while(scanf("%s", &s) != EOF){
        if(s[0] == '+'){
            a = pop();
            b = pop();
            push(a+b);
        } else if(s[0] == '-'){
            a = pop();
            b = pop();
            push(b-a);
        } else if(s[0] == '*'){
            a = pop();
            b = pop();
            push(a*b);
        } else{
            push(atoi(s));
        }
    }
    printf("%d\n", pop());
    return 0;
}


Measured memory_bytes: 2040
def main():
    H, N, *AB = map(int, open(0).read().split())
    dp = [-1]*(H + 1)
    dp[0] = 0
    for i in range(N):
        a = AB[2 * i + 0]
        b = AB[2 * i + 1]
        for i in range(H + 1):
            d = dp[i] + b
            if dp[i] != -1:
                j = i + a
                j = min(j, H)
                if dp[j] == -1 or d < dp[j]:
                    dp[j] = d
    print(dp[H])

if __name__ == '__main__':
    main()


Measured memory_bytes: 41072
# include "cstdio"
# include "algorithm"
# include "iostream"

using namespace std;

const int maxm=1e5+10;

int N,M,X[maxm];
long long A[maxm];

int main(){
	register int i;
	register long long Ans;
	scanf("%d%d",&N,&M);
	for(i=1;i<=M;i++) scanf("%d",X+i);
	sort(X+1,X+1+M);
	Ans=X[M]-X[1];
	for(i=1;i<M;i++) A[i]=X[i+1]-X[i];
	sort(A+1,A+M);
	reverse(A+1,A+M);
	for(i=1;i<N;i++) Ans-=A[i];
	printf("%lld",Ans);
	return 0;
}

Measured memory_bytes: 1408
/* Simplicity and Goodness */

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B)
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int N = 3e3+2;

/* Consider all partitions : 1 | 2 | 5 |, There are 3 partitions available
 */
void solve()
{
    string s;
    cin >> s;

    int n_o_d = (int) s.size() - 1;
        
    ll sum = 0;
    
    for(ll i = 0; i < (1LL << n_o_d); i ++) {
        set<int> here;
        rep(j, 0, n_o_d) {
            if(i & (1LL << j))
                here.insert(j);
        }
        
        ll mul = 1;
        
        for(ll j = (int) s.size() - 1; j >= 0; j --) {
            if(here.count(j)) {
                mul = 1;
                ll dg = s[j] - '0';
                ll val = mul * dg; sum += val;
                mul *= 10;
            } else {
                ll dg = s[j] - '0';
                ll val = mul * dg; sum += val;
                mul *= 10;
            }
        }
    }
    
    lprin(sum);
}

int main()
{
    int t = 1;
    // scn(t);
    
    while(t --) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3728
s=input()
ans=len(s)
for i in range(2):
  cnt=0
  for j in range(len(s)):
    if j % 2 == 0 and s[j]!=str(i): cnt+=1
    if j % 2 == 1 and s[j]==str(i): cnt+=1
  ans=min(cnt,ans)
print(ans)

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

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

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

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

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

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

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

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

fn main() {
    input! {
        r : i64,
        d : i64,
        x : i64,
    }
    let mut x = x;
    for _ in 0..10 {
        x = r * x - d;
        println!("{}", x);
    }
}


Measured memory_bytes: 4352
#include <stdio.h>
 
int BinarySearch(int, int, int*);
 
 
main(){
 
  int n,q,i,s;
  int S[1000000];
  int count = 0;
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++)scanf("%d",&S[i]);
 
  scanf("%d",&q);
 
  for(i=0;i<q;i++){
    scanf("%d",&s);
    if(BinarySearch(s,n,S) == 0){
      count++;
    }
  }
 
  printf("%d\n",count);
 
  return 0;
}
 
 
int BinarySearch(int key,int n,int S[]){
 
  int l=0,m,r;
 
  r = n;
 
  while(l < r){
    m = (r + l)/2;  
     
    if(S[m] == key)return 0;
     
    else if(S[m] > key)r = m;
 
    else l = m+1;
  }
 
  return 1;
}


Measured memory_bytes: 2192
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
string divide[4]={"dream","erase","eraser","dreamer"};
string s;
bool DFS(int n){
    if(n==s.size())return true;
    for(string i:divide){
        if(n+i.size()<=s.size()&& s.substr(n,i.size())==i){
            if(DFS(n+i.size()))return true;
        }
    }
    return false;
}
int main(){
    cin>>s;
    if(DFS(0)){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

ll fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/
/*
    cout << fixed << setprecision(15);
*/
int main(){
    ll N;
    cin >> N;
    cout << 24 - N + 24 << endl;
}

Measured memory_bytes: 3604
def examB():
    N = I()
    cur = 1
    for i in range(1,int(N**0.5)+1):
        if N<i**2:
            break
        else:
            cur = i
    ans = cur**2
    print(ans)



import sys,copy,bisect,itertools
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()


Measured memory_bytes: 3428