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

using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
using VVI = vector<VI>;
using VVL = vector<VL>;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep3(i, s, n, d) for (int i = (s); i < (int)(n); i += (d))
#define allpt(v) (v).begin(), (v).end()
#define allpt_c(v) (v).cbegin(), (v).cend()
#define allpt_r(v) (v).rbegin(), (v).rend()

const int mod = 1e9 + 7, mod2 = 998244353, mod3 = 1e9 + 9;
const ll inf = 1e18;

const string wsp = " ";
const string tb = "\t";
const string rt = "\n";

template <typename T>
void show1dvec(const vector<T> &v)
{
    if (v.size() == 0)
        return;
    int n = v.size() - 1;
    rep(i, n) cout << v[i] << wsp;
    cout << v[n] << rt;

    return;
}

template <typename T>
void show2dvec(const vector<vector<T>> &v)
{
    int n = v.size();
    rep(i, n) show1dvec(v[i]);
}

template <typename T, typename S>
void show1dpair(const vector<pair<T, S>> &v)
{
    int n = v.size();
    rep(i, n) cout << v[i].first << wsp << v[i].second << rt;
    return;
}

template <typename T, typename S>
void pairzip(const vector<pair<T, S>> &v, vector<T> &t, vector<T> &s)
{
    int n = v.size();
    rep(i, n)
    {
        t.push_back(v[i].first);
        s.push_back(v[i].second);
    }
    return;
}

template <typename T>
void maxvec(vector<T> &v)
{
    T s = v[0];
    int n = v.size();
    rep(i, n - 1)
    {
        if (s > v[i + 1])
        {
            v[i + 1] = s;
        }
        s = v[i + 1];
    }
}

template <typename T, typename S>
bool myfind(T t, S s)
{
    return find(t.cbegin(), t.cend(), s) != t.cend();
}

bool check(int y, int x, int h, int w)
{
    return 0 <= y && y < h && 0 <= x && x < w;
}

VL cumsum(const VL &v)
{
    int s = 0;
    VL ret = {0};

    rep(i, v.size())
    {
        s += v[i];
        ret.push_back(s);
    }
    return ret;
}

bool iskadomatsu(int a, int b, int c)
{
    return (a != b && b != c && c != a) && ((a > b && b < c) || (a < b && b > c));
}

VS split(string s, char c)
{
    VS ret;
    string part;
    s += c;
    rep(i, s.length())
    {
        if (s[i] == c)
        {
            ret.emplace_back(part);
            part = "";
        }
        else if (s[i] != c)
        {
            part += s[i];
        }
    }
    return ret;
}



int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    int n, m;
    ll totalhw{0};
    cin >> n >> m;
    VL hw(m);
    rep(i, m)
    {
        cin >> hw[i];
        totalhw += hw[i];
    }
    cout << (totalhw > n ? -1 : n - totalhw) << rt;

    return 0;
}


Measured memory_bytes: 3680
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
 
typedef long long ll;
typedef pair<int, int> ii;

int main() {

	int n;
	while(cin >> n, n){
		vector<int> a(n);
		rep(i, n) cin >> a[i];
		
		int ans = IINF;
		rep(i, n){
			REP(j, i+1, n){
				ans = min(ans, abs(a[i] - a[j]));
			}
		}
		
		cout << ans << endl;
		
	}

	return 0;
}

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

int main(){
  int n, k, h[100000], min = 1000000000, d[100000];
  cin >> n >> k;
  for(int i = 0; i < n; i++) cin >> h[i];
  sort(h, h + n);
  for(int i = k - 1; i < n; i++){
    d[i-k+1] = h[i] - h[i-k+1];
    //if(min > d) min = d;
  }
  min = *min_element(d, d+n-k+1);
  cout << min;
  return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-6;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

int64 N, X, D;
vector<PLL> m;
vector<int32> G[51];

void dfs(int64 v){
	REP(i, G[v].size()){
		dfs(G[v][i]);
		m[v].fs += m[G[v][i]].fs;
		m[v].sc += m[G[v][i]].sc;
	}
}

bool cmp(PLL a, PLL b){
	PLL aa = m[a.sc], bb = m[b.sc];
	return bb.fs*aa.sc > aa.fs*bb.sc;
}

vector<int64> dp(126000, INF_LL);

int main(void){
	cin >> N >> X >> D;
	m.resize(N, PLL(0, 1));
	cin >> m[0].fs;
	REP(i, N-1){
		int32 p; cin >> m[i+1].fs >> p; p--;
		G[p].push_back(i+1);
	}
	dp[0] = 0;
	dfs(0);
	vector<int32> c;
	int32 sum = 0;
	for(int32 i = 0;sum < min(D, (int64)50);i++){
		if(sum+(1<<i) >= min(D, (int64)50)) c.push_back(min(D, (int64)50)-sum);
		else c.push_back((1 << i));
		sum += 1<<i;
	}
	FOR(i, 0, N){
		REP(j, c.size()){
			vector<int64> dp2(126000, INF_LL);
			REP(k, 126000){
				dp2[k] = min(dp2[k], dp[k]);
				if(k+m[i].sc*c[j] <= 126000)
					chmin(dp2[k+m[i].sc*c[j]], dp[k]+m[i].fs*c[j]);
			}
			swap(dp, dp2);
		}
	}

	vector<PLL> v(N);
	REP(i, N) v[i] = PLL(D-min(D, (int64)50), i);
	v[0].fs = INF;
	sort(all(v), cmp);
	int64 res = 0;
	REP(i, 126000){
		if(dp[i] == INF_LL) continue;
		int64 ret = i;
		int64 rest = X-dp[i];
		if(rest < 0) continue;
		REP(j, v.size()){
			PLL x = m[v[j].sc];
			int64 cnt = v[j].fs;
			int64 canuse = rest/x.fs;
			rest -= min(canuse, cnt)*x.fs;
			ret += min(canuse, cnt)*x.sc;
		}
		res = max(res, ret);
	}
	cout << res << endl;
}

Measured memory_bytes: 2376
from collections import Counter
N = int(input())
v = list(map(int, input().split()))
v1 = Counter(v[::2]).most_common(2)+[(0,0)]
v2 = Counter(v[::-2]).most_common(2)+[(0,0)]
if v1[0][0]==v2[0][0]:
  print(N -max(v1[0][1]+v2[1][1], v1[1][1]+v2[0][1]))
else:
  print(N -v1[0][1] -v2[0][1])

Measured memory_bytes: 15588
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

bool all_same(string s){
	for(int i=0; i<s.length(); i++){
		if(s[i]!=s[0]) return false;
	}
	return true;
}

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

	int ans=9999;
	for(int i=0; i<26; i++){
		if(cnt[i]==0) continue;
		string t=s, tt="";
		int cnt=0;
		while(!all_same(t)){
			for(int j=0; j<t.length()-1; j++){
				if(t[j]==(char)(i+'a') || t[j+1]==(char)(i+'a')) tt+=(char)(i+'a');
				else tt+=t[j];
			}
			t=tt;
			tt="";
			cnt++;
		}
		ans=min(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  vector<string> s(3);
  REP(i, 3) cin >> s[i];
  int offset = 'A' - 'a';
  REP(i, 3)  cout << (char)(s[i][0] + offset);
  cout << endl;
}

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

// Macros
#define F  first
#define S  second
#define PB push_back

// Rename Datatypes
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;

// Common Functions
ll fastpow(ll a, ll ex){ ll res = 1; while(ex){ if(ex & 1) res *= a; a *= a; ex >>= 1; } return res; }
ll fastpow(ll a, ll ex, ll m){ a %= m; ll res = 1; while(ex){ if(ex & 1) res = (a*res) % m; a = (a*a) % m; ex >>= 1; } return res; }
ll modinverse(ll a, ll m){ ll m0 = m, y = 0, x = 1; while (a > 1){ ll q = a / m; a %= m; swap(a,m); x -= q*y; swap(x,y); } if(x < 0) x += m0; return x; }

// HELPERS
//  Tedious Grid Movements
vector<pii> moves_grid = { {0,1} , {0,-1} , {1,0} , {-1,0} };
inline bool move_okay(int x, int y, int n, int m) { return 0 <= x and x < n and 0 <= y and y < m; }
//  Remember:
//   * vec.assign() GOOD; vec.resize() BAD
//   * comparator uses <


// CODE STARTS HERE

void solve(){
	int A, B, C;
	cin >> A >> B >> C;

	int K;
	cin >> K;

	// A < B < C

	while(A >= B) --K, B *= 2;
	while(B >= C) --K, C *= 2;

	cout << (K >= 0 ? "Yes\n" : "No\n");
}

signed main (void){
	// Fast_IO
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	// Set Fixed Notation (default sucks), High Precision for Floating-Point Output
	cout << fixed << setprecision(20);

	// Multiple TCs
	int tt = 1;
	// cin >> tt;
	while(tt--) solve();
}


Measured memory_bytes: 3652
from collections import Counter
N = int(input())
A = [int(_) for _ in input().split()]

c = Counter(A)

for k in c:
    c[k] = 2 if c[k] % 2 == 0 else 1

two_count = len([x for x in list(c.values()) if x == 2])
all = len([x for x in list(c.values()) if x > 0])

res = all if two_count % 2 == 0 else all-1

print(res)


Measured memory_bytes: 18648
#include <iostream>
#include <vector>
#include <climits>
#include <unordered_set>
using namespace std;
 
#define debug(x) cout << #x << "==" << x << endl;
 
typedef long long ll;
typedef pair<int, int> P;
 
#define MAX_V 1000
#define INF INT_MAX / 2
 
int V, E;
bool ex_edge[MAX_V][MAX_V];
 
int d[MAX_V][MAX_V];
int used[MAX_V][MAX_V];          // 最短ろで使用した辺
 
void warshall_floyd(  ) {
 
  for(int a = 0; a < V; a++) {
    for(int b = 0; b < V; b++) {
      for(int c = 0; c < V; c++) {
        if( d[b][a] + d[a][c] < d[b][c] ) {
          used[b][c]--;
          d[b][c] = d[b][a] + d[a][c];
        }
      }
    }
  }
}
 
 
int main() {
  ios::sync_with_stdio(false);
 
 
  cin >> V >> E;
 
  fill( d[0], d[V], INF );
  for(int v=0; v < V; v++) {
    d[v][v] = 0;
  }
 
  for(int i = 0; i < E; i++) {
    int v, w, cost;
    cin >> v >> w >> cost;
    v--;w--;
    d[v][w] = cost;
    d[w][v] = cost;
    used[v][w] = 1;
    used[w][v] = 1;
    ex_edge[v][w] = true;
    ex_edge[w][v] = true;
  }
 
  warshall_floyd();
 
  int ans = 0;
  for(int v = 0; v < V; v++) {
    for(int w = v; w < V; w++) {
      if( ex_edge[v][w] && used[v][w] <= 0 ) {
          ans++;
      }
    }
  }
  cout << ans << "\n";
 
  return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
#define INF 2000000000000000000
ll n,m,a[20],z[1<<20];
D p[20],ans;
ll gcd(ll x,ll y){
	if(x%y==0)return y;
	return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	x/=gcd(max(x,y),min(x,y));
	if(x>INF/y)return INF;
	return x*y;
}
int main(void){ 
	scanf("%lld%lld",&n,&m);
	for(int i=0;i<n;i++)scanf("%lld",a+i);
	for(int i=0;i<n;i++){
		D x;
		scanf("%lf",&x);
		p[i]=x/100;
	}
	for(int k=1;k<1<<n;k++){
		ll s=1,w=0;
		for(int i=0;i<n;i++){
			if(k>>i&1){
				w++;
				s=lcm(s,a[i]);
			}
		}
		if(w%2)z[k]=m/s;
		else z[k]=-m/s;
	}
	for(int i=0;i<n;i++)for(int k=0;k<1<<n;k++)if(k>>i&1)z[k]+=z[k^(1<<i)];
	for(int k=1;k<1<<n;k++){
		D o=1;
		for(int i=0;i<n;i++){
			if(k>>i&1)o*=p[i];
			else o*=(1-p[i]);
		}
		ans+=o*D(z[k]);
	}
	printf("%.8lf\n",ans);
}



Measured memory_bytes: 11412
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define all(a) a.begin(),a.end()
#define dbg(n) cout<<#n<<' '<<n<<endl;
#define dbg_v(v) cout<<#v<<":";for(auto c:v) cout<<" "<<c; cout<<endl;
int power(ll x,ll y){ll res = 1;while(y>0){if(y&1)res = (res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
void solve(){
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll ans;
	ans=a*c;
	ans=max(a*d,max(b*c,max(b*d,a*c)));
	cout<<ans<<endl;
}
int main(){ 
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
}


Measured memory_bytes: 3648
X = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(X[int(input()) - 1])

Measured memory_bytes: 3316
import java.util.*;
class Main {
  public static void main(String args[]){
    new Main().run();
  }

  Scanner sc = new Scanner(System.in);
  void run(){
    while(true){
      int n = sc.nextInt();
      int m = sc.nextInt();
      if((n|m) == 0)return;
      final int ds[]=new int[n];
      final int ps[]=new int[n];
      Integer ns[]=new Integer[n];
      for(int i = 0 ;i < n;i++){
        ds[i] = sc.nextInt();
        ps[i] = sc.nextInt();
        ns[i] = i;
      }
      Arrays.sort(ns, new Comparator<Integer>(){
        public int compare(Integer i, Integer j){
          return ps[j] - ps[i];
        }
      });
//      System.err.println(Arrays.toString(ns));
      int ans = 0;
      for(int i = 0 ; i < n ; i++){
        ans += ps[ns[i]] * (ds[ns[i]] - Math.min(ds[ns[i]], m));
        m   -= Math.min(ds[ns[i]], m);
      }
      System.out.println(ans);
    }
  }
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()

const int MAX = 222;

int N;
string S[MAX];

int noteBipartite[MAX];
int dist[MAX][MAX];

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}

void warshall_floyd() {
    REP (k, N) REP (j, N) REP (i, N)
        dist[j][i] = min(dist[j][i], dist[j][k] + dist[k][i]);
}

bool dfs(int n, int k) {
    noteBipartite[n] = k;
    REP (i, N) if (S[n][i] == '1') {
        if (noteBipartite[i] == -1 && !dfs(i, 1-k)) return false;
        if (noteBipartite[i] == k) return false;
    }
    return true;
}

bool isBipartite() {
    REP (i, N) noteBipartite[i] = -1;
    return dfs(0, 0);
}

int solve() {
    if (!isBipartite()) return -1;
    Fill(dist, 10000);
    REP (i, N) REP (j, N) if (S[i][j] == '1') dist[i][j] = 1;
    REP (i, N)  dist[i][i] = 0;
    warshall_floyd();
    int ans = -1;
    REP (i, N) {
        REP (j, N) {
            // cout << dist[i][j] << " ";
            ans = max(ans, dist[i][j]);
        }
        // cout << endl;
    }
    return ans+1;
}

int main() {
    cin >> N;
    REP (i, N) cin >> S[i];
    cout << solve() << endl;
}

Measured memory_bytes: 512
/**akshaykumar99**/
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
template<typename T> using id_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update> ;
template<typename T> using id_setp = tree<pair<T,T>,null_type,less<pair<T,T>>,rb_tree_tag,tree_order_statistics_node_update> ;

#define f(i,x,n) for(i=x;i<n;i++)
#define fr(i,x,n) for(i=x;i>n;i--)
#define pu push_back           
#define pp pop_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SP(x) fixed<<setprecision(x)
#define IOS() ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const long long MOD=1e9+7;
const long double PI = acos(-1);
const long long INF=INT_MAX;
const long long LINF=LLONG_MAX;
const long long N=1e5+1;
 
typedef long long ll;
typedef long double ld;
 
int main()
{
    IOS();
   
    int m1,d1,m2,d2;
    cin>>m1>>d1>>m2>>d2;
    if(m1!=m2)
    	cout<<1;
    else
    	cout<<0;


    return 0;
}

Measured memory_bytes: 256
N=int(input())
S=input()
mod=998244353
data1=[0]*3*N
count=[0,0,0]
for i in range(3*N):
    if S[i]=="R":
        count[0]+=1
        if count[0]>count[1] and count[0]>count[2]:
            data1[i]=1
    elif S[i]=="G":
        count[1]+=1
        if count[1]>count[0] and count[1]>count[2]:
            data1[i]=1
    else:
        count[2]+=1
        if count[2]>count[0] and count[2]>count[1]:
            data1[i]=1
data2=[0]*3*N
count=[0,0,0]
for i in range(3*N-1,-1,-1):
    if S[i]=="R":
        count[0]+=1
        if count[0]>count[1] and count[0]>count[2]:
            data2[i]=1
    elif S[i]=="G":
        count[1]+=1
        if count[1]>count[0] and count[1]>count[2]:
            data2[i]=1
    else:
        count[2]+=1
        if count[2]>count[0] and count[2]>count[1]:
            data2[i]=1
data3=data1[:]
for i in range(1,3*N):
    data3[i]+=data3[i-1]
cnt0=0
data4=[0]*3*N
for i in range(3*N):
    if data1[i]==data2[i]==0:
        data4[i]=data3[i]-cnt0
        cnt0+=1
cnt=0
ans=1
for i in range(3*N):
    if data1[i]==data2[i]==0:
        cnt+=1
        ans=ans*data4[i]%mod
    if data1[i]==0 and data2[i]==1:
        ans=ans*cnt%mod
        cnt-=1
for i in range(1,N+1):
    ans=ans*i%mod
print(ans)

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

int main() {
  int N,j;
  j=1;
  cin>>N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
    sort(vec.begin(),vec.end());
  for(int i=0;i+1<N;i++){
    if(vec.at(i+1)!=vec.at(i)){
      j++;
    }
  }
  cout<<j<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
//const int MAX=;
//const int MOD=1e9+7;


int main(){
	int N,x;
	cin>>N>>x;
	int a[100];
	rep(i,N)cin>>a[i];
	sort(a,a+N);
	int ans=0;
	int candy=x;
	rep(i,N){
		if(candy<a[i])break;
		ans++;
		candy-=a[i];
	}
	if(ans==N){
		if(candy==0)cout<<ans;
		else cout<<ans-1;
	}
	else{
		cout<<ans;
	}
}

Measured memory_bytes: 256
import java.lang.Math.max
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val o = sc.next()
    val e = sc.next()

    for (i in 0 until max(o.length, e.length)) {
        if (i < o.length) {
            print(o[i])
        }
        if (i < e.length) {
            print(e[i])
        }
    }
    println()
}


Measured memory_bytes: 29472
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
ll N;
ll a[10];
ll ans = 1e18;
vector<int> v;
vector<int> Edge;
vector<i_i> Pair;
vector<int> Search;

void f() {
    /*
    cerr << "-------------" << endl;
    for(auto tmp : Search) cerr << tmp << " ";
    cerr << endl;
    */
    ll now = Search.size();
    vector<ll> b(N);
    for(int i = 0; i < N; i++) {
        b[i] = a[i];
    }
    for(auto tmp : Search) {
        for(int i = 0; i < N; i++) {
            if(tmp & (1 << i)) {
                b[i]--;
            }
        }
    }
    for(int i = 0; i < N; i++) {
        if(b[i] < 0) return;
        now += b[i];
    }
    ans = min(ans, now);
}

void dfs(int idx, int State) {
    if(idx == v.size()) {
        f();
        return;
    }
    dfs(idx + 1, State);
    if(State & Edge[idx]) return;
    Search.push_back(v[idx]);
    dfs(idx + 1, State | Edge[idx]);
    Search.pop_back();
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    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++) {
            Pair.push_back({i, j});
        }
    }
    for(int bits = 0; bits < (1 << N); bits++) {
        if(__builtin_popcount(bits) == 1) continue;
        v.push_back(bits);
    }
    for(auto tmp : v) {
        int now = 0;
        for(int i = 0; i < Pair.size(); i++) {
            if(tmp & (1 << Pair[i].first) and tmp & (1 << Pair[i].second)) {
                now |= (1 << i);
            }
        }
        Edge.push_back(now);
        //cerr << now << endl;
    }
    //cerr << v.size() << endl;
    dfs(0, 0);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
 ll K,S;
  cin>>K>>S;
  if(S<=K) {
cout<<(S+2)*(S+1)/2<<endl;
  return 0;
  }
  
  else if(S<=2*K) {
cout<<(S+2)*(S+1)/2-(S-K)*(S-K+1)/2*3<<endl;
  }
  
  else {
    ll a=(S+2)*(S+1)/2;
    ll b=(S-2*K)*(S-2*K-1)/2;
    ll c=(S-K)*(S-K+1)/2;
    cout<<a+3*b-3*c<<endl;
  }
}
    
 
  

Measured memory_bytes: 3556
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);

		String input = scanner.nextLine();
		String input2 = scanner.nextLine();

		int j = 0;
		int OK = 0;

		for(String i  : input.split("")) {
			if(i.equals(input2.split("")[j])) {
				OK=OK+1;
			}
			j=j+1;
		}
		System.out.println(OK);
	}
}

Measured memory_bytes: 23764
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <cmath>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
int c[2][100001];

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    c[i % 2][x]++;
  }
  int max[2][2];
  int at[2][2];
  max[0][0] = 0;
  max[1][0] = 0;
  max[0][1] = 0;
  max[1][1] = 0;
  for(int j = 0; j < 2; j++){
    for(int i = 0; i < 100001; i++){
      if(max[j][0] < c[j][i]){
        max[j][1] = max[j][0];
        max[j][0] = c[j][i];
        at[j][1] = at[j][0];
        at[j][0] = i;
      }else if(max[j][1] < c[j][i]){
        max[j][1] = c[j][i];
        at[j][1] = i;
      }
    }
  }
  if(at[0][0] == at[1][0]){
    if(max[1][0] > max[0][0]){
      cout << n - max[1][0] - max[0][1] << endl;
    }else if(max[1][0] < max[0][0]){
      cout << n - max[0][0] - max[1][1] << endl;
    }else{
      if(max[0][1] > max[1][1]){
        cout << n - max[0][0] - max[0][1] << endl;
      }else{
        cout << n - max[0][0] - max[1][1] << endl;
      }
    }
  }else{
    cout << n - max[1][0] - max[0][0] << endl;
  }
	return 0;
}


Measured memory_bytes: 1024
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    if(c < a + b)
        cout << "No" << endl;
    else{
        ll check = a*a+b*b+c*c-2*(a*b+b*c+c*a);
        if(check > 0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

/* 参考:　貰う DP と配る DP、メモ化再帰、個数制限なしナップサック問題 @drken https://qiita.com/drken/items/ace3142967c4f01d42e9#%E8%A7%A3%E6%B3%95-1-1-%E3%83%88%E3%83%83%E3%83%97%E3%83%80%E3%82%A6%E3%83%B3%E3%81%AB-n-%E3%82%92%E9%99%8D%E4%B8%8B%E3%81%97%E3%81%A6%E3%81%84%E3%81%8F%E3%83%A1%E3%83%A2%E5%8C%96%E5%86%8D%E5%B8%B0 */

public class Main {
	static final int MAX_N = 110000;
	static int[] memo = new int[MAX_N]; // memo[i]:i=Nのときの最低値
	static {
		Arrays.fill(memo, -1); // 初期化
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = calc(n);
		System.out.println(ans);
	}

	static int calc(int n) {
		if (n == 0) return 0;
		if (memo[n] != -1) return memo[n]; // メモ済みならその値を返す

		int res = n; // 1円ずつ引き出した場合 resはresponseのres?
		for (int pow6 = 1; pow6 <= n; pow6 *= 6) {
			res = Math.min(res, calc(n - pow6) + 1); // resとnを間違えていた
		}
		for (int pow9 = 1; pow9 <= n; pow9 *= 9) {
			res = Math.min(res, calc(n - pow9) + 1);
		}
		memo[n] = res;
		return memo[n];
	}
}

Measured memory_bytes: 29652
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  ll a[N], b[N];
  for(int i=0;i<N;i++) cin >> a[i] >> b[i];

  ll ans = 0LL;
  for(int i=N-1;i>=0;i--){
    a[i] += ans;
    if(a[i] == 0LL) continue;
    if(a[i] < b[i]) ans += b[i] - a[i];
    else if(a[i] % b[i] == 0LL) continue;
    else ans += b[i] - a[i] % b[i];
  }

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


Measured memory_bytes: 1792
#include <iostream>
#include <bitset>
#include <string>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0;i<n;i++)

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

    if (D == 22)
    {
        cout << "Christmas Eve Eve Eve" << endl;
    }
    else if (D == 23)
    {
        cout << "Christmas Eve Eve" << endl;
    }
    else if (D == 24)
    {
        cout << "Christmas Eve" << endl;
    }
    else if (D == 25)
    {
        cout << "Christmas" << endl;
    }



}

Measured memory_bytes: 256
#ABC135B - 0 or 1 Swap
N = int(input())
p = list(map(int,input().split()))
for i in range(N):
    if p[i] != i+1:
        a = p[i]
        p[i] = i+1
        p[a-1] = a
        break
if p == [i for i in range(1,N+1,1)]:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;

template<typename T,bool directed>
struct Fordfulkerson{
  struct edge{
    ll to,cap,rev;
    edge(){}
    edge(ll to,ll cap,ll rev):to(to),cap(cap),rev(rev){}
  };

  vector<vector<edge> > G;
  vector<ll> used;

  Fordfulkerson(){}
  Fordfulkerson(ll n):G(n),used(n){}

  void add_edge(ll from,ll to,T cap){
    G[from].emplace_back(to,cap,G[to].size());
    G[to].emplace_back(from,directed?0:cap,G[from].size()-1);
  }

  T dfs(ll v,ll t,T f){
    if(v==t) return f;
    used[v]=true;
    for(ll i=0;i<(ll)G[v].size();i++){
      edge &e = G[v][i];
      if(!used[e.to]&&e.cap>0){
        T d=dfs(e.to,t,min(f,e.cap));
        if(d>0){
          e.cap-=d;
          G[e.to][e.rev].cap+=d;
          return d;
        }
      }
    }
    return 0;
  }

  ll flow(ll s,ll t,T lim){
    T fl=0;
    while(1){
      fill(used.begin(),used.end(),0);
      T f=dfs(s,t,lim);
      if(f==0) break;
      fl+=f;
      lim-=f;
    }
    return fl;
  }

  ll flow(ll s,ll t){
    return flow(s,t,numeric_limits<T>::max()/2);
  }

};

int main() {
  ll x,y,e;
  cin >> x >> y >> e;
  Fordfulkerson<ll,true> G(x+y+2);
  for(ll i=0;i<e;i++) {
    ll tx,ty;
    cin >> tx >> ty;
    G.add_edge(tx,x+ty,1);
  } 
  for(ll i=0;i<x;i++) {
    G.add_edge(x+y,i,1);
  }
  for(ll i=0;i<y;i++) {
    G.add_edge(x+i,x+y+1,1);
  }
  cout << G.flow(x+y,x+y+1) << endl;
}


Measured memory_bytes: 3368
#include <bits/stdc++.h>
using namespace std;
int n, a[200005];
long long sum[200005];
map<long long, int> cnt;
long long ans = 0;
int main()
{
#ifdef _noname
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	sum[0] = 0;
	cnt[0] = 1;
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", a + i);
		sum[i] = sum[i - 1] + a[i];
		ans += cnt[sum[i]];
		cnt[sum[i]]++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 15104
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

immutable inf = 1<<30;
string ng = "UNRESTORABLE";
string zz = repeat('z', 100).to!(string);

void main() {
    string s, t;
    scan(s);
    scan(t);

    int n = s.length.to!int, k = t.length.to!int;
    auto ans = zz;

    foreach_reverse (i ; 0 .. n - k + 1) {
        bool match = true;

        foreach (j ; i .. i + k) {
            if (s[j] == '?') continue;
            if (s[j] != t[j - i]) {
                match = false;
                break;
            }
        }

        if (match) {
            string anst = "";

            foreach (j ; 0 .. n) {
                if (i <= j && j < i + k) {
                    anst ~= t[j - i];
                }
                else {
                    anst ~= (s[j] == '?' ? 'a' : s[j]);
                }
            }

            ans = min(ans, anst);
        }
    }

    writeln(ans == zz ? ng : ans);
}


void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

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

int main() { /* ここに書く */
  long long N , K , H , i , Ans ;
  cin >> N >> K ;
  i = 0 ;
  Ans = 0 ;
  vector<long long> HP ( N ) ;
  
  while( N > i ){
    cin >> H ;
    HP.at(i) = H ;
    i++ ;
  }
  
  sort( HP.begin(), HP.end() );
  
  i = 0 ;
  
  while( N - K > i ){
    Ans = Ans + HP.at(i) ;
    i++ ;
  }
  
  cout << Ans << endl ;
}

Measured memory_bytes: 1792
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        for(int i = 0 ; i < n ; i++){
            x[i] = sc.nextInt();
        }
        long s = 1000000;
        for(int i = 1 ; i <= 100 ; i++){
            long k = 0;
            for(int g = 0 ; g < n ; g++) {
                k = k + (x[g]) * (x[g]) + i * i - 2 * i * x[g];
            }
            if(s > k){
                s = k;
            }
        }
        System.out.println(s);
        sc.close();
    }
}

Measured memory_bytes: 36140
#16:50
n,m = map(int,input().split())
a = []
for _ in range(m):
  x,y = list(map(int,input().split()))
  x -= 1
  y -= 1
  a.append([x,y])
a.reverse()
scr = n * (n-1) // 2
pre = [-1 for _ in range(n)]
cnt = [1 for _ in range(n)]
ans = []
for i in range(m):
  ans.append(scr)
  X,Y = a[i]
  while pre[X] != -1:
    X = pre[X]
  while pre[Y] != -1:
    Y = pre[Y]
  x,y = min(X,Y), max(X,Y)
  if x != y:
    scr -= cnt[x] * cnt[y]
    pre[y] = x
    cnt[x] = cnt[x] + cnt[y]
  #print(pre)
  #print(cnt)
ans.reverse()
for i in range(m):
  print(ans[i])

Measured memory_bytes: 26844
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

#define X 100000001

using namespace std;

int RE[101][101];
int *p;

int rec(int r, int c){
  int M=X;
  int num=c-r;
  int i;
  for(i=0;i<num;i++)M=min(M, RE[r][r+i]+RE[r+i+1][c]+p[r-1]*p[r+i]*p[c]);
  return M;
}

int main(){
  int N;
  cin>>N;
  int i, j;
  for(i=1;i<=N;i++)RE[i][i]=0;
  p=(int *)malloc(sizeof(int)* (N+1));

  cin>>p[0];
  cin>>p[1];
  int bb;
  for(i=2;i<=N;i++){
    cin>>bb;
    cin>>p[i];
  }

  for(i=1;i<N;i++)RE[i][i+1]=p[i-1]*p[i]*p[i+1];

  for(j=0;j<=N-3;j++){
    for(i=3+j;i<=N;i++){
      RE[i-2-j][i]=rec(i-2-j,i);
    }
  }

  cout<<RE[1][N]<<endl;

  return 0;
}



Measured memory_bytes: 3124
from collections import Counter
c = Counter()
n = int(input())
for _ in range(n):
    c[input()] += 1

_, m = c.most_common(1)[0]

ans = []
for x, y in c.most_common():
    if y == m:
        ans.append(x)
    else:
        break

for x in sorted(ans):
    print(x)

Measured memory_bytes: 117976
//#include "pch.h"
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <math.h>
#define OO INT_MAX
#define mp(x,y) make_pair(x,y)
#define x first
#define y second
#define ll unsigned long long int
#define pp pair<int,int>
#define heap priority_queue<pp, vector<pp>, greater<pp>>
using namespace std;

int ans;
string  s;
string s1;
void check(string str, int i) {
	if (i == s.size()) {
		if (str == "ABC")
			ans++;
		return;
	}
	s1 = str;
	check(s1, i + 1);
	s1 = str + s[i];
	check(s1, i + 1);
}

int main()
{
	//freopen("test.txt", "r", stdin);

	int n;
	cin >> n;
	map<int, int> fre;
	int in;
	for (int i = 0; i < n; i++) {
		cin >> in;
		fre[in]++;
		if (fre[in] > 1) {
			cout << "NO";
			return 0;
		}
	}
	cout << "YES";
}


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

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

ll n, a, b, c, d;
map<ll, ll> dp;

ll f(ll n) {
  if(n == 0) return 0;
  if(n == 1) return d;
  if(dp.count(n)) return dp[n];

  ll ret = 1e18;
  if(n <= ret / d) ret = n * d;

  ll f2 = (n / 2) * 2;
  ll c2 = ((n - 1) / 2 + 1) * 2;
  ll f3 = (n / 3) * 3;
  ll c3 = ((n - 1) / 3 + 1) * 3;
  ll f5 = (n / 5) * 5;
  ll c5 = ((n - 1) / 5 + 1) * 5;

  ret = min(ret, llabs(n - f2) * d + a + f(f2 / 2));
  ret = min(ret, llabs(n - c2) * d + a + f(c2 / 2));
  ret = min(ret, llabs(n - f3) * d + b + f(f3 / 3));
  ret = min(ret, llabs(n - c3) * d + b + f(c3 / 3));
  ret = min(ret, llabs(n - f5) * d + c + f(f5 / 5));
  ret = min(ret, llabs(n - c5) * d + c + f(c5 / 5));
  return dp[n] = ret;
}
int main() { 
  int T; scanf("%d", &T);
  while(T--) {
    scanf("%lld %lld %lld %lld %lld", &n, &a, &b, &c, &d);
    printf("%lld\n", f(n));
    dp.clear();
  }
  return 0;
}


Measured memory_bytes: 4536
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> PA;
typedef priority_queue<PA, vector<PA>, greater<PA> > PQ;
typedef map<int, const char*> MAP;
typedef set<PA> SET;
#define fi first
#define se second
#define pb push_back
#define REP(i,j,n) for(ll i = (ll)(j);i < (ll)(n);i++)
#define INF 1000000001
#define MOD 10000
#define MAXD 201
#define MAXN 100001
#define MAXM 1001

int a,b,k;

int main()
{
    cin >> a >> b >> k;
    REP(i, a, b + 1){
        if(a + k > i){
            cout << i << endl;
        }
        else if(b - k < i){
            cout << i << endl;
        }
    }

    return 0;
}
/*O(10 ^ 8)　が限界 (2s以内)
    REP(i,a){
        REP(j,b){
4 4
1 2 100
2 3 250
2 4 200
3 4 100

        }
    }
*/



Measured memory_bytes: 256
# -*- coding: utf-8 -*-

d, g = map(int, input().split())

p = [0] * d
c = [0] * d

for i in range(d):
    p[i], c[i] = map(int, input().split())

ans = 100000

sum = 0
k = 0

for i in range(2 ** d):
    cnt = 0
    sum = 0
    k = - 1

    for j in range(d):

        if (i >> j) & 1:
            sum += 100 * p[j] * (j + 1) + c[j]
            cnt += p[j]

        else:
            k = j

    if sum < g:
        s1 = 100 * (k + 1)
        need = (g - sum + s1 - 1) // s1

        if need >= p[k]:
            continue

        cnt += need

    ans = min(ans, cnt)

print(ans)



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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;

int main(){
  ll i, j;
  ll n, k;
  cin >> n >> k;
  if(n >= 2 * k - 1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int MAX = 2e5 + 10;
typedef long long i64;
using namespace std;
const double EPS = 1e-6;

int ar[MAX];
pair<int, int> ars[MAX];
const int MOD = 1e9 + 7;
#define MUL(a, b) (((i64)(a) * (b)) % MOD)
int powmod(int a, int n){
	int b = 1;
	while(n > 0){
		if(n & 1)b = MUL(b, a);
		a = MUL(a, a);
		n >>= 1;

	}
	return b;
}
int fac[MAX];
int ifac[MAX];
int bin(int n,int a){
	if(n < a)return 0;
	return MUL(fac[n], MUL(ifac[a], ifac[n - a]));

}

int main() {

    #ifdef LOCAL_DEBUG
    freopen ("data.in", "r", stdin );
    //freopen ("data.out", "w", stdout );
    #endif
    ios_base::sync_with_stdio(0); cin.tie(0);
    #define endl '\n'
    int n; cin >> n;


    for(int i = 0; i <= n; i++){
    	cin >> ar[i];
    	ars[i] = {ar[i], i};
    }
    stable_sort(ars, ars + n + 1);
    int s1, s2;
    for(int i = 0 ;i < n; i++ ){
    	if(ars[i].first == ars[i + 1].first){
    		s1 = ars[i].second;
    		s2 = ars[i + 1].second;
    		break;
    	}
    }
    fac[0] = 1;
    for(int i = 1; i <= n + 1; i++)fac[i] = MUL(i, fac[i - 1]);
    ifac[n + 1] = powmod(fac[n + 1], MOD - 2);
    for(int i = n; i >= 0; i--)ifac[i] = MUL(ifac[i + 1], i + 1);
    //cout << ifac[0] << endl;
    for(int k = 1; k <= n + 1; k++){
    	int ans = (bin(n  + 1, k) - bin(s1 + n + 1 - s2 - 1, k - 1) + MOD ) % MOD;
    	cout << ans << endl;
    }

}



Measured memory_bytes: 3184
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Main {

    public static void main( final String[] args ) {

	final Scanner stdin = new Scanner( System.in );

	boolean[] submitted = new boolean[ 31 ];

	for ( int i = 0; i < 28; i++ ) {
	    submitted[ stdin.nextInt() ] = true;
	}

	for ( int i = 1; i <= 30; i++ ) {
	    if ( !submitted[ i ] ) {
		System.out.println( i );
	    }
	}
    }    
}

Measured memory_bytes: 15340
// package app;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;
import java.util.StringJoiner;
import java.util.stream.Stream;

public class Main {

    public static void main(final String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        String line = sc.next();

        System.out.println((line.charAt(2) == line.charAt(3) && line.charAt(4) == line.charAt(5)) ? "Yes" : "No");
    }

}

Measured memory_bytes: 23764
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (a,b,c) = get!(usize, usize, usize);
    if c <= a+b {
        println!("No");
        return;
    }
    if (c-a-b).pow(2) > 4*a*b {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		if(s.equals("SUN")){
			System.out.println("7");
		}
		if(s.equals("MON")){
			System.out.println("6");
		}
		if(s.equals("TUE")){
			System.out.println("5");
		}
		if(s.equals("WED")){
			System.out.println("4");
		}
		if(s.equals("THU")){
			System.out.println("3");
		}
		if(s.equals("FRI")){
			System.out.println("2");
		}
		if(s.equals("SAT")){
			System.out.println("1");
		}
	}
		
		
}

Measured memory_bytes: 22612
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}


long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0;true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

//ここまでライブラリ
//ここから本文

long long int tpimin(vector<int> a) {
	int MIN = 1000000000;
	int number = 0;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
		number = i;
	}
	return number;
}
int main() {
	string s;
	cin >> s;
	for (int i = 1; i <= s.size(); i++) {
		if (i % 2 == 1) cout << s.at(i-1);
	}
	cout << endl;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef string str;
typedef std::pair<ll,ll> pl;
typedef std::map<string, ll> msl;
typedef std::map<ll, ll> mll;
typedef std::vector<ll> vl;
const long double EPS = 1e-9;
 
#define rep(i, n) for(ll (i) = 0; (i) < (n) ; (i)++ )
#define For(i, a, b) for(ll (i) = (a); (i) < (b) ; (i)++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define tol(c) char((c)+0x20)
#define tou(c) char((c)-0x20)
#define pb push_back
#define mp make_pair
#define pr(a) cout << (a)
#define prl(a) cout << (a) << endl
#define prl2(a,b) cout << (a) << " " << (b) << endl
#define prs(a) cout << (a) << " "
#define yn(condition) if ((condition)) prl("Yes"); else prl("No");
#define YN(condition) if ((condition)) prl("YES"); else prl("NO");
#define rpr(i,n,ans) rep((i),(n)) prs((ans[(i)]))
#define cpr(i,n,ans) rep((i),(n)) prl((ans[(i)]))
#define in1(a) cin >> (a)
#define in2(a,b) cin >> (a) >> (b)
#define in3(a,b,c) cin >> (a) >> (b) >> (c)
#define in4(a,b,c,d) cin >> (a) >> (b) >> (c) >> (d)
#define rin1(i,n,a) rep((i),(n)) cin >> (a[(i)])
#define rin2(i,n,a,b) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)])
#define rin3(i,n,a,b,c) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)]) >> (c[(i)])
#define e1 first
#define e2 second
#define ctol(c) ll((c)) - ll('0')
#define ltos(n) to_string((n))
#define items(kv, v) for(auto &(kv): (v))
#define ndig(N, n) ctol(ll(ltos((N))[ll(ltos((N)).length()) - (n)]))
#define beto(a,b,c) (a) < (b) && (b) < (c)
#define betc(a,b,c) (a) <= (b) && (b) <= (c)
#define rsort(a,n) sort(a,a+n,greater<>())
 
const ll mod = 1e9 + 7;
const ll INF = mod * mod;
const ll MAX_N = 100;
 
int main(void){
    ll a,b,c;
    str s,t,u;

    in3(a,b,c);
    if (a == b && b == c) prl(1);
    else if (a == b || b == c || c == a) prl(2);
    else prl(3);


    return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using namespace std;

auto main() -> int
{
	int i, n; cin >> i >> n;
    
    if(i == n) cout << "Yes" << endl;
    else cout << "No" << endl;

}


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

int n,a,q=0,c=0,t=1;

int main(){
  scanf("%d %d",&n,&a);
  for(int i=0;i<n;i++)t*=100;
  while(c!=a){
    q+=t;
    c+=q%(t*100)!=0;
  }
  printf("%d\n",q);
}


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

void insertionSort(int A[], int N) {

	for(int k=0;k<N;k++) {
		cout << A[k];
		if(k!=N-1) {
			cout << " ";
		}
	}
		cout << endl;

	for(int i=1;i<N;i++) {
		int v = A[i];
		int j = i - 1;
		while(j>=0 && A[j] > v) {
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = v;

		for(int k=0;k<N;k++) {
			cout << A[k];
			if(k!=N-1) {
				cout << " ";
			}
		}
		cout << endl;
	}
}


int main(void) {

	int n;
	cin >> n;

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

	insertionSort(a, n);

	return 0;
}

Measured memory_bytes: 1164