akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <vector>
using namespace std;

int main() {
	int N;
	cin >> N;
	int a, b;

	if (99 < N < 1000) {
		a = N % 100;
		b = a % 10;
	}
	else if (9 < N < 100) {
		b = N % 10;
	}
	else b = N;

	if (b == 2 || b == 4 || b == 5 || b == 7 || b == 9) cout << "hon";
	if (b == 0 || b == 1 || b == 6 || b == 8) cout << "pon";
	if (b == 3) cout << "bon";

	return 0;
}

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

int main() {
  int n,d;cin>>n>>d;
  int ans=0;
  vector<vector<int>> x(n,vector<int>(d));
  rep(i,n)rep(j,d)cin>>x[i][j];
  rep(i,n-1)for(int j=i+1;j<n;j++){
    int cnt=0;
    rep(k,d){
      cnt+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
    }
    for(int k=1;k<=sqrt(cnt);k++){
      if(k*k==cnt){
        ans++;
        break;
      }
    }
  }
  cout<<ans<<endl;
}

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

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define SORT(v, n) sort(v, v+n);
#define SSORT(v, n) sort(v, v+n, greater<int>())

int main(){
	int a[3];
	REP(i,3) cin >> a[i];
	SSORT(a,3);
	cout << a[0]-a[2] << endl;
}

Measured memory_bytes: 256
/*
	Auther:_Destiny
	time:2020.5.17
*/

#include <bits/stdc++.h>
#define ll long long
#define N 100010
#define M 1010

using namespace std;
double a, b, h, m;
double  pi = 3.141592653589793238462643383279;

int read() {
	int s = 0, f = 0; char ch = getchar();
	while (!isdigit(ch)) f |= (ch == '-'), ch = getchar();
	while (isdigit(ch)) s = s * 10 + (ch ^ 48), ch = getchar();
	return f ? -s : s;
}

int main() {
	a = read(), b = read(), h = read(), m = read();
	double jiao = fabs((pi / 6 * h) + pi / 360 * m - (pi / 30 * m));
	double ans = sqrt(a * a + b * b - 2 * a * b * cos(jiao));
	printf("%.10lf", ans);
}


Measured memory_bytes: 4156
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!

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

    string to_string(const string& s) { return '"' + s + '"'; }
    void debug_out() { cout << endl; }
    template <typename Head, typename... Tail>
    void debug_out(Head H, Tail... T) { cout << " " << to_string(H); debug_out(T...); }
    #ifdef LOCAL
        #define debug(...) cout << "#" << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
    #else
        #define debug(...) 3;
    #endif

    #define fast_io ios_base::sync_with_stdio(false); \
                    cin.tie(nullptr); cout.tie(nullptr);
    using ld = long double;  using ui = uint_fast32_t;
    using ll = int_fast64_t; using ul = uint_fast64_t;

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

void solve() {
    string s;
    cin >> s;
    s.insert(4, " ");
    cout << s << '\n';
}

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

int main() {
    fast_io; int t = 1;
    // cin >> t;
    for (int i = 1; i <= t; ++i) solve();
}

Measured memory_bytes: 256
n,m  = map(int,input().split())
l = list(map(int,input().split()))
l = [0]+l
s = set()
for i in range(1,n+1):
    s.add(i)

d = {}
for i in range(m):
    a,b = map(int,input().split())
    if a in s:
        s.remove(a)

    if b in s:
        s.remove(b)

    if a in d:
        c = d[a]
        c.append(b)
        d[a] = c

    else:
        d[a] = [b]

    if b in d:
        c = d[b]
        c.append(a)
        d[b] = c

    else:
        d[b] = [a]


cnt = len(s)
for o in d:
    p = d[o]
    x = l[o]
    f = 0
    for i in p:
        if x <= l[i]:
            f = 1
            break

    if f == 0:
        cnt = cnt+1

print(cnt)

Measured memory_bytes: 38068
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)
int main(){
int H, W, M, u, v; cin >> H >> W >> M; int h[M], w[M]; long maxh=0, maxw=0;
vector<int> histH, histW; unordered_map<int, long> seenH, seenW;
REP(i, M){ 
  cin >> h[i] >> w[i]; h[i]--; w[i]--;
  if(!seenH[h[i]]){ histH.push_back(h[i]); }
  if(!seenW[w[i]]){ histW.push_back(w[i]); }
  seenH[h[i]]++; maxh=max(maxh, seenH[h[i]]);
  seenW[w[i]]++; maxw=max(maxw, seenW[w[i]]);
}
vector<int> kohoH, kohoW;
REP(i, histH.size()){ u=histH[i]; if(maxh==seenH[u]){ kohoH.push_back(u); } }
REP(i, histW.size()){ v=histW[i]; if(maxw==seenW[v]){ kohoW.push_back(v); } }
long ans=maxh+maxw, t=0, r=kohoH.size(), s=kohoW.size(); 
REP(i, M){ if(seenH[h[i]]==maxh&&seenW[w[i]]==maxw){ t++; } }
if(t==r*s){ ans--; }
cout << ans << "\n";
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9

using namespace std;
typedef long long int lli;
typedef long long ll;

int main() {
    int a,b;
    char op;
    cin >> a >> op >> b;

    int ans;
    if(op == '+') ans = a+b;
    else ans = a-b;

    cout << ans << endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
n=int(input())
a=[[] for i in range(n)]
for i in range(n-1):
    u,v,w=map(int,input().split())
    a[u-1].append((v-1,w))
    a[v-1].append((u-1,w))
b=[None for i in range(n)]
def k(v,dis):
    b[v]=dis
    for next_v,w in a[v]:
        if b[next_v]!=None:
            continue
        if w%2==0:
            k(next_v,dis)
        else:
            k(next_v,1-dis)
k(0,0)
for i in range(n):
    print(b[i])


Measured memory_bytes: 162592
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using l = long;
using vi = vector<int>;
using vl = vector<l>;
using vll = vector<ll>;
using vvl = vector<vector<l>>;
using vvll = vector<vector<ll>>;
using pll = pair<ll, ll>;
using un = unsigned;

int main()
{
	ll a;
	double b;
	cin >> a >> b;
	ll tmp = b * 100 + 0.1;
	ll res = a * tmp;
	cout << res / 100;
}


Measured memory_bytes: 3660
/* template.cpp [[[ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)s)
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)s)
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int INF = 1e9 + 10;
const ll INF_LL = 1e18 + 10;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
/* ]]] */

int main(){
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  cout << a + b + c + d - min({a, b, c, d}) + max(e, f) << endl;
}

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

int main()
{
	int n,ans = 0;
	cin >> n;
	int* d;
	d = new int[n];

	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}

	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			ans += d[i] * d[j];
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int n,w,a[2008];
int main()
{
	cin>>n>>w>>w;
	for(int i=1;i<=n;++i){
		cin>>a[i];
	}
	if(n>=2)	cout<<max(abs(w-a[n]),abs(a[n]-a[n-1]));
	else{
		cout<<abs(w-a[n]);
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }
const ll mod = (ll) 1e9 + 7;

ll modPow(ll n, ll k){
	if(k == 0) return 1;
	if(n == 0) return 0;
	ll x = n;
	ll ret = 1;
	while(k > 0){
		if(k % 2 == 1){ ret *= x; if(ret >= mod) ret %= mod; }
		x *= x; if(x >= mod) x %= mod;
		k >>= 1;
	}
	return ret;
}

ll modInv(ll x){
	return modPow(x, mod - 2);
}



int main(){
	
	int N;
	ll M;
	cin >> N >> M;
	
	if(M == 1){
		cout << 1 << endl;
		return 0;
	}
	if(N == 1){
		cout << 1 << endl;
		return 0;
	}
	
	int MM = 200000;
	vector<ll> fact(MM);
	fact[0] = fact[1] = 1;
	for(int i=2;i<MM;i++) fact[i] = fact[i-1] * i % mod;
	vector<ll> finv(MM);
	for(int i=0;i<MM;i++) finv[i] = modInv(fact[i]);
//for(int i=1;i<10;i++) cerr << fact[i] << "*" << finv[i] << "=" << (finv[i] * fact[i] % mod) << endl;
	ll ans = 1;
	for(int i=2;i*i<=M;i++){
		if(M % i != 0) continue;
		int cnt = 0;
		while(M % i == 0){
			cnt++;
			M /= i;
		}
		ll comb = fact[N - 1 + cnt] * finv[N - 1] % mod * finv[cnt] % mod;
		ans *= comb; ans %= mod;
	}
	
	if(M > 1){
		ll comb = fact[N - 1 + 1] * finv[N - 1] % mod * finv[1] % mod;
		ans *= comb; ans %= mod;
	}
	
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect_left
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def primes_for(n):
   is_prime = [True] * (n + 1)
   is_prime[0] = False
   is_prime[1] = False
   for i in range(2, n + 1):
       for j in range(i * 2, n + 1, i):
           is_prime[j] = False
   return [i for i in range(n + 1) if is_prime[i]]

prime_list = primes_for(10**6)
is_prime = [0]*10**6
for n in prime_list:
  is_prime[n] = 1

cnt = [0] * 10**6
for i in range(2, 10**6):
  if is_prime[i]:
    cnt[i] = cnt[i-1] + 1
  else:
    cnt[i] = cnt[i-1]

while 1:
  try:
    n = INT()
    print(cnt[n])
  except:
    sys.exit()



Measured memory_bytes: 28216
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <math.h>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
// std::ios::sync_with_stdio(false);
typedef long long LL;
const LL N = 107;
const int M = 2000005;
const int INF = 0x3f3f3f3f;
const double Pi = acos(-1);
int n,m;
int t[5];
multiset <string> st;
string ch(int x)
{
    if (x==0)
        return "a";
    if (x==1)
        return "b";
    return "c";
}
int main()
{
    cin.tie(0);
    std::ios::sync_with_stdio(false);
    while (cin>>t[0]>>t[1]>>t[2])
    {
        st.clear();
        for (int i=0;i<3;i++)
            for (int j=0;j<t[i];j++)
                st.insert(ch(i));
        while (st.size()>1)
        {
            multiset <string>::iterator l = st.begin();
            multiset <string>::iterator r = --st.end();
            st.insert(*l+*r);
            st.erase(l);
            st.erase(r);
        }
        cout<<*st.begin()<<endl;
    }
    return 0;
}

/*


*/


Measured memory_bytes: 256
#include<stdio.h>
int main(){

	int n,i,a[200],kazu=0,f=1;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	scanf("%d",&a[i]);
	
	while(f==1){

	for(i=0;i<n;i++){
		if(a[i]%2!=0){
	f=-1;}
	}
		if(0<f){
			for(i=0;i<n;i++){
			a[i]/=2;
				}
			kazu++;}
	}
	printf("%d",kazu);
return 0;
}
	

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int N = 1e8 + 10;
using ll = long long;
using ull = unsigned long long;
const ll mod = 1e9 + 7;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	int ans = 0;
	while (n--)
	{
		int x;
		cin >> x;
		for (; x % 2 == 0; x /= 2)
			++ans;
	}
	cout << ans;
}


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

#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    ll n;
    cin>>n;
    
    ll a[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
    }
    ll count = 0;
    
    for(ll i=1;i<n-1;i++)
    {
        if((a[i]>a[i-1] && a[i]<a[i+1]) || (a[i]>a[i+1] && a[i]<a[i-1]))
        {
            count++;
        }
    }
    
    cout<<count<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(ll i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200020;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

//********************************template END****************************************//

void solve(void){

	ll N;
	cin >> N;

	cout << (N & 1 ? N * 2 : N) << endl;

}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int64_t n;cin>>n;
    int64_t a[n];for(int i=0;i<n;i++) cin>>a[i];
  	int64_t dp[n];
  	dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
  	for(int i=2;i<n;i++){
     dp[i]=min(dp[i-2]+abs(a[i]-a[i-2]) , dp[i-1]+abs(a[i]-a[i-1])); 
    }
    cout<<dp[n-1];
    return 0;
}

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main() {
  ll n , x ; 
  cin >> n >> x ;
  vector<ll>vec(n);
  rep(i,n){
    cin>>vec[i];
  }
  sort(vec.begin(),vec.end());
  int sum=0;
  rep(i,n){
    x-=vec[i];
    if(x<0){
      break;
    }
    if(x>=0)sum++;
    if(i==n-1 && x>0) sum--;
  }
  cout<<sum<<endl;
  
}



Measured memory_bytes: 256
n,k=map(int,input().split())
p=list(map(int,input().split()))
e=[]
for pp in p:
    e.append((pp+1)/2)
ans=0
t=0
for i in range(n-k+1):
    if i==0:
        t=sum(e[:k])
        ans=t
        continue
    t-=e[i-1]
    t+=e[i+k-1]
    ans=max(ans,t)
print(ans)



Measured memory_bytes: 25060
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define N 1000000007
#define ll long long
#define ull unsigned long long
#define mem(a) memset(a,0,sizeof(a))
ll aa[100010];
ll bb[100010];
ll cc[100010];
ll dd[200010];
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int a, b, c, x, y;
    cin >> x >> y >> a >> b >> c;
    for(int i = 0; i < a; i++) cin >> aa[i];
    for(int i = 0; i < b; i++) cin >> bb[i];
    for(int i = 0; i < c; i++) cin >> cc[i];
    sort(aa,aa+a);
    sort(bb,bb+b);
    sort(cc,cc+c);
    ll sum = 0;
    int k = 0;
    for(int i = a-x; i < a; i++) dd[k++] = aa[i];
    for(int i = b-y; i < b; i++) dd[k++] = bb[i];
    sort(dd,dd+k);
    int q = c-1;
    for(int i = 0; i < k; i++){
        if(cc[q]>dd[i]){
            dd[i] = cc[q];
            q--;
        }
        sum += dd[i];
    }
    cout << sum << endl;
    return 0;
}







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

int main() {
  int b=0, r=0;
  string s;
  cin >> s;
  for(char c:s) {
     if(c=='0') r++;
     else b++;
  }
  cout << min(b,r) * 2 << endl;
  return 0;
}

Measured memory_bytes: 512
import java.io.*;
import java.util.*;

public class Main {
	FastScanner in = new FastScanner(System.in);
	PrintWriter out = new PrintWriter(System.out);

	public void run() {
		main : while (true) {
			int n = in.nextInt();
			if (n == 0) break;
			int[][] p = new int[n][];
			for (int i = 0; i < p.length; i++) {
				int m = in.nextInt();
				p[i] = new int[m];
				for (int j = 0; j < m; j++) {
					p[i][j] = in.nextInt();
				}
			}
			
			int m = in.nextInt();
			int[] k = new int[m];
			for (int i = 0; i < k.length; i++) {
				k[i] = in.nextInt();
			}
			
			int res = -1;
			for (int i = 0; i < p.length; i++) {
				boolean flag = true;
				loop : for (int j = 0; j < k.length; j++) {
					for (int l = 0; l < p[i].length; l++) {
						if (p[i][l] == k[j]) continue loop; 
					}
					flag = false;
				}
				if (flag) {
					if (res != -1) {
						System.out.println(-1);
						continue main;
					} else
						res = i + 1;
				}
			}
			
			System.out.println(res);
		}
		out.close();
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}

		System.out.println("----------------------------");
		System.out.println();
	}

	public void debug(Object... obj) {
		System.out.println(Arrays.deepToString(obj));
	}

	class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
			//stream = new FileInputStream(new File("dec.in"));

		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}

Measured memory_bytes: 38768
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>

using namespace std;

int main(){
    
    string S, T; cin >> S >> T;

    bool flag = true;

    map <char, int> Smap;

    for (int i = 0; i < S.length(); i++){
        Smap[S[i]] ++;
    }
    for (int i = 0; i < T.length(); i++){
        if (Smap[T[i]] == 0){
            flag = false;
            break;
        }
    }
    
    if (flag == true){
        int Slong = S.length();

        int DP[Slong + 1][26];
        for (int i = 0; i < Slong + 1; i++){
            for (int j = 0; j < 26; j++){
                DP[i][j] = -1;
            }
        }

        for (int i = S.length() - 1; i >= 0; i--){
            int A = S[i] - 'a';
            for (int j = 0; j < 26; j++){
                DP[i][j] = DP[i + 1][j];
            }
            DP[i][A] = i + 1;
        }
        
        long long ans = 0, loop = 0;
        
        for (int i = 0; i < T.length(); i++){
            int A = T[i] - 'a';

            if (DP[ans % Slong][A] != -1){
                ans = loop * Slong + DP[ans % Slong][A];
                if (ans % Slong == 0) loop++;
            }else{
                loop++;
                ans = loop * Slong + DP[0][A];
            }
        }
        cout << ans << endl;

    }else{
        cout << -1 << endl;
    }

    return 0;
}

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

int main(){
    string s; cin >> s;
    if(s[0] == s[1] && s[1] == s[2]) cout << "No" << endl;
    else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}


void solve(long long N, long long K){
    int ans=0;
    while(N!=0){
        N/=K;
        ans++;
    }
    cout<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#define int long long
const int N=1000002,M=998244353;
#define For(i,x,y) for(register int i=(int)(x);i<=(int)(y);i++)
#define Rep(i,x,y) for(register int i=(int)(x);i>=(int)(y);i--)
int pw(int x,int y){int z=1;for(;y;y>>=1,x=1ll*x*x%M)if(y&1)z=1ll*z*x%M;return z;}
signed main(){
	int n;
	scanf("%d",&n);
	printf("%d",(n-1)/2);
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
    int X,N; cin>>X>>N;
    set<int> p;
    rep1(i,105)p.insert(i);
    p.insert(0);
    rep1(i,105)p.insert(-i);
    rep(i,N){
        int a; cin>>a;
        p.erase(a);
    }
    if(p.count(X)){
        cout<<X<<endl;
        return 0;
    }
    rep1(i,105){
        int tmp = X-i;
        if(p.count(tmp)){
            cout<<tmp<<endl;
            return 0;
        }

        tmp = X+i;
        if(p.count(tmp)){
            cout<<tmp<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3644
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

using namespace std;

typedef long long ll;

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  ll N, M; cin >> N >> M;
  if(N == 1 && M == 1) cout << 1 << endl;
  else if(N == 1) cout << M - 2 << endl;
  else if(M == 1) cout << N - 2 << endl;
  else cout << (N - 2)*(M - 2) << endl;
}

Measured memory_bytes: 256
n,x,y = list(map(int,input().split()))

ans=[]
for i in range(1,n+1):
    for j in range(i+1,n+1):
        direct = abs(i-j)
        path = min( abs(x-i)+1+abs(y-j), abs(y-i)+1+abs(x-j) )
        ans.append(min(direct,path))

from collections import Counter
c=Counter(ans)

for i in range(1,n):
    print(c[i])

Measured memory_bytes: 119268
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e9+7
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 long long int gcd(long long int m,long long int n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
long long int lcm(long long int number1,long long int number2){
	return number1 * number2 / gcd(number1,number2);	

}
int main(){
  ll N,K;
  cin>>N>>K;
  
  vector<ll>A(N);
  
  rep(i,N){
    cin>>A[i];
  }
  
  if(N==K){
cout<<1<<endl;
  }
  else if((N-K)%(K-1)==0){
    cout<<1+(N-K)/(K-1)<<endl;
  }
  else{
    cout<<2+(N-K)/(K-1)<<endl;
  }
}

Measured memory_bytes: 1024
#include <stdio.h>

int sort(const void *a, const void *b) {
	return (*(int*)a - *(int*)b);
}

int main(void) {
	int N;
	int a[100000] = { 0 };
	int ans = 0;

	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &a[i]);
	}
	qsort(a, N, sizeof(int), sort);

	for (int i = 0; i < N; i++) {
		if (a[i] == a[i + 1]) i++;
		else ans++;
	}

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

	return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

int n, m;

bool c[710][710];

V g[710];

int color[710];

vector<P> p;

bool check;

void dfs(int s, int t)
{
    if (color[s] != -1)
    {
        if (color[s] != t)
            check = false;
        return;
    }

    color[s] = t;

    if (t == 0)
        p[p.size() - 1].first++;
    else
        p[p.size() - 1].second++;

    for (int i = 1; i <= n; i++)
    {
        if (!c[i][s])
            dfs(i, 1 - t);
    }

    /*
    for (int i : g[s])
        dfs(i, 1 - t);
        */

    return;
}

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

    cin >> n >> m;

    REP(i, n)
    REP(j, n)
    c[i + 1][j + 1] = i + 1 == j + 1;

    REP(i, m)
    {
        int a, b;
        cin >> a >> b;

        c[a][b] = true;
        c[b][a] = true;
    }

    /*
    for (int i = 1; i <= n; i++)
    {
        for (int j = i + 1; j <= n; j++)
        {
            if (!c[i][j])
            {
                g[i].push_back(j);
                g[j].push_back(i);
            }
        }
    }
    */

    memset(color, -1, sizeof(color));

    check = true;

    while (true)
    {
        bool ch = false;
        for (int i = 1; i <= n; i++)
        {
            if (color[i] == -1)
            {
                p.push_back({0, 0});
                dfs(i, 0);
                ch = true;
            }
        }

        if (!ch)
            break;
    }

    if (!check)
    {
        cout << -1 << endl;
        return 0;
    }

    bool dp[2][1000];

    auto *cur = dp[0];
    auto *nex = dp[1];

    fill(cur, cur + n + 1, false);
    fill(nex, nex + n + 1, false);

    cur[0] = true;

    V num;

    REP(j, p.size())
    {
        for (int i = 0; i < 1000; i++)
        {
            if (!cur[i])
                continue;

            if (i + p[j].first < 1000)
                nex[i + p[j].first] = true;

            if (i + p[j].second < 1000)
                nex[i + p[j].second] = true;
        }

        swap(cur, nex);
        fill(nex, nex + n + 1, false);
    }

    int res = INT_MAX;

    for (int i = 0; i <= n; i++)
    {
        if (!cur[i])
            continue;

        int tmp = (i * (i - 1) / 2) + ((n - i) * (n - i - 1) / 2);
        res = min(res, tmp);
    }

    cout << res << endl;

    return 0;
}

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

using namespace std;

int main() {

  string s, n;
  cin>>s>>n;
  bool judge = false;

  for(int i = 0; i<s.size(); i++){
    if(s[i]==n[i] && n.size()==s.size()+1){
      judge = true;
    } else {
      judge = false;
      break;
    } 
  }

  if(judge) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3628
class Main {
    public static void main(final String[] args) {
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= 9; j++) {
                System.out.print(i + "x" + j + "=" + (i * j) + "\n");
            }
        }
    }
}

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

int main(){
  int n,mi=10000,s1,s2;cin>>n;
  vector<int> w(n,0);
  REP(i,n) cin>>w.at(i);
  REP(i,n-1){
    s1=s2=0;
    REP(j,n){
      j<=i?s1+=w.at(j):s2+=w.at(j);
    }
    mi=min(mi,abs(s1-s2));
  }
  cout<<mi;
}

Measured memory_bytes: 256
/* 2012-07-07T08:23:31 */
#define DEBUG_ON
#define CONDITION true
using namespace std;/*{{{*/

#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <sys/time.h>
#include <vector>

#define INF (1e9)
static const double PI (3.14159265358979323846);
static const double EPS (1e-10);

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef complex<double> P;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
inline double now(){ struct timeval tv; gettimeofday(&tv, NULL); return ((double)(tv.tv_sec) + (double)(tv.tv_usec) * 1e-6); }

#define FOR(i, b, e) for (typeof(b) i = (b); assert((i) <= (e)), i != (e); ++i)
#define REP(i, n) FOR(i, 0, n)

#define IFC(c) if(c) continue;
#define IFB(c) if(c) break;
#define IFR(c, r) if(c) return r;

#define OPOVER(_op, _type) inline bool operator _op (const _type &t) const

#define arrsz(a) ( sizeof(a) / sizeof(a[0]) )

#define F first
#define S second
#define MP(a, b) make_pair(a, b)

#define SZ(a) ((ll)a.size())
#define PB(e) push_back(e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(c,it) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define EXIST(s,e) ((s).find(e)!=(s).end())

#define BIT(n) (1ULL << (n))
#define BITOF(n, m) ((n) >> (m) & 1)

#define RANGE(a, b, c) ((a) <= (b) && (b) <= (c))

#ifdef DEBUG_ON
#define dprt(fmt, ...) if (CONDITION) fprintf(stderr, fmt, __VA_ARGS__)
#define darr(a) if (CONDITION) copy( (a), (a) + arrsz(a), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define darr_range(a, f, t) if (CONDITION) copy( (a) + (f), (a) + (t), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define dvec(v) if (CONDITION) copy( ALL(v), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define darr2(a, n, m) if (CONDITION) FOR(i, 0, (n)){ darr_range( (a)[i], 0, (m) ); }
#define dvec2(v) if (CONDITION) FOR(i, 0, SZ(v)){ dvec( (v)[i] ); }
#define WAIT() if (CONDITION) { string _wait_; cerr << "(hit return to continue)" << endl; getline(cin, _wait_); }
#else
#define cerr if(0) cerr
#define dprt(fmt, ...)
#define darr(a)
#define darr_range(a, f, t)
#define dvec(v)
#define darr2(a, n, m)
#define dvec2(v)
#define WAIT()
#endif
/*}}}*/

int main(int argc, char const* argv[])
{
	int a, b;
	while (cin >> a >> b) {
		cout << toString(a + b).length() << endl;
	}
	return 0;
}

Measured memory_bytes: 0
/*;

THE BEST IS YET TO COME

*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define r(i, s, l) for (int i = s; i < l; i++)
#define rr(i, s, l) for (int i = s; i >= l; i--)
#define mod 1000000007
#define INT_BITS 32
#define ld long double
#define pp pair<int, int>
#define ss second
#define ff first
#define INF 1e18
#define N 2000005
#define all(a) a.begin(), a.end()
#define pb push_back
#define vi vector<int>
#define vip vector<pair<int, int>>
#define endl "\n"
#define ln length()
#define sz size()
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

signed main()
{

    fast();

    int n, m;
    cin >> n >> m;

    char mat[n][m];
    int dp[n][m];

    r(i, 0, n)
            r(j, 0, m)
                cin >>
        mat[i][j];

    r(i, 0, n)
        r(j, 0, m)
            dp[i][j] = 0;

    r(i, 1, m)
    {
        if (mat[0][i - 1] == '.' && mat[0][i] == '.')
            dp[0][i] = 1;
        else
            break;
    }

    r(i, 1, n)
    {
        if (mat[i - 1][0] == '.' && mat[i][0] == '.')
            dp[i][0] = 1;
        else
            break;
    }
    
    r(i,1,n)
    {
        r(j,1,m)
        {
            if(mat[i][j] == '.' && mat[i-1][j] == '.' && mat[i][j-1]=='.')
            dp[i][j] = dp[i-1][j] + dp[i][j-1];
            else if(mat[i][j] == '.' && mat[i-1][j] == '.')
            dp[i][j] = dp[i-1][j];
            else if(mat[i][j] == '.' && mat[i][j-1]=='.')
            dp[i][j] = dp[i][j-1];

            dp[i][j] = (dp[i][j])%mod;
        }
    }

   
    cout<<dp[n-1][m-1];


    return 0;
}


Measured memory_bytes: 12448
#include <cstdio>
#include <cmath>
#include <limits>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdint>
#include <functional>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;

const ll mod = 1000000000 + 7; //10^9


int main() {
    int N, X;
    cin >> N >> X;
    vector<int> D(N+1);
    vector<int> L(N);
    D[0] = 0;
    for (auto &&i : L)
    {
        cin >> i;
    }
    for (int i = 0; i < N; i++)
    {
        D[i + 1] = D[i] + L[i];
    }
    int ans = 0;
    
    for (int i = 0; i < N + 1; i++)
    {
        if(D[i] <= X) ans++;
    }
    cout <<  ans << endl;
    
}

Measured memory_bytes: 3644
N = int(input())
T,A = map(int,input().split())
H = [i for i in map(int,input().split())]
best = 0
for i in range(N):
    if abs(A-(T-H[i]*0.006)) < abs(A-(T-H[best]*0.006)):
        best = i
print(best+1)

Measured memory_bytes: 3060
#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 <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#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(int i = 0; i < (int)(n); i++)
#define rep(i, init, n) for(int i = init; i <(int)(n); i++)

int main() {

    int N;
    cin >> N;
    vector<ll> a(N);
    map<ll, ll> m;
    REP(i, N) {
        cin >> a[i];
        m[a[i]]++;
    }
    ll total = 0;
    for (auto& p : m){
        total += p.second * (p.second - 1) / 2;
    }
    REP(i, N){
        cout << (total - m[a[i]] + 1) << endl;
    }

    return 0;
}


Measured memory_bytes: 11940
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n;
    cin >> n;
    string S[n];
    for(int i = 0; i < n; i++){
        cin >> S[i];
    }
    for(int i = 0; i < n-1; i++){
        if(S[i].at(S[i].size()-1) == S[i+1].at(0)){
            for(int j = i+1; j < n; j++){
                if(S[j] == S[i]){
                    cout << "No" << endl;
                    return 0;
                }
            }
        }else{
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}
 

Measured memory_bytes: 256
D, G = map(int, input().split(" "))
P, C = zip(*[map(int, input().split(" ")) for _ in range(D)])

sum_points = [100*(i+1)*P[i] + C[i] for i in range(D)]
P = list(P) + [0]
C = list(C) + [0]

min_num = 10**9
for i in range(1<<D):
	first_zero = -1
	point = 0
	q_count = 0
	for j in range(D-1, -1, -1):
		if (i>>j)%2 == 1:
			point += sum_points[j]
			q_count += P[j]
		elif first_zero == -1:
			first_zero = j
	# print(f"a: {point}, {q_count}")
	for j in range(P[first_zero]):
		if point >= G:
			min_num = min(min_num, q_count)
			break
		point += 100*(first_zero+1)
		q_count += 1
	point += C[first_zero]
	# print(f"b: {point}, {q_count}")
	if point >= G:
		min_num = min(min_num, q_count)

print(min_num)

Measured memory_bytes: 3064
import java.util.*;
class Main{
  static int mod = 998244353;
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] d = new int[n];
    long[] a = new long[n];
    for (int i=0;i<n;i++){
      d[i] = sc.nextInt();
      a[d[i]]++;
    }
    sc.close();
    if (d[0] != 0 || a[0] != 1){
      System.out.println(0);
      return;
    }
    long ans = 1;
    for (int i=1;i<n;i++){
      ans *= a[d[i]-1];
      ans %= mod;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 64880
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class B
{
	public static void Main()
	{
		int N = GetInt();
		int X = GetInt();
		int[] L = new int[N];
		for(int i = 0; i < N; i++)
			L[i] = GetInt();

		int[] D = new int[N+1];
		for(int i = 0; i < N; i++)
			D[i + 1] = D[i] + L[i];
		Console.WriteLine(D.Count(d => (d <= X)));
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


Measured memory_bytes: 13268
#include <iostream>

using namespace std;

int main() {
    int x, y;
    cin >> x >> y;
    int xg, yg;
    if(x==2) {
        xg = 2;
    } else if(x==4 || x==6 || x==9 || x==11) {
        xg = 4;
    } else {
        xg = 1;
    }
    if(y==2) {
        yg = 2;
    } else if(y==4 || y==6 || y==9 || y==11) {
        yg = 4;
    } else {
        yg = 1;
    }
    if(xg==yg) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }


    return 0;
    
}

Measured memory_bytes: 256
# include <algorithm>
# include <iostream>
# include <iterator>
# include <vector>
# include <string>
# include <queue>
# include <stack>
# include <cmath>
# include <set>


using namespace std;


int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (int i=0; i<n; ++i) cin >> a[i];

    vector<int> sa = a;
    sort(sa.begin(), sa.end(), greater<int>());

    for (int i=0; i<n; ++i) {
        if (a[i] == sa[0]) cout << sa[1] << endl;
        else cout << sa[0] << endl;
    }
    return 0;
}



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

int main() {
    int a, b;
    cin >> a >> b;

    int ans = 0;
    if (a >= b) {
        ans += a;
        a--;
    }
    else {
        ans += b;
        b--;
    }
    
    if (a >= b) ans += a;
    else ans += b;

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

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

int n, ans;
long long a[105];

int main() {
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> a[i];
        for (int j = 0; j < i; j++){
            if (a[j] == a[i]) continue;
            for (int k = 0; k < j; k++){
                if (a[k] == a[j] || a[k] == a[i]) continue;
                if (a[i] < a[j]+a[k] && a[j] < a[i]+a[k] && a[k] < a[i]+a[j]) ans++;
            }
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 3632
# -*- coding: utf-8 -*-
# case.rb

loop{ # 無限ループをするメソッド
  
  a, op, b = STDIN.gets.split(' ')
  a = a.to_i
  b = b.to_i  
 
 case op
  when "+"  
    puts a+b
  when "-"
    puts a-b
  when "*"
    puts a*b
  when "/"
    puts a/b
  else "?"
    break
  end
}

Measured memory_bytes: 8656
#include <bits/stdc++.h>
using namespace std;
   
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>

const int N = 2e5+10;

int n;
int h[N];
int a[N];

int seg[2*N];

void update(int id,int val)
{
    for(seg[id+=n] = val;id>1;id>>=1)
        seg[id>>1] = max(seg[id],seg[id^1]);
}

int query(int r)
{
    int res = 0;
    r+=n+1;
    
    for(int l=n;l<r;l>>=1,r>>=1)
    {
        if(l&1) res = max(res,seg[l++]);
        if(r&1) res = max(res,seg[--r]);
    }
    
    return res;
}

void solve()
{
    cin >> n;
    
    f(i,n) cin >> h[i];
    f(i,n) h[i]--;
    
    f(i,n) cin >> a[i];
    f(i,n) update(h[i], a[i] + query(h[i]));
    cout << query(n);
}

signed main()
{
    fast;    
    solve();
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
//printf("%.12lf\n",mid);
//const long long sze = 2*(2^(long long)(ceil(log(100000)/log(2))));
/*
// get part of decimal
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
const long long mod = 1000000007;
const double eps = .0000000001;
inline void prep()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
};


int main(){
    prep();
    double n, t, a;
    cin >> n >> t >> a;
    int closeind = 0;
    double closest = 1000000;
    for (int i=0; i<n; i++){
      double pl;
      cin >> pl;
      double res = t-pl*.006;
      if (abs(res-a) < closest){
        closest = abs(res-a);
        closeind = i+1;
      }
    }
    cout << closeind;
    return 0;
}      

Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.Math;
import java.util.ArrayList;
import java.util.List;
//List<Integer> list = new ArrayList<>();

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		//int n = stdIn.nextInt();
		//int k = stdIn.nextInt();
		int[] a = new int[3];
		int[] b = new int[3];
		int[] c = new int[4];
		for (int i = 0; i < 3; i++) {
			a[i] = stdIn.nextInt();
			b[i] = stdIn.nextInt();
		}
		for (int i = 1; i < 5; i++) {
			for (int j = 0; j < 3; j++) {
				if (a[j] == i)
					c[i-1] = c[i-1] + 1;
				if (b[j] == i)
					c[i-1] = c[i-1] + 1;
			}
		}
		String s = "YES";
		for (int i = 0; i < 4; i++) {
			if (c[i] % 2 == 1) {
				s = "NO";
				break;
			}
		}
		int d = 0;
		for (int i = 0; i < 4; i++) {
			if (c[i] % 2 == 1)
				d = d + 1;
		}
		if (d == 2)
			s = "YES";

		System.out.println(s);
	}
}

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

#define reset_i out = 0; point = 0;
#define reset_p for(int j = 0; j < 3; j++) player[j] = false;
#define player_sum count(player.begin(), player.end(), true)

int main() {
	int n, out, point; cin >> n; reset_i
	vector<bool> player(3); reset_p string temp;
	for (int i = 0; i < n;) {
		cin >> temp;
		if (temp == "HIT") {
			if (player[2] == true) { point++; player[2] = false; }
			if (player[1] == true) { player[2] = true; player[1] = false; }
			if (player[0] == true) { player[1] = true; player[0] = false; }
			player[0] = true;
		}
		if (temp == "OUT") out++;
		if (temp == "HOMERUN") { point += player_sum + 1; reset_p }
		if (out == 3) { cout << point << endl; i++; reset_i reset_p }
	}
	return 0;
}


Measured memory_bytes: 3112
#include<stdio.h>
#include<math.h>
long sk(long,long);
int main(void){
  long a,b;
  scanf("%ld%ld",&a,&b);
  if(a<b){long w=a;
          a=b;
          b=w;
         }
 long max=sk(a,b);
  long k=max;
  long count=0;
  //printf("%ld\n",max);
  for(long i=2;i*i<=k;i++){
    if(max%i==0){
      //printf("%ld\n",i);
      do{max/=i;
       //printf("%ld\n",max);
        }while(max%i==0);
                count++;}
  }
 if(max>1)count++;
printf("%ld ",count+1);
  return 0;
}
long sk(long a,long b){
  long c=a%b;
  if(c!=0)return sk(b,c);
  else return b;
}

Measured memory_bytes: 128
#include <iostream>
#include <string.h>
#include <algorithm>
#include <cstring>
#include <math.h>
#define ll long long
ll gcd(ll a,ll b){
    ll s=1,c;
    while(a&&b){
        if((~a&1)&&(~b&1))
            a>>=1,b>>=1,s<<=1;
        else if(~a&1)a>>=1;
        else if(~b&1)b>>=1;
        else if(a>b)a=a-b;
        else c=b-a,b=a,a=c;
    }
    if(!a)return b*s;
    if(!b)return a*s;
}
using namespace std;
int main(){
	int n;
	cin>>n;
	ll a[n];
	int ans=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			for(int k=j+1;k<n;k++){
				if(a[i]!=a[j]&&a[j]!=a[k]&&a[i]!=a[k]){
					if(a[i]+a[j]>a[k]&&a[i]<a[j]+a[k]&&a[i]+a[k]>a[j])
						ans++;
				}
			}
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3596
#include<stdio.h>
 
int main(void){
int n,r,k;
scanf("%d",&n);
for(r=1;r<=n;r++){
if(r%3==0||r%10==3){
printf(" %d",r);
}else{
k=r;
while(k!=0){
k/=10;
if(k%10==3){printf(" %d",r);break;}
}
}
}
printf("\n");
return 0;
}

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

#define ll long long
#define pb push_back

using namespace std;
const int N = 2e5 + 5;
ll a[N], ans[N], xs[N];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n; cin >> n;
    for(int i = 0 ; i < n; i++)cin >> a[i];
    ll xors = 0;
    for(int i = 0; i < n; i += 2)
    {
        ans[i] = (xors^a[i + 1]);
        ans[i + 1] = (xors^a[i]);
        xors = xors^ans[i];
        xors = xors^ans[i + 1];
        xs[i + 2] = xors;
    }
    xors = ans[n - 1]^ans[n - 2];
    for(int i = n - 3; i >= 0; i -= 2)
    {
        ans[i] = (xors^a[i - 1])^xs[i - 1];
        ans[i - 1] = (xors^a[i])^xs[i - 1];
        xors = xors^ans[i];
        xors = xors^ans[i - 1];
    }

    for(int i = 0; i < n; i++)cout << ans[i] << ' ';
    return 0;
}




Measured memory_bytes: 8308