akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h> 
 
using namespace std;
 
int main()
{
  int n;
  cin>>n;
  string s,t;
  cin>>s>>t;
  string res="";
  for(int i=0;i<n;i++)
  {
    res+=s[i];
    res+=t[i];
  }
  cout<<res;
  return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>
#include <ctype.h>
#define AB 'a'
#define N 26
#define S 32
int main(void)
{
	int i;
	int counter[N]={0};
	char ch;
	while(scanf("%c", &ch) != EOF){
	    if(isalpha(ch)){
			counter[(ch-'A')%S]++;
		}
	}
	for(i=0; i<N; i++){
		printf("%c : %d\n", AB+i, counter[i]);
	}
    return 0;
}

Measured memory_bytes: 544
#include <bits/stdc++.h>
#define PI acos(-1)
#define eq(x,y) (fabs((x)-(y)) < eps)
#define debug(x) cerr<<x<<endl;
#define endl "\n"
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf=1e9+7;
const int nmax=1e5+10;
const int eps=1e-8;

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout<<fixed;
    //cout.tie(NULL);
    ll n;
    cin>>n;
    vector<ll>v(5);
    for(int i=0;i<5;i++)
        cin>>v[i];

    ll minn=*min_element(v.begin(),v.end());
    ll ans=(n+minn-1)/minn + 4;

    cout<<ans<<endl;


    return 0;
}


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

int main(){
    
    // 1. 入力情報.
    int a, b;
    scanf("%d %d", &a, &b);
    
    // 2. 出力.
    if(a + b == 15)      puts("+");
    else if(a * b == 15) puts("*");
    else                 puts("x");
    return 0;
    
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

vector<ll> enum_prime(ll N){
	deque<bool> is_prime(N+1,true);
	vector<ll> P;
	for(ll i=2;i<=N;i++){
		if(is_prime[i]){
			for(ll j=i*i;j<=N;j+=i){
				is_prime[j] = false;
			}
			P.emplace_back(i);
		}
	}
	return P;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N;
	while(cin>>N){
		auto P=enum_prime(N);
		out(P.size());
	}

	return 0;
}


Measured memory_bytes: 5472
import java.util.Scanner;

public class Main {

	public static int func(int n) {
		int res=0;
		if(n%2==0) {
			res=n/2;
		}
		else if(n%2==1) {
			res=3*n+1;
		}
		return res;
	}

	public static void main(String[] args) {
		int ans=0;
		int []a=new int[1000000];
		Scanner sc=new Scanner(System.in);
		int s=sc.nextInt();
		a[0]=s;
		for(int i=1;i<a.length;i++) {
			a[i]=func(a[i-1]);
			for(int j=0;j<i;j++) {
				if(a[i]==a[j]) {
					ans=i+1;
					break;
				}
			}
			if(ans!=0)break;
		}
		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 26068
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int maxN = 1005;
const int maxV = maxN * (maxN - 1) / 2;
vector<int> to[maxV];
int id[maxN][maxN];
int vtoId(int x, int y) {
    if (y < x) swap(x, y);
    return id[x][y];
}

bool visited[maxV];
bool calted[maxV];
int dp[maxV]; // max length
int dfs(int x) {
    if (visited[x]) {
        if (!calted[x]) return -1;
        else return dp[x];
    }
    dp[x] = 1;
    visited[x] = true;
    for (int a : to[x]) {
        int y = dfs(a);
        if (y == -1) return -1;
        dp[x] = max(dp[x], y + 1);
    }
    calted[x] = true;
    return dp[x];
}

int main() {
    // DAG, 閉路検出、最長パス
    int N;
    cin >> N;
    int V = 0;
    rep(j, N) rep(i, j) {
        id[i][j] = V++;
    }
    vector<vector<int>> A(N, vector<int> (N-1));
    rep(i, N) {
        rep(j, N-1) {
            cin >> A[i][j];
            --A[i][j];
            A[i][j] = vtoId(i, A[i][j]);
        }
        rep(j, N-2) {
            to[A[i][j+1]].push_back(A[i][j]);
        }
    }
    int ans = 0;
    rep(i, V) {
        int x = dfs(i);
        if (x == -1) {
            cout << -1 << '\n';
            return 0;
        }
        ans = max(ans, x);
    }
    cout << ans << '\n';
    return 0;
}

// 36

Measured memory_bytes: 41776
K = int(input())

flag = [0 for _ in range(K)]  # flag[i] : あまり i が登場したかどうか

if 7%K == 0:
    print(1)
else:
    now_n = 7%K
    flag[now_n] = 1
    while True:
        next_n = (now_n*10 + 7) % K
        if next_n == 0:
            print(sum(flag)+1)
            exit()
        elif flag[next_n] == 0:
            now_n = next_n
            flag[now_n] = 1
        else:
            print(-1)
            exit()


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

using namespace std;
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
const int N=2000005,MOD=1e9+7,MAX=1e5;

int n,k;

std::vector<int> a,b;


int  main()
{
       
       scanf("%d %d",&n,&k);

       for(int i=0;i<n;i++){

           int x;

           scanf("%d",&x);
           if(x==0)
               k--;
           else if(x>0){
              a.pb(x);
           }
           else{
             b.pb(x);
           }
       } 

        reverse(all(b));

        long long ans = 1e18;

       for(int i=0;i<=min(sz(a),k);i++){
               
               ll curr = 0 ;

               if(i)
                 curr = a[i-1]*2;
               
               if( sz(b)>=(k-i) ){

                    if((k-i))
                    curr += abs(b[(k-i)-1]);
                  ans = min(ans,curr);
               }           
       }

       for(int i=0;i<=min(sz(b),k);i++){
               
               ll curr = 0 ;

               if(i)
                 curr = abs(b[i-1]*2);
               
               if( sz(a)>=(k-i) ){

                    if((k-i))
                    curr += a[(k-i)-1];
                  ans = min(ans,curr);
               }           
       }

       printf("%lld\n",ans );

      
 return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<long long, long long> pl;
 
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define speedhack() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define form(i, n) for (size_t i = 0; i < size_t(n); ++i)
#define forn(i, n) for (size_t i = 1; i <= size_t(n); ++i)
template<class T> using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll mod(ll a, ll b) { return (a%b+b)%b; }
ll gcd(ll x, ll y) { return __gcd(x, y); }
ll lcm(ll x, ll y) { return x * 1ll * y / gcd(x, y); }
 
 
const ll MAXN = 1e18;
const ll SIZE = 2e5 + 5;
const ll MOD  = 1e9 + 7;

int n, len;
string s;

int main() { speedhack()

	cin >> n;
	cin >> s;

	len = (int)s.size();

	if (len > n) {
		for (int i = 0; i < n; i++)
			cout << s[i];
		cout << "...";
	} else 
		for (char c : s)
			cout << c;

	return 0;
}


Measured memory_bytes: 3644
/*
   Author: Shivam Shukla
*/
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pair<ll,ll> > vpll;
 
const int MOD=1e9+7;
const int MAX=1e5+5;
const double PI= acos(-1.0);
const long double EPS=1e-10;
const int64_t INF=1e18+10;
 
#define fastio() ios_base::sync_with_stdio(false);cin.tie(0), cout.tie(0)
#define trace(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vi vector<int>
#define vl vector<ll>
#define vs vector<str>
#define vc(x) vector<x>
#define mapll map<ll,ll>
#define mapib map<int,bool>
#define mapiv map<int,vector>
#define mapsi map<string,int>
#define rep(i,j,k) for(ll i=j;i<k;i++)
#define down(i,j,k) for(ll i=j;i>=k;i--)
#define repa(i,n) for(ll i=0;i<n;i++)
#define dowa(i,n) for(ll i=n;i>=0;i--)
#define reps(i,j,k,s) for(ll i=j;i<k;i+=s)
#define downs(i,j,k,s) for(ll i=j;i>=k;i-=s)
#define trv(i,x) for(auto i:x)
#define pb push_back
#define eb emplace_back
#define sz(x) (int)x.size()
#define ff first
#define ss second
#define str string 
#define dub double
#define pqmax priority_queue<ll>
#define pqmin priority_queue<ll,vl,greater<ll> >
 
template<typename t> t lcm(t a, t b) {return (a*b)/__gcd(a,b);}
template<typename t> t gcd(t a, t b) {return __gcd(a,b);}
template<typename t> t mul_mod(t a, t b, t m){t res=((a%m)*(b%m)%m); return res;}
template<typename t> t add_mod(t a, t b, t m){t res=((a%m)+(b%m))%m; return res;}
template<typename t> t pow_mod(t a,t b,t m) {t res=1;while(b){if(b&1) res=mul_mod(res,a,m);a=mul_mod(a,a,m), b>>=1;} return res%m;}
template<typename t> vc(t) num_vec(t num) {t res; while (num) res.pb(num%10), num/=10; return res;}
template<typename t> t vec_num(t vec) {t res=0; ll mul=1; repa(i,sz(vec)) res=vec[i]*mul, mul*=10; return res;}
 

int32_t main(int argc,char** argv){
	fastio();
	auto tstart= clock();

    int n; cin >> n;
    vl a(n); repa(i, n) cin >> a[i];

    trv(i, a) 
       if (i % 2 == 0)
          if (!(i % 3 == 0) && !(i % 5 == 0))
              return cout << "DENIED" << endl, 0;

    cout << "APPROVED" << endl;            
  
    cerr<<setprecision(2)<<fixed<<"Time elapsed: "<<(double)(clock() - tstart)/CLOCKS_PER_SEC<<endl; 
    return 0; 
}

Measured memory_bytes: 256
#import<iostream>
#import<string>
using namespace std;int main(){string s;for(int n,i;getline(cin,s),s!="END OF INPUT";)for(n=i=0;i<s.size();i++)i==s.size()-1?cout<<n+1<<"\n",0:s[i]==' '?cout<<n,n=0:n++;}

Measured memory_bytes: 0
#include <stdio.h>
int main() {
	int n, a, b, maxA = 0, minB = 1e9;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d%d", &a, &b);
		if (maxA < a) {
			maxA = a;
			minB = b;
		}
	}
	printf("%d\n", maxA + minB);
	return 0;
}

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

int writeTime(int sec)
{
    int h = sec / 60 / 60 % 24;   // s??????????????¶????????????????????????????????????. 
    int m = sec / 60 % 60;
    int s = sec % 60;
    
    cout << h << ":" << m << ":" << s << endl;
}

int main()
{
    int s = 0;
    cin >> s;
    writeTime(s);
    
    return 0;
}

Measured memory_bytes: 1164
#include<stdio.h>
#include<algorithm>

int a[100005],c[100005];

int main()
{
    int n,i,k=0,C=0;
    scanf("%d", &n);
    for(i=1;i<=n;i++){
        scanf("%d", &a[i]);
    }
    std::sort(a+1,a+n+1);
    for(i=1;i<=n;i++){
        if(a[i-1]!=a[i])k++;
        c[k]++;
    }
    for(i=1;i<=k;i++){
        if(c[i]%2==0)C++;
    }
    if(C%2)printf("%d", k-1);
    else printf("%d", k);
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
import java.util.Arrays;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int i;;
    int[] a = new int[n]; 
    for(i=0;i<n;i++){
      a[i] = sc.nextInt();
    }
    int[] sa = a.clone();
    Arrays.sort(sa);
    for(i=0;i<n;i++){
      if(sa[n-1]>a[i]){
        System.out.println(sa[n-1]);
      }else{
        System.out.println(sa[n-2]);
      }
    }
  }
}

Measured memory_bytes: 85620
//#define __mode_debug__

#ifdef __mode_debug__
    #define DBG
#else
    #define DBG if(false)
#endif

#include <bits/stdc++.h>
using namespace std;

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

//DUMP
//  vector<T> , vector<vector<T>> , set<T> ,queue<T> , priority_queue<T> , pair<T,U> , map<T,U>
// C++17ができたら、disjunctionなど使って簡略化したい、などと
template<class T> ostream& operator<<(ostream&os,vector<T>&vec){os<<"{ ";rep(i,vec.size()) os<<((i==0)?"":", ")<<i<<":"<<vec[i];os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,vector<vector<T>>&vec){os<<"{"<<endl;rep(i,vec.size())os<<"\t   "<<i<<":"<<vec[i]<<((i==vec.size()-1)? "":",")<<endl;os<<"\t }";return os;}
template<class T> ostream& operator<<(ostream&os,set<T>&p){os<<"{ ";repi(itr,p)  os<<((itr==p.begin())?"":", ")<<*itr;os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,queue<T>&p){queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.front();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T> ostream& operator<<(ostream&os,priority_queue<T>&p){priority_queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.top();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T,class U> ostream& operator<<(ostream&os,pair<T,U>&p){os<<"("<<p.first<<","<<p.second<<")";return os;}
template<class T,class U> ostream& operator<<(ostream&os,map<T,U>&p){os<<"{ ";repi(itr,p)os<<((itr==p.begin())?"":", ")<<itr->first<<":"<<itr->second;os<<" }";return os;}
void dump_f(string &nm){cerr<<endl;}
template<class T,class... Ts> void dump_f(string &nm,T &&x,Ts&&... ts){int l=nm.find_first_of(',');string name(nm,0,l),nx(nm,l+1,-1);cerr<<"  "<<name<<"\t:"<<x<<endl;dump_f(nx,forward<Ts>(ts)...);}
template<class... Ts> void dump_m(int &&ln,string &&nm,Ts&&... ts){cerr<<"[ln:"<<ln<<"]"<<endl;dump_f(nm,forward<Ts>(ts)...);}
#define dump(...) DBG dump_m(__LINE__,#__VA_ARGS__,__VA_ARGS__)

#define lower_bound_idx(V,c) distance(V.begin(),lower_bound(V.begin(),V.end(),c))


int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    bool is=true;
    
    int N;
    cin >>N;

    string X;
    char m;
    map<string,int> said;
    rep(i,N){
        cin >> X;
        if(said.find(X)!=said.end())is=false;
        if(i!=0 && m!=X[0])is=false;
        said.insert(make_pair(X,0));
        m=X[X.size()-1];
    }
    dump(said);

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

Measured memory_bytes: 256
//In the name of God:)
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define pii pair<int,int>
#define ll long long int
#define fast  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int MAXN = 1e5 + 10;

int main(){
    fast
    double l;
    cin>>l;
    l/=3;
    cout<<fixed<<setprecision(9)<<(l * l * l)<<'\n';
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int grundy(long long x, long long k){
	if(x<k){
		return 0;
	}else if(x%k==0){
		return x/k;
	}else if(x>k*k){
		return grundy(x-x/k-1,k);
	}else{
		long long y = (x-x/k*k)%(x/k+1);
		if(x!=x/k*k+y){
			return grundy(x/k*k+y,k);
		}else{
			return grundy(x-x/k-1,k);
		}
	}
}

int main(){
	long long a[210],k[210],i,n,ans=0;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i] >> k[i];
		ans ^= grundy(a[i],k[i]);
	}
	
	if(ans!=0){
		cout << "Takahashi" << endl;
	}else{
		cout << "Aoki" << endl;
	}
}

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

int main() {
    string w;
    cin >> w;
    vector<int> v(26, 0);
    for (int i = 0; i < w.size(); i++)
        v[w[i] - 'a']++;

    for (int i = 0; i < 26; i++) {
        if (v[i] % 2 != 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string a;
    cin>>a;
    if(a=="SAT"){
        cout<<1<<endl;
    }
        if(a=="FRI"){
        cout<<2<<endl;
    }
        if(a=="THU"){
        cout<<3<<endl;
    }
        if(a=="WED"){
        cout<<4<<endl;
    }
        if(a=="TUE"){
        cout<<5<<endl;
    }
        if(a=="MON"){
        cout<<6<<endl;
    }
        if(a=="SUN"){
        cout<<7<<endl;
    }
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

const ll mod = 1000000007;

static const ll INF = 1e15;

ll  n, k;
vector<ll> vs;
vector<ll> ps;
vector<ll> ms;
ll pp;
ll mm;
ll pCount;
ll mCount;

struct BSearch {
	ll solve1(ll left, ll right, ll k) {
		while (right - left > 1) {
			ll middle = left + right;
			middle /= 2;
			ll uSum = 0;
			ll lSum = 0;
			rep(i, mm) {
				ll c = vs[i];
				auto u = upper_bound(vs.end() - pp, vs.end(), middle / c);
				//kより小さい
				uSum += vs.end() - u;
				auto l = lower_bound(vs.end() - pp, vs.end(), middle / c);
				//k以上
				lSum += l - (vs.end() - pp);
			}
			if (uSum > k) {
				right = middle;
			}
			else if (lSum > mCount - k) {
				left = middle;
			}
			else return middle;
		}
		return right;
	}
	ll solve2(ll left, ll right, ll k) {
		while (right - left > 1) {
			ll middle = left + right;
			middle /= 2;
			ll uSum = 0;
			ll lSum = 0;
			for (int i = 0; i < mm;i++) {
				ll c = ms[i];
				//kより大きい
				auto u = upper_bound(ms.begin() +  i , ms.end(), middle / c);
				uSum += ms.end() - u;
				//以上
				auto l = lower_bound(ms.begin() + i, ms.end(), middle / c);
				lSum += l - (ms.begin() + i);
			}
			for (int i = 0; i < pp; i++) {
				ll c = ps[i];
				//kより大きい
				auto u = upper_bound(ps.begin() + i, ps.end(), middle / c);
				uSum += ps.end() - u;
				//以上
				auto l = lower_bound(ps.begin() + i, ps.end(), middle / c);
				lSum += l - (ps.begin() + i);
			}
			if (uSum > k) {
				right = middle;
			}
			else if (lSum > pCount - k) {
				left = middle;
			}
			else return middle;
		}
		return right;
	}
};


int main(void)
{
	ll n;
	cin >> n;
	vector<ll> ds(n);
	rep(i, n) cin >> ds[i];
	ll mm = 1e15;
	for (int i = 1; i <= 100; i++) {
		ll sum = 0;
		rep(j, n) {
			ll d = ds[j] - i;
			d *= d;
			sum += d;
		}
		mm = min(mm, sum);
	}
	cout << mm << endl;

	return 0;
}



Measured memory_bytes: 256
W,H,x,y,r= map(int,input().split()) 
if W==x :
    print("No")
elif W-r<x :
    print("No")
elif H==y :
    print("No")
elif H-r<y :
    print("No")
elif x<0 or y<0:
    print("No")
else :
    print("Yes")


Measured memory_bytes: 5596
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    string s, t;

    cin >> s >> t;

    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] != t[i])
        {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}


Measured memory_bytes: 3596
#include<iostream>
#include<stdio.h>

using namespace std;

int main(void){
  int n;
  int a, b;
  int suma = 0, sumb = 0;
  while(1){
    suma = 0;
    sumb = 0;
    scanf("%d", &n);
    if(n == 0) break;
    for(int i = 0; i<n; i++){
      cin >>a >> b;
      if(a > b){
	suma += a + b;
      } else if(a < b){
	sumb += a + b;
      } else {
	suma += a;
	sumb += b;
      }
    }
    printf("%d %d\n",suma,sumb);
  }
    return 0;
}
  

Measured memory_bytes: 1232
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	void run(){
		for(;;){
			if(!sc.hasNextInt()){
				break;
			}
			int  d = sc.nextInt();
			int sum = 0;
			for(int i = 0 ; i  < 600; i +=d){
				sum += d*i*i;
			}
			System.out.println(sum);
		}
		
	}
	public static void main(String[] args){
		Main m = new Main();
		m.run();
	}
}

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

using namespace std;


int main() {
	vector<int> A(3);

	cin >> A[0] >> A[1] >> A[2];

	int fives  = count(A.begin(), A.end(), 5);
	int sevens = count(A.begin(), A.end(), 7);

	if(fives == 2 && sevens == 1) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <climits>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

#define DIV 1000000007

using namespace std;

long long H, W, A, B;
long long mulmul[200005];
long long divdiv[200005];

long long modpow(long long ori, long long po){
	long long res = 1;
	while(po > 0){
		if(po&1){
			res *= ori;
			res %= DIV;
		}
		ori *= ori;
		ori %= DIV;
		po >>= 1;
	}
	return res;
}

long long cal(long long y1, long long x1, long long y2, long long x2){
	long long yoko = x2 - x1;
	long long tate = y2 - y1;
	//cout << y1 << "," << x1 << "->" << y2 << "," << x2 << endl;
	//cout << "yoko " << yoko << "tate" << tate << endl;
	long long ret = 1;

	ret*=mulmul[yoko+tate];
	ret %= DIV;
	ret*=divdiv[tate];
	ret %= DIV;
	ret*=divdiv[yoko];
	ret %= DIV;

	return ret;
}

void prepare(){

	long long ret = 1;
	divdiv[0] = 1;
	mulmul[0] = 1;
	for(long long i = 1; i < 200005; i++){
		ret*=i;
		ret %= DIV;
		mulmul[i] = ret;
	}
	
	ret = 1;
	for(long long i = 1; i < 100005; i++){
		ret *= modpow(i, DIV-2);
		ret %= DIV;
		divdiv[i] = ret;
	}
}


int main(){
	cin >> H >> W >> A >> B;

	prepare();

	long long ret = 0;
	for(long long h = 0; h < H - A; h++){
		ret += (cal(0, 0, h, B - 1) * cal(h, B, H - 1, W - 1))%DIV;
		ret %= DIV;
	}
	cout << ret << endl;
}


Measured memory_bytes: 2560
#include <iostream> // C++の入出力
#include <stdio.h> // C の入出力
#include <algorithm> // sort などのアルゴリズム
#include <string.h> // C の文字列用
#include <ctype.h> // C の文字種用
#include <string> // C++の文字列
using namespace std;
int main(void){
    while(1){
        int nin,yu,pars;
        cin>>nin>>yu>>pars;
        if(nin==0&&yu==0&&pars==0)break;
        int data[nin],cnt=0,kin=0;
        for(int i=1;i<=nin;i++){
            cin>>data[i];
            if(i==yu)cnt++;
            kin+=data[i]*100;
        }
        int bun=kin*(100-pars)/100;
        if(data[yu]==0)cout<<"0\n";
        else cout<<bun/data[yu]<<endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = (4e2) + 5;
ll memo[N][N];
ll ac[N];
ll n, a[N];

ll DP(int l, int r) {
	if (l == r) {
		return 0;
	}
	ll &ret = memo[l][r];
	if (ret != -1) return ret;
	ret = LLONG_MAX;
	for (int i = l; i < r; ++i) {
		if (l == 0) {
			ret = min(ret, ac[r] + DP(l, i) + DP(i + 1, r));
		} else {
			ret = min(ret, ac[r] - ac[l - 1] + DP(l, i) + DP(i + 1, r));
		}
	}
	return ret;
}

void accumulate(ll arr[], int n) {
	ac[0] = arr[0];
	for (int i = 1; i < n; ++i) {
		ac[i] = (ac[i - 1] + arr[i]);
	}
}

int main() {
	scanf("%lld", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%lld", &a[i]);
	}
	accumulate(a, n);
	memset(memo, -1, sizeof memo);
	ll ans = DP(0, n - 1);
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x)+modulo)%modulo)


int main(){
	
	int N;
	cin>>N;
	string S;
	cin>>S;
	
	vector<vector<int>> dp(N,vector<int>(N,0));//dp[i][j] 左からi番目に残りのうち小さい物からj番目
	vector<vector<int>> sum(N,vector<int>(N,0));
	for(int i=0;i<N;i++){
		dp[0][i]=1;
		sum[0][i] = i+1;
	}
	
	for(int i=1;i<N;i++){
		for(int j=0;j<N;j++){
			if(S[i-1] == '<'){
				dp[i][j] = sum[i-1][j];
			}
			else{
				dp[i][j] = mod(sum[i-1][N-1]-sum[i-1][j]);
			}
			if(j>=N-i)dp[i][j] = 0;
			sum[i][j] = dp[i][j];
			if(j!=0)sum[i][j] = mod(sum[i][j] + sum[i][j-1]);
		}
	}
	
	cout<<dp[N-1][0]<<endl;
	
	return 0;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

ll gcd(ll a,ll b){
	if(a<b){
		swap(a,b);
	}

	while(ll r=(a%b)){
		a = b;
		b = r;
	}
	return b;
}

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

	int N=in(),K=in();
	auto V=vecin(N);
	auto M=*max_element(ALL(V));
	int GCD = V[0];
	REP(i,N-1){
		GCD = gcd(GCD,V[i+1]);
	}
	
	out(!(K%GCD) && (K<=M)?"POSSIBLE":"IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 640
import math

def koch(n,p1,p2):

    sx = 2/3 * p1[0] + 1/3 * p2[0]
    sy = 2/3 * p1[1] + 1/3 * p2[1]
    s = (sx,sy)

    tx = 1/3 * p1[0] + 2/3 * p2[0]
    ty = 1/3 * p1[1] + 2/3 * p2[1]
    t = (tx,ty)

    theta = math.radians(60)
    ux = (tx - sx)*math.cos(theta) - (ty - sy)*math.sin(theta) + sx
    uy = (tx - sx)*math.sin(theta) + (ty - sy)*math.cos(theta) + sy
    u = (ux,uy)

    if n>0:
        koch(n-1,p1,s)
        print(*s)
        koch(n-1,s,u)
        print(*u)
        koch(n-1,u,t)
        print(*t)
        koch(n-1,t,p2)
    else: return

n = int(input())
a = [0.00000000,0.00000000]
b = [100.00000000,0.00000000]
print(*map(float,a))
koch(n,a,b)
print(*map(float,b))


Measured memory_bytes: 5784
X, Y = map(int, input().split())
n, mod = divmod(X + Y, 3)


def modinv(a, mod=10 ** 9 + 7):
    return pow(a, mod - 2, mod)


def combination(n, r, mod=10 ** 9 + 7):
    r = min(r, n - r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i + 1, mod) % mod
    return res


if mod != 0 or not (X <= 2 * Y and Y <= 2 * X):
    print(0)
else:
    r = Y - n
    print(combination(n, r))

Measured memory_bytes: 40428
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
using namespace std;
int main(){
	string s;
	int sum,ans,now,cou,pre;
	priority_queue<int> que;
	while(getline(cin,s),s[0]!='0'){
		sum=0;
		for(int i=0;i<s.size();i++){
			if(isdigit(s[i])){
					sum=sum*10+(s[i]-'0');
			}
			else{
				que.push(sum);
				sum=0;
			}
		}
		cou=0;
		que.push(sum);
		ans=0;
		while(!que.empty()){
			now=que.top();
			que.pop();
			if(now>=2&&now<=9)
				ans+=now;
			else if(now>9)
				ans+=10;
			else if(now==1)
				cou++;
		}
		int m=ans;
		if(cou+ans>21)
			cout<<'0'<<endl;
		else{
		for(int i=0;i<=cou;i++){
			pre=m+cou-i+i*11;
			if(pre<=21){
				ans=max(pre,ans);
			}
		}
		if(ans>21)
		cout<<'0'<<endl;
		else cout<<ans<<endl;
		}
	}
	return 0;
}

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

int main() {
	string s;
	cin >> s;
	int mask = 0;
	for (char ch : s) {
		if (mask & (1 << (ch - 'a'))) {
			cout << "no";
			return 0;
		} else {
			mask |= (1 << (ch - 'a'));
		}
	}
	cout << "yes";

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[500000],cnt,l[250005],r[250005];
void merge(int left,int mid,int right){
  int x=mid-left,y=right-mid;
  for(int i=0;i<x;++i) l[i]=a[left+i];
  for(int i=0;i<y;++i) r[i]=a[mid+i];
  l[x]=r[y]=1000000001;
  x=y=0;
  for(int i=left;i<right;++i){
    ++cnt;
    if(l[x]<=r[y]) a[i]=l[x++];
    else a[i]=r[y++];
  }
}

void mergesort(int left,int right){
  if(left+1<right){
    int mid=(right+left)/2;
    mergesort(left,mid);
    mergesort(mid,right);
    merge(left,mid,right);
  }
}

int main(){
  int n; cin>>n;
  for(int i=0;i<n;++i) cin>>a[i];
  mergesort(0,n);
  for(int i=0;i<n;++i){
    if(i) cout<<" ";
    cout<<a[i];
  }
  cout<<endl;
  cout<<cnt<<endl;
  return 0;
}



Measured memory_bytes: 6952
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int W = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();
    if(b-W-a > 0){
      System.out.println(b-W-a);
    }else if(a-b-W > 0){
      System.out.println(a-b-W);
    }else{
      System.out.println(0);
    }
  }
}

Measured memory_bytes: 22740
data=[int(input()) for i in range(int(input()))]
data.sort()
count=-1
value=1
predata=None
for i in range(0,len(data)):
    if predata!=data[i]:
        count+=value%2
        value=1
    else:
        value+=1
    predata=data[i]
count+=value%2
print(count)


Measured memory_bytes: 7388
#include <stdio.h>
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <deque>
#include <tuple>
#include <cstring>

using namespace std;

#define FOR(i,n) for(int i = 0; i < (n); i++) 
#define sz(c) ((int)c.size())

typedef pair<int, int> Pii;

void compress(vector<int>& v) {
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
}

int w, h;
typedef pair<Pii, int> P;
vector<P> e[650][650];
int cost[650][650];

int solve(Pii s, Pii g) {
	memset(cost, 0x1f, sizeof(cost));
	deque<Pii> deq;
	deq.push_back(s);
	cost[s.first][s.second] = 0;

	while (!deq.empty()) {
		Pii cur = deq.front(); deq.pop_front();
		if (cur == g) 
            return cost[g.first][g.second];
		for (auto to : e[cur.first][cur.second]) {
			int nf, ns;
			tie(nf, ns) = to.first;
			int ncost = cost[cur.first][cur.second] + to.second;
			if (ncost < cost[nf][ns]) {
				cost[nf][ns] = ncost;
				if (to.second == 0) {
					deq.push_front(Pii(nf, ns));
				} else {
					deq.push_back(Pii(nf, ns));
				}
			}
		}
	}

	return -1;
}

int main() {
	int m; cin >> w >> h >> m;
	vector<int> cx, cy;
	cx.push_back(0);
	cx.push_back(1);
	cx.push_back(w - 1);
	cx.push_back(w);
	cy.push_back(0);
	cy.push_back(1);
	cy.push_back(h - 1);
	cy.push_back(h);
	vector < pair<Pii, Pii>> seg;

	FOR(i, m) {
		int pa, pb, qa, qb;
		cin >> pa >> pb >> qa >> qb;
		seg.emplace_back(Pii(pa, pb), Pii(qa, qb));
		if (pa > qa || pb > qb) swap(seg.back().first, seg.back().second);
		if(pa - 1 >= 0) cx.push_back(pa - 1);
		cx.push_back(pa);
		if (pa + 1 <= w) cx.push_back(pa + 1);
		if (qa - 1 >= 0) cx.push_back(qa - 1);
		cx.push_back(qa);
		if (qa + 1 <= w) cx.push_back(qa + 1);

		if (pb - 1 >= 0) cy.push_back(pb - 1);
		cy.push_back(pb);
		if (pb + 1 <= h) cy.push_back(pb + 1);
		if (qb - 1 >= 0) cy.push_back(qb - 1);
		cy.push_back(qb);
		if (qb + 1 <= h) cy.push_back(qb + 1);
	}
	compress(cx); compress(cy);
	auto co = [&cx, &cy](Pii xy) {
		int a = lower_bound(cx.begin(), cx.end(), xy.first) - cx.begin();
		int b = lower_bound(cy.begin(), cy.end(), xy.second) - cy.begin();
		return Pii(a, b);
	};
	tie(w, h) = co(Pii(w, h));

	FOR(i, m) {
		seg[i].first = co(seg[i].first);
		seg[i].second = co(seg[i].second);
	}

	FOR(x, sz(cx) - 2) FOR(y, sz(cy) - 1) {
		int nx = x + 1, ny = y;
		int c = 0;
		for (auto& s : seg) {
			if (s.first.first != nx) continue;
			if (s.second.first != nx) continue;
			if (s.first.second <= y && y < s.second.second) c = 1;
		}
		e[x][y].push_back(P(Pii(nx, ny), c));
		e[nx][ny].push_back(P(Pii(x, y), c));
	}
	FOR(x, sz(cx) - 1) FOR(y, sz(cy) - 2) {
		int nx = x , ny = y + 1;
		int c = 0;
		for (auto& s : seg) {
			if (s.first.second != ny) continue;
			if (s.second.second != ny) continue;
			if (s.first.first <= x && x < s.second.first) c = 1;
		}
		e[x][y].push_back(P(Pii(nx, ny), c));
		e[nx][ny].push_back(P(Pii(x, y), c));
	}

	int q; cin >> q;
	FOR(i, q) {
		int a, b, c, d; cin >> a >> b >> c >> d;
		Pii s(a, b), g(c, d);
		s = co(s); s.first--; s.second--;
		g = co(g); g.first--; g.second--;

		int ans = solve(s, g);
		cout << ans << endl;
	}
}

Measured memory_bytes: 23020
#!/usr/bin/perl

my ($n,$k) = map { $_ - 0 } split(/\s+/,<STDIN>);
my @aa = map { $_ - 0 } split(/\s+/,<STDIN>);

my $mb = 10 ** 9 + 7;

my @mi1 = ();
my @pl1 = ();
my $n_zero = 0;

for(my $i=0;$i<$n;$i++){
  push(@mi1,$aa[$i]) if $aa[$i]<0;
  push(@pl1,$aa[$i]) if $aa[$i]>0;
  $n_zero ++ if $aa[$i] ==0;
}

my @mi2 = sort { abs($b) <=> abs($a) } @mi1;
my @pl2 = sort { abs($b) <=> abs($a) } @pl1;

if( $n_zero > $n - $k ){
  print "0\n"; exit(0);
}

my $ans_plus = -1;

my $n_pl = $k;
my $n_mi = 0;
while( $n_pl > @pl2 ){
  $n_pl -= 2;
  $n_mi += 2;
}

if( $n_mi <= @mi2 and $n_pl>=0 ){
  while( $n_pl >=2 and ($n_mi + 2 <= @mi2) and $mi2[$n_mi] * $mi2[$n_mi + 1] > $pl2[$n_pl-2] * $pl2[$n_pl-1] ){
    $n_pl -= 2;
    $n_mi += 2;
  }
  $ans_plus = 1;
  for(my $i=0;$i<$n_pl;$i++){
    $ans_plus = ( $ans_plus * ( $pl2[$i] ) ) % $mb;
  }
  for(my $i=0;$i<$n_mi;$i++){
    $ans_plus = ( $ans_plus * ( abs($mi2[$i]) ) ) % $mb;
  }
}

if( not ( $ans_plus < 0 ) ){
  print "$ans_plus\n"; exit(0);
}

if( $ans_plus < 0 and $n_zero > 0 ){
  print "0\n"; exit(0);
}

# マイナスにしかなりようがない
my $n_pl = $k-1;
my $n_mi = 1;
while( $n_pl > @pl2 ){
  $n_pl -= 2;
  $n_mi += 2;
}

while( $n_pl >=2 and ($n_mi + 2 <= @mi2) and $mi2[$n_mi] * $mi2[$n_mi + 1] < $pl2[$n_pl-2] * $pl2[$n_pl-1] ){
  $n_pl -= 2;
  $n_mi += 2;
}
my $ans_minus = 1;
for(my $i=0;$i<$n_pl;$i++){
  $ans_minus = ( $ans_minus * ( $pl2[$#pl2 - $i] ) ) % $mb;
}
for(my $i=0;$i<$n_mi;$i++){
  $ans_minus = ( $ans_minus * ( abs($mi2[$#mi2 - $i]) ) ) % $mb;
}

$ans_minus = $mb - $ans_minus;

print "$ans_minus\n";



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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()

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

  int N;
  cin >> N;
  int a[1000];
  int max = -99999999;
  int min = 99999999;
  rep(i, N) {
    cin >> a[i];
  }
  sort(a, a + N);
  cout << a[N - 1] - a[0] << endl;
}


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

int main()
{
	int a, b ;
	cin >> a >> b;
	for (int i = 1; i <= 10000; i++) {
		if (i * 8 / 100 == a && i * 10 / 100 == b) {
			cout << i << endl;
			return 0;
		}

	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <string>
using namespace std;
 
int main() {
  string n;//nは鉛筆の数
  cin >> n;
  //cout << n.back() <<endl;
  
   if(n.back() == '6' || n.back() == '8' || n.back() == '1' || n.back() == '0'){
    cout << "pon";
  }else if(n.back() == '3'){
    cout<< "bon" ;
  }else{
    cout << "hon";
  }
   
 

}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<string> vs;
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);

int main() {
    int N;
    cin >> N;
    vi counts(4, 0);
    rep(i, N) {
        string s;
        cin >> s;
        if (s == "AC")
            counts[0]++;
        else if (s == "WA")
            counts[1]++;
        else if (s == "TLE")
            counts[2]++;
        else
            counts[3]++;
    }
    cout << "AC x " << counts[0] << endl;
    cout << "WA x " << counts[1] << endl;
    cout << "TLE x " << counts[2] << endl;
    cout << "RE x " << counts[3] << endl;
}

Measured memory_bytes: 3632
#include <cstdio>

int main()
{
  long long x, y;
  scanf("%lld%lld", &x, &y);
  if (x % y == 0)
  {
    puts("-1");
    return 0;
  }
  printf("%lld\n", x * (y - 1));
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] s = {60,80,100,120,140,160};
		int[] w = {2,5,10,15,20,25};
		int[] p = {600,800,1000,1200,1400,1600,0};
		while(true){
			int n = sc.nextInt();
			if(n==0)break;
			int t = 0;
			for(int i=0;i<n;i++){
				int size = sc.nextInt()+sc.nextInt()+sc.nextInt();
				int we = sc.nextInt();
				int k = 0;
				while(k<6 && !(size<=s[k]&&we<=w[k]))k++;
				t+=p[k];
			}
			System.out.println(t);
		}
	}
}

Measured memory_bytes: 58440
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
static const int dx[4] = { 0, 1, 0, -1 };
static const int dy[4] = { 1, 0, -1, 0 };
static const char dir[4] = { 'u', 'r', 'd', 'l' };
static const ll INF = 1 << 21;
static const ll MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll N, cnt = 0;
    cin >> N;
    for (int i = 1; i <= N/2; i++) {
        if (i != N - i) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

using namespace std;
int main(void){
    // Your code here!
    int a,b,c,d,mas=0;
    cin>>a>>b>>c>>d;
    while(1){
        if(d<=0){
            break;
        }
        if(a>0){
            mas++;
            a--;
        }else if(b>0){
            b--;
        }else{
            mas--;
            c--;
        }
        d--;
    }
    cout<<mas<<endl;
}


Measured memory_bytes: 3588
N, M = map(int, input().split())
X = list(map(int, input().split()))

if N >= M:
    print(0)
else:
    X.sort()
    l = X[-1] - X[0]
    d = [X[i + 1] - X[i] for i in range(M - 1)]
    d.sort(reverse=True)
    result = l - sum(d[:N - 1])
    print(result)

Measured memory_bytes: 13960
#include<bits/stdc++.h>
using namespace std;
int n, sum = 0;
int main () {
  ios_base :: sync_with_stdio (0);
  cin.tie (nullptr);
  cout.tie (nullptr);
  cin >> n;
  for (int i = 1; i <= n; ++ i) {
    int tmp = i, s = 0;
    while (tmp != 0) {
      ++ s;
      tmp /= 10;
    }
    if (s % 2 == 1) {
      ++ sum;
    }
  }
  cout << sum;
}


Measured memory_bytes: 256
// AOJ???????????¨16/18??§WA.????????????????????±????????§????????\????????????.

#include <iostream>
using namespace std;
int main(){
int n,m,l;
long A[100][100],B[100][100],C[100][100] = {};
cin>>n>>m>>l;

//??????A
for (int i = 0; i < n ; ++i) {
for (int j = 0; j < m ; ++j) {
cin>>A[i][j];
}
}

//??????B
for (int i = 0; i < m ; ++i) {
for (int j = 0; j < l ; ++j) {
cin >> B[i][j];
}
}

//??????C
for (int i = 0; i < n ; ++i) {
for (int j = 0; j < l ; ++j) {
for (int k = 0; k < m ; ++k) {
C[i][j] += A[i][k]*B[k][j];
}
}
}
//??????
for (int i = 0; i < n ; ++i) {
for (int j = 0; j < l-1 ; ++j) {
cout<<C[i][j]<<" ";
}
cout << C[i][l-1] << endl;
}
return 0;
}

Measured memory_bytes: 1400
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

using namespace std;



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

  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;

  double limit = 100.0 * E / (100 + E);

  double pct = -1.;
  int w = 0;
  int s = 0;

  for (int a = 0; a <= F; a += A * 100) {
    for (int b = 0; b <= F; b += B * 100) {
      for (int c = 0; c <= F; c += C) {
        for (int d = 0; d <= F; d += D) {
          if (a + b > 0 && a + b + c + d <= F) {
            double tmp = 100.0 * (c + d) / (a + b + c + d);
            if (pct <= tmp && tmp <= limit) {
              pct = tmp;
              w = (a + b + c + d);
              s = c + d;
            }
          }
        }
      }
    }
  }

  cout << w << " " << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    int input [3];
    int x = 0;
    int n = 0;
    int m = 0;
    //ringring -- work
    for (int i = 0; i< 3; i++){
        cin>> input[i];
    }
    //find greatest
    for (int i = 0; i< 3; i++){
        if (input[i]>=n){
            n = input[i];
            m = i;
        }
    }
    //add other two
    for (int i = 0; i< 3; i++){
        if (i == m){
            continue;
        }
        else {
            x+= input[i];
        }
    }
    cout << x;
}

Measured memory_bytes: 256
#include <stdio.h>
long a[100001];
int main(void){
    long N,K,i,x,y;
    scanf("%ld%ld",&N,&K);
    for(i=0;i<N;i++){
        scanf("%ld%ld",&x,&y);
        a[x]+=y;
    }
    long g=0;
    for(i=0;i<100001;i++){
        g+=a[i];
        if(g>=K) break;
    }
    printf("%ld\n",i);
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<=(int)k;i++)
#define per(i,j,k) for(int i=(int)j;i>=(int)k;i--)
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long LL;
const int P=1000000007;
inline void add(int &a,int b){a+=b;if(a>=P)a-=P;}
inline void dec(int &a,int b){a-=b;if(a<0)a+=P;}
inline int Pow(int a,int b){
	int c=1;
	for(;b;b>>=1,a=a*1ll*a%P)if(b&1)c=c*1ll*a%P;
	return c;
}
const int N=65;
LL n;int m;
int a[N];
int f[N][2][3];
int dp(){
	f[0][0][1]=1;
	rep(i,0,m)rep(j,0,1)rep(k,0,2)if(f[i][j][k]){
		//0
		int nk=0;
		if(j==a[i+1])nk=k;
		else if(j<a[i+1])nk=0;
		else nk=2;
		add(f[i+1][0][nk],f[i][j][k]);
		add(f[i+1][1][nk],f[i][j][k]);
		//1
		int val=j^1;
		if(val==a[i+1])nk=k;
		else if(val<a[i+1])nk=0;
		else nk=2;
		add(f[i+1][j][nk],f[i][j][k]);
	}
	int ans=0;
	add(ans,f[m+1][0][1]);
	add(ans,f[m+1][0][0]);
	return ans;
}
int main(){
	scanf("%lld",&n);
	for(;n;n/=2ll)a[++m]=n&1;
	printf("%d\n",dp());
	return 0;
}







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

int main() {
	int n, tmp = 0, ans;
	char s[300000];
	cin >> n >> s;
	for (int i = 0; i < n; i++)
		if (s[i] == 'E')tmp++;
	ans = tmp;
	if (s[0] == 'E')tmp--;
	for (int i = 0; i < n - 1;) {
		if (s[i] == 'W')tmp++;
		if (s[++i] == 'E')tmp--;
		ans = min(ans, tmp);
	}

	cout << ans << "\n";
	return 0;
}

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

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, init, n) for(ll i = init; i <(ll)(n); i++)

int main() {

    ll N;
    cin >> N;
    ll a;
    map<ll, ll> m;
    REP(i, N){
        cin >> a;
        m[a]++;
    }
    ll ans = 0;
    for(auto iter : m){
        if (iter.first <= iter.second) ans += iter.second - iter.first;
        else ans += iter.second;
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 6272
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n;
  cin >> n;
  long loss=0;
  int count=0;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  for(int i = 0;i<n;i++){
    cin >> a[i];
  }
  for(int i = 0;i<n;i++){
    cin >> b[i];
  }
  for(int i = 0;i<n;i++){
    c[i]=a[i]-b[i];
    if(c[i]<0){
      count++;
      loss+=c[i];
    }
  }
  if(count==0){
    cout << 0;
    return 0;
  }
  sort(c.begin(),c.end());
  int i=n-1;
  while(loss<0&&c[i]>0){
    loss+=c[i];
    i--;
    count++;
  }
  if(loss<0)
    cout << -1;
  else
    cout << count;
  return 0;
}


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

int beki2(long long n){
    int cnt=0;
    while(n%2==0){
        cnt++;
        n /=2;
    }
    return cnt;
}

int main(){
    int N;
    cin >> N;
    long long ans=0;
    for(int i=0; i<N; i++){
        long long a;
        cin >> a;
        ans += beki2(a);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
def main():
    Q = int(input())

    def Eratosthenes(sup: int) -> set:
        primes = [True for i in range(sup+1)]
        primes[0] = False
        primes[1] = False
        for i in range(2, sup+1):
            if sup < i*i:
                break
            if primes[i]:
                mul = 2
                while i*mul <= sup:
                    primes[i*mul] = False
                    mul += 1
        return {i for i in range(sup+1) if primes[i]}
    primes = Eratosthenes(10**5)
    S = [0]*(10**5+1)
    for a in range(2, 10**5+1):
        if a in primes and (a+1)//2 in primes:
            S[a] = 1
        S[a] += S[a-1]

    for _ in range(Q):
        le, ri = (int(i) for i in input().split())
        print(S[ri] - S[le-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 80396
import java.util.*;

class Main {
 public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int a = Integer.parseInt(sc.next());
  int b = Integer.parseInt(sc.next());
  sc.close();

  if ( a==b ) {
   System.out.println("a == b");
  }else if ( a > b ){
   System.out.println("a > b");
  }else{
   System.out.println("a < b");
  }
 }
}


Measured memory_bytes: 26028
n = int(input())
A = list(map(int, input().split()))

cash = 1000
stocks = 0

buy = []
sell = []

trend = 'down'

for i in range(n-1):
    if trend == 'down':

        if A[i] >= A[i+1]:
            continue
        else:
            trend = 'up'
            buy.append(i)
            if i == n-2:
                sell.append(i+1)
    # 'up'
    else:
        if A[i] <= A[i+1]:
            if i == n-2:
                sell.append(i+1)
            continue
        else:
            trend = 'down'
            sell.append(i)

while len(buy) and len(sell):
    b = buy.pop(0)
    count = cash // A[b]
    cash -= A[b] * count
    stocks += count

    s = sell.pop(0)
    cash += A[s] * stocks
    stocks = 0

print(cash)


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

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

int h, w;
vector<string> s;
vector<vector<bool>> v;

array<int, 2> dfs(int y, int x) {
  array<int, 2> r = {0, 0};
  r[s[y][x] == '#']++;
  for (int i = 0; i < 4; i++) {
    int ny = y + dy[i], nx = x + dx[i];
    if (!(0 <= ny && ny < h && 0 <= nx && nx < w) || v[ny][nx] || s[ny][nx] == s[y][x]) continue;
    v[ny][nx] = true;
    auto t = dfs(ny, nx);
    r[0] += t[0];
    r[1] += t[1];
  }
  return r;
}

int main() {
  cin >> h >> w;
  s = vector<string>(h);
  v = vector<vector<bool>>(h, vector<bool>(w));
  for (auto &e : s) {
    cin >> e;
  }
  ll r = 0;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (v[i][j]) continue;
      v[i][j] = true;
      auto t = dfs(i, j);
      r += (ll)t[0] * t[1];
    }
  }
  cout << r << endl;
}


Measured memory_bytes: 20480