akhauriyash/Code-Regression huggingface dataset:
/**
 * C - management
 * https://atcoder.jp/contests/abc163/tasks/abc163_c
 */
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    // N 人の社員からなる会社があり、各社員には 1,...,N の社員番号が割り当てられています。
    int N, A;
    cin >> N;

    // 部下の人数を保存する配列
    vector <int> buka(N, 0);
    for (int i = 0; i < N - 1; i++) {
        // i人目の上司番号がAに入る
        cin >> A;
        buka.at(A - 1) += 1;
    }

    for (int i = 0; i < N; i++) {
        cout << buka.at(i) << endl;
    }
}
 

Measured memory_bytes: 4032
import java.util.*;
 
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[]A = new int[N];
    
    double all = 0;
    for(int i=0; i<N; i++){
    A[i] = sc.nextInt();
    all += (double)1/A[i];
    }
        System.out.println(1/all);
}
}

Measured memory_bytes: 36196
#include <iostream>
#include <algorithm>
using namespace std;
int a, b,c;
int solve(int t[92][92], int x, int y, int answer)
{
	t[x][y] = 0;
	if (t[x - 1][y] == 1)
	{
		solve(t, x - 1, y, answer + 1);
	}
	if (t[x + 1][y] == 1)
	{
		solve(t, x + 1, y, answer + 1);
	}
	if (t[x][y - 1] == 1)
	{
		solve(t, x, y - 1, answer + 1);
	} 
	if (t[x][y + 1] == 1)
	{
		solve(t, x, y + 1, answer + 1);
	}
	
	t[x][y] = 1;
	if (t[x - 1][y] + t[x + 1][y] + t[x][y - 1] + t[x][y + 1] == 0)
	{
		if (c < answer + 1)
		{
			c = answer + 1;
		}
	}
	return (0);
}
	
int main()
{
	int t[92][92];
	
	while (cin >> a >> b)
	{c = 0;
		if (a == 0 && b == 0)
		{
			break;
		}
		for (int i = 0; i < a; i++)
		{
			t[i][0] = 0;
			t[i][b + 1] = 0;
		}
		for (int i = 0; i < b; i++)
		{
			t[0][i] = 0;
			t[a + 1][i] = 0;
		}
		for (int i = 0; i < a; i++)
		{
			for (int j = 0; j < b; j++)
			{
				cin >> t[i + 1][j + 1];
			}
		}
		for (int i = 0; i <= a; i++)
		{
			for (int j = 0; j <= b; j++)
			{
				if (t[i][j] == 1)
				{
					int s = 0;
					solve(t, i, j, s);
				}
			}
		}
		cout << c << endl;
	}
	return 0;
}




Measured memory_bytes: 3056
#include<bits/stdc++.h>
#define inf 1000000000
#define pi acos(-1.0)
#define N 200009
#define M 4000009
using namespace std;

int n,trtot,rt,sx,tx,sy,ty,T[M],ls[M],rs[M],dp[N];
struct node{ int x,y; }a[N];
bool cmp(node u,node v){ return u.x<v.x; }
void ins(int &k,int l,int r,int x,int y){
	if (!k) k=++trtot; T[k]=max(T[k],y);
	if (l==r) return;
	int mid=l+(r-l>>1);
	if (x<=mid) ins(ls[k],l,mid,x,y);
		else ins(rs[k],mid+1,r,x,y);
}
int getmax(int &k,int l,int r,int x){
	if (!k) return 0;
	if (r<=x) return T[k];
	int mid=l+(r-l>>1),ans=getmax(ls[k],l,mid,x);
	if (x>mid) ans=max(ans,getmax(rs[k],mid+1,r,x));
	return ans;
}
int main(){
	scanf("%d%d%d%d%d",&sx,&sy,&tx,&ty,&n);
	int i;
	for (i=1; i<=n; i++)
		scanf("%d%d",&a[i].x,&a[i].y);
	if (sx>tx){
		sx=-sx; tx=-tx;
		for (i=1; i<=n; i++) a[i].x=-a[i].x;
	}
	if (sy>ty){
		sy=-sy; ty=-ty;
		for (i=1; i<=n; i++) a[i].y=-a[i].y;
	}
	sort(a+1,a+n+1,cmp);
	int mx=0;
	for (i=1; i<=n; i++) if (sx<=a[i].x && a[i].x<=tx && sy<=a[i].y && a[i].y<=ty){
		dp[i]=getmax(rt,-inf,inf,a[i].y)+1;
		ins(rt,-inf,inf,a[i].y,dp[i]);
		mx=max(mx,dp[i]);
	}
	if (mx==min(tx-sx,ty-sy)+1)
		printf("%.15f\n",100.*(tx+ty-sx-sy)-5*(4-pi)*(mx-1)+10*(pi-2));
	else
		printf("%.15f\n",100.*(tx+ty-sx-sy)-5*(4-pi)*mx);
	return 0;
}


Measured memory_bytes: 33024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define INF 1000000000000000
#define fi first
#define se second
#define all(v) v.begin(),v.end()
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
#define pb push_back
//struct edge{int to,cost;};
struct edge{int u,v,cost;};
typedef pair<int,int> P;
bool comp(const edge& e1,const edge&e2){
	return e1.cost<e2.cost;
}
int n,m;
edge es[222222];
int par[11111],ran[11111];
void init(int n){
	rep(i,n){
		par[i]=i;
		ran[i]=0;
	}
}
int find(int x){
	if(par[x]==x)return x;
	return par[x]=find(par[x]);
}
void unite(int x,int y){
	x=find(x),y=find(y);
	if(x==y)return;
	if(ran[x]<ran[y])par[x]=y;
	else{
		par[y]=x;
		if(ran[x]==ran[y])ran[x]++;
	}
}
bool same(int x,int y){
	return find(x)==find(y);
}
int kruskal(){
	sort(es,es+m,comp);
	init(n);
	int ans=0;
	for(edge e:es){
		if(!same(e.u,e.v)){
			unite(e.u,e.v);
			ans+=e.cost;
		}
	}
	return ans;
}
signed main(){
	cin>>n>>m;
	rep(i,m)cin>>es[i].u>>es[i].v>>es[i].cost;
	cout<<kruskal()<<endl;
	return 0;
}



Measured memory_bytes: 5596
#include<stdio.h>
int main(){
	long m,n,a,b;
	while(scanf("%ld %ld",&m,&n)!=EOF){
		a=m;
		b=n;
		while(m!=n){
			if(m>n)m=m-n;
			else n=n-m;


		}
		printf("%ld %ld\n",n,(a/n)*b);
	}
	return 0;
}

Measured memory_bytes: 0
n = int(input())
a = list(map(int, input().split()))
mod = 998244353
if a[0] != 0:
  print(0)
  exit()
cnt = {}
for e in a:
  cnt[e] = cnt.get(e, 0) + 1
if cnt[0] > 1:
  print(0)
  exit()
d, c = 0, cnt[0]
ans = 1
for k, v in sorted(list(cnt.items())):
  # print(k, v)
  if k == 0:
    continue
  if k > d + 1:
    print(0)
    exit()
  for i in range(v):
    ans = ans * c % mod
  d, c = k, v
print(ans)

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

int main(){
    LL N;
    cin >> N;
    vector<LL> a(N), b(N);
    for(int i = 0;i < N;i++)    cin >> a[i];
    for(int i = 0;i < N;i++)    cin >> b[i];
    LL ans = 0;
    for(int bit = 0;bit < 29;bit++){
        vector<LL> bm(N);
        for(int i = 0;i < N;i++)    bm[i] = b[i]%(1<<(bit+1));
        sort(bm.begin(), bm.end());
        LL count = 0;
        for(int i = 0;i < N;i++){
            LL ami = a[i]%(1<<(bit+1));
            LL x = lower_bound(bm.begin(), bm.end(), 2*(1<<bit)-ami)-lower_bound(bm.begin(), bm.end(), 1*(1<<bit)-ami);
            LL y = lower_bound(bm.begin(), bm.end(), 4*(1<<bit)-ami)-lower_bound(bm.begin(), bm.end(), 3*(1<<bit)-ami);
            count += x+y;
        }
        if(count&1) ans += (1<<bit);
    }
    cout << ans << endl;
}

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

ml = [0] * n
pl = [0] * n

out = 0

for i in range(0, n):
    if(i+a[i]<n):
        pl[i+a[i]] += 1
    if(i-a[i]>=0):
        ml[i-a[i]] += 1

for i in range(0, n):
    out += pl[i] * ml[i]

print(out)


Measured memory_bytes: 32392
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll N,W;
  cin>>N>>W;
  ll w[N],v[N];
  for(int i=0;i<N;i++) cin>>w[i]>>v[i];
  vector<vector<ll>> dp(N+1,vector<ll>(W+1,0));
  for(int i=1;i<=N;i++){
    for(int j=0;j<=W;j++){
      if(j>=w[i-1]) dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
      else dp[i][j]=dp[i-1][j];
    }
  }
  cout<<dp[N][W]<<endl;
}

Measured memory_bytes: 80256
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def ok(n):
    s = str(n)
    if len(set(s)) == 1:
        return True
    return False

def solve():
    n = f()[0]
    for i in range(n, 1000):
        if ok(i):
            print(i)
            return

solve()


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

using namespace std;

bool solve(){
    int n;
    cin>>n;
    if(n==0)return false;
    vector<string> a(n,"");
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        a[i].push_back(s[0]);
        for (int j = 1; j < s.size(); ++j) {
            switch (s[j - 1]) {
                case 'a':
                case 'i':
                case 'u':
                case 'e':
                case 'o':
                    a[i].push_back(s[j]);
                    break;
                default:
                    break;
            }
        }
    }
        int k=1;
        while(true){
            bool ok=true;
            for (int i = 0; i < n; ++i) {
                for (int j = i+1; j < n; ++j) {
                    string tl=a[i].substr(0,min((int)a[i].size(),k));
                    string tr=a[j].substr(0,min((int)a[j].size(),k));
                    if(tl==tr){
                        ok=false;
                        i=100;j=100;
                    }
                }
            }
            if(ok)break;
            ++k;
            if(k>50){
                cout<<-1<<endl;
                return true;
            }
        }
        cout<<k<<endl;
    return true;
}

int main(){
    while(solve());
    return 0;
}


Measured memory_bytes: 3024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int N;

  while(cin >> N && N) {
    vector<string> v;
    rep(i, N) {
      string s; cin >> s;
      v.push_back(s);
    }

    vector<int> wsize = {5,7,5,7,7};
    rep(i, N) {
      int idx = 0;
      bool ok = 0;
      int j = i;
      int curr = 0;
//      cout << "------" << endl;
      while(j < N) {
//        cout << v[j] << endl;
        if(curr + v[j].size() < wsize[idx]) {
          curr += v[j].size();
        } else if(curr + v[j].size() == wsize[idx]) {
          curr = 0;
          idx ++;
          if(idx == wsize.size()) {
            ok = 1;
            break;
          }
        } else {
          break;
        }
        j++;
      }
      if(ok) {
        cout << i + 1 << endl;
        break;
      }
    }

  }
  
  return 0;
}

Measured memory_bytes: 3148
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> as(n); cin >> as;
    vector<int> is(n);
    iota(is.begin(), is.end(), 0);
    sort(is.begin(), is.end(), [&](int i, int j){ return as[i] < as[j]; });
    for(int i = 0; i < n; i++){
        cout << is[i] + 1 << ' ';
    }
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

const double inf = 1e15;

struct Doit {
    vector<double> l,r;
    Doit():l(3,inf),r(3,-inf) {}
    void add(double x, int v){
        v++;
        chmin(l[v],x);
        chmax(r[v],x);
    }
    double get(double t){
        double nl=inf, nr=-inf;
        rep(i,3){
            chmin(nl,l[i]+i*t);
            chmax(nr,r[i]+i*t);
        }
        return nr-nl;
    }
    vector<double> meet(){
        vector<double> res;
        rep(i,3)rep(j,i){
            double t1=(l[j]-l[i])/(i-j);
            double t2=(r[j]-r[i])/(i-j);
            if(t1>0)res.push_back(t1);
            if(t2>0)res.push_back(t2);
        }
        return res;
    }
};

//ABC130
signed main(void){
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);

    int n; cin>>n;
    Doit xd, yd;
    rep(i,n){
        int x,y; char c;
        cin>>x>>y>>c;
        if(c=='L'){xd.add(x,-1); yd.add(y,0);}
        if(c=='R'){xd.add(x,1); yd.add(y,0);}
        if(c=='D'){xd.add(x,0); yd.add(y,-1);}
        if(c=='U'){xd.add(x,0); yd.add(y,1);}
    }
    vector<double> time;
    time.push_back(0);
    time.push_back(inf);
    vector<double> time1=xd.meet(),time2=yd.meet();
    time.insert(time.end(),all(time1));
    time.insert(time.end(),all(time2));
    sort(all(time));
    double ans=1e18;
    for(double t:time){
        chmin(ans,xd.get(t)*yd.get(t));
    }
    cout<<fixed<<setprecision(30)<<ans<<endl;

}

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
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 gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    lol result{0};
    string n; cin >> n;
    //lol k; cin >> k;
    /*
    vector<lol> a(n);
    REP(i, n)
    {
        cin >> a[i];
    }
    */
    REP(i, 3)
    {
        if(n[i] == '7')
            result = 1;
    }

    if(result)
        cout << "Yes" << endl;
    else
    {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cmath>
using namespace std;
bool IsPrime(int n)
{
	int s = floor(sqrt(n)+0.5);
	for(int i = 2;i<=s;i++)
		if(n%i==0)return false;
	return true;
}
const int maxn = 1000000;
int dp[maxn];
int main()
{
	for(int i = 2;i<=maxn;i++)
		if(IsPrime(i))
			dp[i] = dp[i-1]+1;
		else dp[i] = dp[i-1];
	int n;
	while(cin >> n)
		cout << dp[n] <<endl;
	return 0;
}

Measured memory_bytes: 5064
(n,m)=gets.split().map(&:to_i)
a=[]
n.times {a << gets.split().map(&:to_i)}
b=[]
m.times {b << gets.to_i}
n.times do |i|
  c=0
  a[i].each_with_index do |ai,index|
    c+= ai*b[index]
  end
  puts c
end

Measured memory_bytes: 6132
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define MAXN (200005)
using namespace std;

int A[MAXN];
int N, X, L, R;

int main() {
	scanf("%d%d", &N, &X); N = (N<<1)-1;
	if(X == 1 || N == X) { puts("No"); return 0; }
	L = X-1; R = N-X; const int d = min(L, R);
	for(int i = X-d; i <= X+d; i++) A[N/2+1 + i - X] = i;
	if(d == L) {
		for(int i = 1; i <= (N-d-X)/2; i++) A[i] = X+d + i;
		for(int i = X+d+(N-d-X)/2+1; i <= N; i++) A[N/2+1 + d + i - X - d - (N-d-X)/2] = i;

	} else {
		for(int i = 1; i <= (X-d-1)/2; i++) A[i] = i;
		for(int i = (X-d-1)/2 + 1; i < X-d; i++) A[N/2+1 + d + i - (X-d-1)/2 ] = i;
	}
	puts("Yes");
	for(int i = 1; i <= N; i++) printf("%d\n", A[i]);
	return 0;
}

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

int main() {
	int a[101][101], b[101], c, i, j, n, m;
	cin >> n >> m;
	for (i = 1; i <= n; i++) {
		for (j = 1; j <= m; j++) {
			cin >> a[i][j];
		}
	}
	for (i = 1; i <= m; i++) {
		cin >> b[i];
	}
	for (i = 1; i <= n; i++) {
		c = 0;
		for (j = 1; j <= m; j++) {
			c += a[i][j] * b[j];
		}
		cout << c << endl;
	}
	return 0;
}

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

void run() {
  int n, m;
  std::cin >> n >> m;
  std::vector<int> a(m);
  for (int i = 0; i < m; ++i) {
    std::cin >> a[i];
  }
  if (m == 1) {
    std::cout << n << std::endl;
    if (n == 1) {
      std::cout << 1 << std::endl;
      std::cout << 1 << std::endl;
    } else {
      std::cout << 2 << std::endl;
      std::cout << n - 1 << " " << 1 << std::endl;
    }
  } else {
    std::vector<int> odd, even;
    for (auto &&x: a) {
      if (x % 2 == 1) odd.push_back(x);
      else even.push_back(x);
    }
    if (odd.size() > 2) std::cout << "Impossible" << std::endl;
    else {
      a.clear();
      if (odd.size()) a.push_back(odd[0]);
      for (auto &&x: even) a.push_back(x);
      if (odd.size() > 1) a.push_back(odd[1]);
      for (auto &&x: a) std::cout << x << " ";
      std::cout << std::endl;
      a[0]--;
      a.back()++;
      std::vector<int> b;
      for (auto &&x: a) {
        if (x) b.push_back(x);
      }
      std::cout << b.size() << std::endl;
      for (auto &&x: b) std::cout << x << " ";
      std::cout << std::endl;
    }
  }
}

int main() {
  run();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)


int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    vector<bool> seen(n,false);
    bool can=true;
    int now=0;
    int cnt=0;
    while(can){
        if (seen[now] == true){
            cout << -1 << endl;
            return 0;
        }
        cnt++;
        seen[now] = true;
        now = v[now]-1;
        if (now == 1){
            can = true;
            break;
        }        
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 640
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

int M, F, R;

int Solve(){
  if (M == -1 || F == -1){
    cout << "F" << endl;
  }else if (M + F >= 80){
    cout << "A" << endl;
  }else if(M + F >= 65){
    cout << "B" << endl;
  }else if(M + F >= 50){
    cout << "C" << endl;
  }else if (M + F >= 30){
    if (R >= 50) cout << "C" << endl;
    else cout << "D" << endl;
  }else{
    cout << "F" << endl;
  }
  return 0;
}

int main(){
  while (cin >> M >> F >> R){
    if (M == -1 && F == -1 && R == -1) return 0;
    Solve();
  }

  return 0;
}



Measured memory_bytes: 3080
s = list(input())
t = list(input())

s.sort()
t.sort(reverse=True)

if s == t:
    print('No')
    exit()

for i in range(min(len(s), len(t))):
    if s[i] < t[i]:
        print('Yes')
        exit()
    elif s[i] > t[i]:
        print('No')
        exit()
  
if ''.join(t) in ''.join(s):
    print('No')
else:
    print('Yes')

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

string s;
int cnt;

int main()
{
	cin>>s;
	for(int i=0;i<s.size();++i) {
		if(s[i]==s[s.size()-1-i]) continue;
		else cnt++;
	}
	printf("%d",cnt/2);
}

Measured memory_bytes: 256
n=int(input())
b=list(map(int,input().split()))
q=[]
f=True
while(b and f):
    ma=len(b)
    for i in range(ma):
        tar=ma-i
        if b[ma-i-1]==tar:
            q.append(b.pop(ma-i-1))
            break
    else:
        f=False
        break
if f:
    for i in range(n):
        x=q.pop()
        print(x)
else:
    print(-1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
//登録しよう！→ https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示

void solve(long long a, long long b){
  if(a <= 0 && 0 <= b){
    cout << "Zero" << endl;
  }
  else if(a > 0)cout << "Positive" << endl;
  else if(b < 0){
    int x = abs(a) - abs(b) + 1;
    if(x % 2 == 0)cout << "Positive" << endl;
    else cout << "Negative" << endl;
  }
}

// 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 a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    solve(a, b);
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int x,y,r,tmp;

    scanf("%d%d",&x,&y);

    if (x<y) {
        tmp=x;
        x=y;
        y=tmp;
    }

    while(1){
        r=x%y;
        if (r == 0) break;
        x=y;
        y=r;
    }
    printf("%d\n",y);

    return 0;
}



Measured memory_bytes: 2124
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  GI(N);
  vector<vector<int>> candi(101, vector<int>(101, -1)),
      max_candi(101, vector<int>(101, 2e9));
  FOR(i, N) {
    GI3(x, y, h);
    if (h == 0) {
      FOR(j, 101) {
        FOR(k, 101) {
          int can = abs(x - k) + abs(y - j);
          max_candi[j][k] = min(max_candi[j][k], can);
        }
      }
    } else {
      FOR(j, 101) {
        FOR(k, 101) {
          int can = h + abs(x - k) + abs(y - j);
          if (candi[j][k] == -1 || candi[j][k] == can) {
            candi[j][k] = can;
          } else {
            candi[j][k] = -2;
          }
        }
      }
    }
  }
  FOR(j, 101) {
    FOR(k, 101) {
      if (candi[j][k] > 0 && candi[j][k] <= max_candi[j][k]) {
        cout << k << " " << j << " " << candi[j][k] << endl;
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 384
/*
 #pragma GCC target ("avx2")
 #pragma GCC optimize ("Ofast")
 #pragma GCC optimize ("unroll-loops")
*/
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <stack>
#include <queue>
#include <deque>
using namespace std;
const long long N=2e5;
long long a[N];
long long ans=-1,n;
long long A,B;
bool good(long long x){
    long long b[n];
    for(long long i=1;i<=n;i++){
        b[i] = max(0ll,a[i]-(B * x) );
    }
    for(long long i=1;i<=n;i++){
        if(b[i]>0){
            long long cur=(b[i]+(A-B)-1)/(A-B);
            if(x<cur)return 0;
            x-=cur;
            
        }
    }
    return 1;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>A>>B;
    for(long long i=1;i<=n;i++){
        cin>>a[i];
    }
    long long l=0,r=1e9;
    while(l<=r){
        long long m=(l+r)/2;
        if(good(m)){
            r=m-1;
            ans=m;
        }else{
            l=m+1;
        }
    }
    cout<<ans;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max()/4 ;
const ll linf = numeric_limits<ll>::max()/4 ;
const ull ulinf = numeric_limits<ull>::max()/4;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////



int main(){
	string s;
	cin >> s;

	if((int)s.find("AC") != -1)Yes;
	else No;
    
	return  0;
}

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

int main(void) {
    int n, m;
    long long int total = 0;
    cin >> n >> m;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a.at(i);
    } 
    sort(a.rbegin(), a.rend());
    total = accumulate(a.begin(), a.end(), 0LL);
    if(a.at(m-1) < total * (double)1 / (4 * m)){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>

#define MAX 500000
#define INFTY 2000000000

int count;

void merge(int [],int,int,int);
void mergeSort(int [],int,int);

int main(){
  int n,i;
  int A[MAX];

  scanf("%d",&n);
  for(i = 0;i <= n-1;i++){
    scanf("%d",&A[i]);
  }
  
  mergeSort(A,0,n);
  
  for(i = 0;i <= n-1;i++){
    if(i != 0){
      printf(" ");
    }
    printf("%d",A[i]);
  }
  
  printf("\n");
  
  printf("%d\n",count);

  return 0;
}


void merge(int A[],int left,int mid,int right){
  int L[MAX / 2 + 2],R[MAX / 2 + 2];
  int n1,n2,i,j,k;
  
  n1 = mid - left;
  n2 = right - mid;
  /*L[0...n1],R[0...n2]を生成*/
  for(i = 0;i <= n1-1;i++){
    L[i] = A[left + i];
  }
  for(i = 0;i <= n2-1;i++){
    R[i] = A[mid + i];
  }
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j= 0;
  for(k = left;k <= right-1;k++){
    count++;
    if (L[i] <= R[j]){
      A[k] = L[i++];
    }
    else{
      A[k] = R[j++];
    }
  }
}

void mergeSort(int A[],int left,int right){
  if(left + 1 < right){
    int mid = (left + right) / 2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}
  



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

int main() {
    int a[3];
    rep(i, 3) cin >> a[i];

    int ans = 0;

    while (true) {
        int maxv = *max_element(a, a + 3);
        int cnt = count(a, a + 3, maxv);

        if (cnt == 1) {
            rep(i, 3) if (a[i] != maxv) a[i]++;
        } else if (cnt == 2) {
            rep(i, 3) if (a[i] != maxv) a[i] += 2;
        } else
            break;

        ans++;
    }

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


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
using namespace std;
int main(){
char in[100][100];
int a,b;
while(cin>>a>>b,a||b){
rep(i,a){
rep(j,b){
char in1;
cin>>in1;
in[i][j]=in1;
}
}
//cout<<in[1][0]<<endl;
int x=0,y=0;
while(1){
if(in[x][y]=='.'){cout<<y<<" "<<x<<endl;break;}
else if(in[x][y]=='1'){cout<<"LOOP"<<endl;break;}
else if(in[x][y]=='<'){in[x][y]='1';y--;}
else if(in[x][y]=='>'){in[x][y]='1';y++;}
else if(in[x][y]=='^'){in[x][y]='1';x--;}
else if(in[x][y]=='v'){in[x][y]='1';x++;}
//cout<<1<<endl;
}
}
}

Measured memory_bytes: 1172
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    string A, B;
    cin >> A >> B;
    if (A == B)
    {
        cout << "EQUAL" << endl;
        return;
    }
    else if (A.size() > B.size())
    {
        cout << "GREATER" << endl;
        return;
    }
    else if (A.size() < B.size())
    {
        cout << "LESS" << endl;
        return;
    }

    assert(A.size() == B.size());

    rep(i, 0, A.size())
    {
        if (A[i] > B[i])
        {
            cout << "GREATER" << endl;
            return;
        }
        else if (A[i] < B[i])
        {
            cout << "LESS" << endl;
            return;
        }
    }
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(),v.end()

const int maxn = 1e5 + 100;
const ll inf = 2e18, mod = 1e9 + 7;

int a, b;

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

	cin >> a >> b;
	if (a <= 0 && 0 <= b)
		cout << "Zero" << endl;
	else if (0 < a)
		cout << "Positive" << endl;
	else
		cout << ((1LL * b - a + 1) & 1 ? "Negative" : "Positive") << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f
#define endl '\n'
#define ll long long
#define f first
#define s second
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << endl
#define debug2(x, y) cout << "DEBUG " << x << " " << y << endl
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< endl
#define debug4(x, y, z, o) cout << "DEBUG " << x << " " << y << " " << z<< " " << o << endl
using namespace std;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int>> ppi;
typedef vector<vector<int>> mat;
const ll mod = 1e9+7;
const ll cfmod = 998244353;
const int MAXN = 1e5+5;

int a, b, c, n, m, k;
string s, s1, s2;

int32_t main() {
	cin >> a >> b;
	for(int i = 1; i <= 3; i++)
		if(i != a && i != b)
				cout << i << endl;
}
		
			




Measured memory_bytes: 256
import std.algorithm;
import std.bigint;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.meta;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


long solve(string s, string t){
    auto conn = new long[26][](s.length + 1);
    long[26] a;

    foreach (i; 0 .. 26)
        a[i] = -1;

    foreach (_; 0 .. 2) {
        foreach_reverse (i, c; s) {
            conn[i + 1] = a;
            a[c - 'a'] = i + 1;
        }
        conn[0] = a;
    }

    long pi, i;
    long ans;
    immutable long slen = s.length.to!long;
    foreach (c; t) {
        i = conn[pi.to!size_t][c - 'a'];
        if (i < 0)
            return ans = -1;

        if ((i - pi) % slen == 0)
            ans += slen;
        else
            ans += (slen + i - pi) % slen;

        pi = i;
    }

    return ans;
}


void main(){
    auto input = stdin.byLine.map!split.joiner;

    string s;
    s = input.front.to!string;
    input.popFront;

    string t;
    t = input.front.to!string;
    input.popFront;

    static if (is(ReturnType!solve == void))
        solve(s, t);
    else
        solve(s, t).writeln;
}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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

map<lli,lli> cnt2;

void func(long long N, std::vector<long long> A){

    REP(i,0,N){
        cnt2[i-A[i]]++;
    }

    for(auto e:cnt2){
        LOG2(e.first,e.second);
    }

    lli ans = 0;

    REP(i,0,N){
        cnt2[i-A[i]]--;
        ans += cnt2[A[i]+i];
    }

    cout<<ans<<endl;


}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    func(N, std::move(A));
    return 0;
}


Measured memory_bytes: 27296
#include <iostream>
#include <set>
#define llint long long

using namespace std;

llint n, s;
set<llint> S;

llint calc(llint n, llint b)
{
    llint ret = 0;
    for(;n;) ret += n%b, n/=b;
    return ret;
}

int main(void){
    cin >> n >> s;
    if(n < s){
        cout << -1 << endl;
        return 0;
    }
  if(n == s){
    cout << n+1 << endl;
    return 0;
  }
    
    for(llint i = 1; i < 1000005; i++){
        if((n-s)%i == 0){
            S.insert(i), S.insert((n-s)/i);
        }
    }
    for(auto it = S.begin(); it != S.end(); it++){
        if(calc(n, *it+1) == s){
            cout << *it+1 << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


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

using namespace std;

int main(void) {
  long long n, m, d;
  cin >> n >> m >> d;

  long long dd;
  if(d != 0) {
    dd = (n - d) * 2;
  }
  else {
    dd = n;
  }
  //long long div = pow(n, m);
  //long double ans = dd * 2 * pow(n, m - 2) * (m - 1);
  long double ans = (long double)(m - 1) / n * dd / n;
  cout << setprecision(10) << ans << endl;
  
}

Measured memory_bytes: 384
from collections import Counter
a,b = map(int,input().split())
c,d = map(int,input().split())
e,f = map(int,input().split())
if a != c and a != d and b != c and b!= d:
  print ("YES")
else:
  x = [a,b,c,d]
  x1 = Counter(x)
  y = x1.most_common()[0][0]
  if y != e and y != f:
    print ("YES")
  else:
    print ("NO")

Measured memory_bytes: 3316
n=int(input())
a=list(map(int,input().split()))
p=ans=0
for i in range(1,n+1):
    for j in range(p,n):
        if i==a[j]:
            p=j
            break
    else:
        ans=i-1
        break
else:
    ans=n
print(n-ans if ans>0 else -1)

Measured memory_bytes: 26268
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  if(S[0] == S[1] && S[1] == S[2] && S[2] == S[0]){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(a: int, b: int):
    print((a-1) + (1 if a <= b else 0))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    solve(a, b)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
while input = gets
    m, f, r = input.chomp.split(" ").map(&:to_i)
    
    if m == -1 && f == -1 && r == -1
        # 終了条件
        exit
    end
    
    if m == -1 || f == -1
        puts "F"
    elsif m + f >= 80
        puts "A"
    elsif m + f >= 65
        puts "B"
    elsif m + f >= 50
        puts "C"
    elsif m + f >= 30
        if r >= 50
            puts "C"
        else
            puts "D"
        end
    else
        puts "F"
    end
end


Measured memory_bytes: 6876
import java.util.*;

public class Main{
	public static void main(String args[]){
		
		Scanner sc = new Scanner(System.in);
		
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		
		int k = sc.nextInt();
		int count =0;
		
		
			if(A<=k && 0<k){
			count += A;
			k=k-A;
			A=0;
			}
			
			else if(A>k){
			count +=k;
			A=0;
			}
			
			if(A==0 && 0<k){
				k=k-B;
				B=0;
			}
			
			if(A==0 && B==0 && 0<k ){
				count=count-k;
			}
			
			
			System.out.println(count);
		
	}
}
				
				

Measured memory_bytes: 35756
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>

using namespace std;

int main() {
	int N, K, X, Y;
	cin >> N;
	cin >> K;
	cin >> X;
	cin >> Y;
	
	if (N > K) {
		cout << X * K + Y * (N - K) << endl;
	}
	else {
		cout << X * N << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define X first
#define Y second
#define sz(v) (int)v.size()
using ord = tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update>;
 
void solve();
 
main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
#ifdef ONPC
	freopen("in.txt", "r", stdin);
#endif
	int t = 1;
	//cin >> t;
	while (t--) solve();
	return 0;
}



void solve() {
	ll n;
	cin >> n;
	if (n & 1) cout << 0;
	else {
		ll ans = 0;
		ll st1 = 2, cnt1 = 0, st2 = 5, cnt2 = 0;
		ll cur = 1;
		while (st1 <= n) {
			cnt1 += (n / st1);
			if (st1 > n / (ll)2) break;
			st1 *= (ll)2;
			++cur;
		}
		cur = 1;
		while (st2 <= n) {
			cnt2 += (n / st2) / (ll)2;
			if (st2 > n / (ll)5) break;
			st2 *= (ll)5;
			++cur;
		}
		
		cout << min(cnt1, cnt2);
	}
}


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

using namespace std;

int main()
{
    int a,b;
    cin>>a>>b;
    if((a%3==0)||(b%3==0||((a+b)%3==0))){
        cout<<"Possible";
    }else{
        cout<<"Impossible";
    }
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int inf=0x3f3f3f3f;
const int MOD=1e9+7;
const int maxn=5e5+10;
ll gcd(ll a, ll b){return (b==0)?a:gcd(b, a%b);}
bool isPrime(ll n) {
    if(n<=3){
        return n>1;
    }
    if(n%6!=1&&n%6!=5){
        return false;
    }
    ll sqr=sqrt(n);
    for(ll i=5;i<=sqr;i+=6){
        if(n%i==0||n%(i+2)==0){
            return false;
        }
    }
    return true;
}
int dis[4][2]={0,1,0,-1,1,0,-1,0};
 
 
 int main()
 {
 	int a;cin>>a;
 	double sum=a*a*a;
 	sum=sum*1.0/27;
 	printf("%0.12lf",sum);
} 



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-8;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int n, h[105], ans = 0, t=0;
    cin >> n;
    REP(i,n) cin >> h[i];
    REP(i,n){
        if(h[i]>t){
            ans += h[i]-t;
        }
        t = h[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>

namespace adaptor = boost::adaptors;

void solve()
{
    int64_t N;
    std::cin >> N;
    std::map<int64_t, int64_t> A;
    for (int64_t i = 0; i < N; i++)
    {
        int64_t a;
        std::cin >> a;
        A[a]++;
    }

    int64_t width = 0;
    int64_t height = 0;

    for (auto v : adaptor::reverse(A))
    {
        if (width == 0 && height == 0 && v.second >= 4)
        {
            width = v.first;
            height = v.first;
            break;
        }
        if (width == 0 && height == 0 && v.second >= 2)
        {
            width = v.first;
            continue;
        }
        if (width != 0 && height == 0 && v.second >= 2)
        {
            height = v.first;
            break;
        }
    }

    std::cout << width * height << std::endl;
}

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


Measured memory_bytes: 9900
def main():
  x, k, d = map(int, input().split())
  if x < 0:
    x *= -1
  if x - d < 0:
    if k%2==0:
      print(x)
    else:
      print(d - x)
  elif x - k*d > 0:
    print(x - k*d)
  else:
    k -= x//d
    if k%2==0:
      print(x%d)
    else:
      print(-(x%d-d))

if (__name__=='__main__'):
  main()

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

#define ll long long
const int N   = 2e5 + 5;

int main(){
	
	
	string a,b;
	cin>>a>>b;
	int cnt = 0;
	for(int i=0;a[i];i++){
		if(a[i]!=b[i]){
			cnt++;
		}
	}

	cout<<cnt<<endl;

	

	return 0;
}

Measured memory_bytes: 3804
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
x=0
for i in range(N):
    A=list(map(int,input().split()))
    s=C
    for j in range(M):
        s+=A[j]*B[j]
    if s>0:
        x+=1
print(x)  

Measured memory_bytes: 9124
from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)

def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    ans = 1
    for i in a:
        ans *= i
        if (ans > 1e18):
            print(-1)
            exit()
    print(ans)
main()

Measured memory_bytes: 21572
#include <iostream>
using namespace std;
using ll = long long;

int main () {
    ll N, T, ans = 0, bf = 0, t, dv = 0;

    cin >> N >> T;

    for (ll i = 0; i < N; i++) {
        cin >> t;
        dv = t - bf;
        if (dv >= T) {
            ans += T;
        } else {
            ans += dv;
        }
        bf = t;
        //cout << i << ": " << ans << endl;
    }
    //cout << ans << endl;
    ans += T;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef  long long int ll;
typedef  long double ld;
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define mod 1000000007
#define F first
#define S second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
//recursions\
#pragma comment(linker, "/stack:200000000")
//loops\
#pragma GCC optimize("unroll-loops")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,greater_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
ll dp[10001][2][100];
vector<ll>num;
ll calc(ll idx,ll d,ll bnd,ll sum)
{
	if(idx==-1)
	return sum==0;
	
	if(dp[idx][bnd][sum]!=-1)
	return dp[idx][bnd][sum];
	
	ll k=bnd?num[idx]:9;
	
	ll ans=0;
	for(ll i=0;i<=k;i++)
	{
		ll nbnd=(i==k)?bnd:0;
		ans+=calc(idx-1,d,nbnd,(sum+i)%d);
		ans%=mod;
	}
	
	return dp[idx][bnd][sum]=ans;
	
}
ll solve(string k,ll d)
{
	memset(dp,-1,sizeof(dp));
	ll x=k.size()-1;
	while(x>=0)
	{
		num.push_back(k[x]-'0');
		x--;
	}
	return calc(num.size()-1,d,1,0);
}
int main()
{
	sync;
	ll d;
	string k;
	cin>>k>>d;
	cout<<(solve(k,d)+mod-1)%mod;
}
	


Measured memory_bytes: 16768
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();

    int ld = N % 10;
    switch (ld) {
      case 2:
      case 4:
      case 5:
      case 7:
      case 9:
        System.out.println("hon");
        break;
      case 0:
      case 6:
      case 1:
      case 8:
        System.out.println("pon");
        break;
      case 3:
        System.out.println("bon");
        break;
    }
  }
}


Measured memory_bytes: 27056