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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define AND(x,y,z) 
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (ll i=(ll)(a);i<(ll)(b);++i)
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)
#define YES(cond) cond ? OUT("YES") : OUT("NO")
#define Yes(cond) cond ? OUT("Yes") : OUT("No")

template<class T> T gcd(const T x,const T y){if(!y){return x;}return gcd(y,x%y);}
template<class T> T lcm(const T x,const T y){return x/gcd(x,y)*y;};
template<class T> T modpow(const T x,const T n,const T mod) {
  T res=1;while(n>0){if(n%2)res=res*x%mod;x=x*x%mod;n/=2;};return res;
}
template<class T> bool alltrue(const T &a){return all_of(ALL(a),[](bool x){return x;});}
template<class T> bool anytrue(const T &a){return any_of(ALL(a),[](bool x){return x;});}
template<class T> bool contain(const T &a,const T &b){for(auto x:b){if (a.find(x)==a.end()){return false;}}return true;}
template<class T> bool mmax(T &m,const T q){ if (m < q) {m = q; return true;} else return false; }
template<class T> bool mmin(T &m,const T q){ if (m > q) {m = q; return true;} else return false; }
template<class T> int siz(const T &a) {return (int)a.size();}
template<class T> set<T> devisers(T n) {
  set<T> res;for(T i=1;i<(T)sqrt(n)+1;i++){if(n%i==0){res.insert(i);res.insert(n/i);}}return res;
}
template<class T> void concat(T &a, const T &b){a.insert(a.end(),b.begin(),b.end());}
template<class T> void getand(const T &a,const T &b,T &c) {
  set_intersection(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}
template<class T> void getor(const T &a,const T &b,T &c) {
  set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}

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

const ll MOD=1e9+7;
const int MAX=1e5+100;

int main() {
  // 組a,bがいくつ存在するか-MOD
  // a+b=aøoの時は、1と0、もしくは0と0が向かい合っているもの
  // (0,0)(1,0)(0,1)は必ず満たす
  // a=bとなるものはa=b=0の時のみ
  // (1,0)(0,0)(0,1)
  // (00,00)(01,00)(00,01)(00,10)(10,00)(10,01)(01,10)(11,00)(00,11)
  // (000,000)()
  // 積み重ね方式で増えていく
  // 一番最初だけ1の数だけ考えるとしたら、N桁目の個数をf(N)とするとf(N+1)=(f(N)-1)*2+2
  // つまり、Lの桁数をnとしたら、f(n-1)までは確定する
  // それ以上の場合は、Lを超えないようにaとbの組み合わせを選ぶ
  // bitsetで
  string L;cin>>L;
  ll N = siz(L);
  vector<vector<ll>> dp(N+1,vector<ll>(2,0));
  dp[0][0] = 1;
  // 2桁目以降から調査
  REP(i,N) {
    // 末尾に0,0を追加する時
    dp[i+1][1] += dp[i][1];
    dp[i+1][1] %= MOD;

    if (L[i]=='1') {
      // 小さくなるから
      dp[i+1][1] += dp[i][0];
      dp[i+1][1] %= MOD;
    } else {
      // 0 0でも平行線
      dp[i+1][0] += dp[i][0];
      dp[i+1][0] %= MOD;
    }

    // 末尾に0.1か1,0を追加する時
    dp[i+1][1] += dp[i][1]*2;
    dp[i+1][1] %= MOD;

    if (L[i]=='1') {
      // 末尾に0.1か1,0を追加する時
      // 0を付けた場合
      dp[i+1][0] += dp[i][0]*2;
      dp[i+1][0] %= MOD;
    }
  }
  OUT((dp[N][0]+dp[N][1])%MOD);

  return 0;
}

Measured memory_bytes: 5760
def check(l, r):
    th = 1 + (r - l + 1) // 2 
    for i in range(26):
        if cnt[i] >= th:
            return True
    return False

s = input()
n = len(s)
si = [0] * n
for i in range(n):
    si[i] = ord(s[i]) - 97

l, r = 0, 1
cnt = [0]*26
for i in range(2):
    cnt[si[i]] += 1
while l < n-1 and r < n:
    if check(l, r):
        print(l+1, r+1)
        exit()
    elif max(cnt) == 1 + (r - l + 1) // 2 or r-l == 1:
        r += 1
        if r < n:
            cnt[si[r]] += 1
    else:
        cnt[si[l]] -= 1
        l += 1     
print(-1, -1)

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

int main() {
  int h,w;
  cin>>h>>w;
  vector<string> s(h);
  rep(i,h) cin>>s[i];
  //////////////
  vector<vector<char>> ans(h,vector<char> (w));
  int dx[8]={-1,0,1,-1,1,-1,0,1};
  int dy[8]={1,1,1,0,0,-1,-1,-1};
  rep(i,h){
      rep(j,w){
          if(s[i][j]=='#') {
            ans[i][j]='#';
          }
        
         else{
           int bom=0;
           for(int k=0;k<=7;k++){
             if(i+dx[k]<h&&j+dy[k]<w&&i+dx[k]>=0&&j+dy[k]>=0){
             	if(s[i+dx[k]][j+dy[k]]=='#'){
              	  bom++;
             	}
             }    
           }
          // char c;
          // c=(char)bom;
          // cout<<c<<endl;
           ans[i][j]=char(bom+'0');
           //else ans[i][j]='.';
         }
      }
  }
  rep(i,h){
    rep(j,w) cout<<ans[i][j];
     cout<<endl;
  }
 
}








Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define N 2*10e5
#define precise cout<<fixed<<setprecision(10)
#pragma GCC optimize("O0")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#define rep(i,a,b) for(int i=a;i<b;i++)
#define min3(a,b,c) min(a,min(b,c))
using namespace std;
void get(ll arr[],ll n){for(ll i=0;i<n;i++) cin>>arr[i];}
#define max4(a,b,c,d) max(a,max(b,max(c,d)))
int main()
{
 	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t;
	t=1;
	//cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		ll a[n+1][3];
		ll dp[n+1][3];
		rep(i,1,n+1)
		{
			rep(j,0,3)
			cin>>a[i][j];
		}
		dp[1][0]=a[1][0];
		dp[1][1]=a[1][1];
		dp[1][2]=a[1][2];
		for(ll i=2;i<=n;i++)
		{
			for(ll j=0;j<3;j++)
			{
				if(j==0)
				dp[i][j]= max(dp[i-1][1],dp[i-1][2]) + a[i][j];
				else if(j==2)
				dp[i][j]= max(dp[i-1][0],dp[i-1][1]) + a[i][j];
				else if(j==1)
				dp[i][j]= max(dp[i-1][2],dp[i-1][0]) + a[i][j];
			}
		}
		ll ans=0;
		ans=max(ans,dp[n][0]);
		ans=max(ans,dp[n][1]);
		ans=max(ans,dp[n][2]);
		cout<<ans;
	}
	//cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}



Measured memory_bytes: 4992
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const ll mod = 100000000000000003;
int ne[200001], he[10001];
char C[1200100];

int T[26][1000001], kazu[1000001];

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


	fread(C, 1, 1200100, stdin);
	char* ci = C, c;
	int N = 0;
	while ((c = *ci++) >= '0') N = N * 10 + c - '0';

	ll dekai[100];
	int d = 0;
	char* s[200001];
	rep1(i, N) {
		s[i] = ci;
		while (*ci++ >= '0');
		int n = ci - s[i] - 1;
		if (n <= 100000) {
			ne[i] = he[n];
			he[n] = i;
		}
		else {
			dekai[d++] = (ll(n) << 30) + s[i] - C;
		}
	}

	ll kotae = 0;
	int cnt = 0;
	for (int M = 1; M <= 10000; M++) {
		for (int p = he[M]; p; p = ne[p]) {
			auto S = s[p];
			int k[26] = {};
			int mae = 0;
			for (int i = M - 1; i >= 1; i--) {
				int tmp = kazu[mae];
				if (tmp) {
					rep(j, 26) if ((tmp >> j & 1)) {
						k[j]++;
					}
				}
				int ct = S[i] - 'a';
				if (!T[ct][mae]) T[ct][mae] = ++cnt;
				mae = T[ct][mae];
				kotae += k[ct];
				k[ct] = 0;
			}

			kotae += k[S[0] - 'a'];
			k[S[0] - 'a'] = 0;

			kazu[mae] |= 1 << (S[0] - 'a');
		}
	}
	sort(dekai, dekai + d);
	rep(p, d) {
		auto S = C + (dekai[p] & (1 << 21) - 1);
		int k[26] = {};
		int mae = 0;
		for (int i = (dekai[p] >> 30) - 1; i >= 1; i--) {
			int tmp = kazu[mae];
			if (tmp) {
				rep(j, 26) if ((tmp >> j & 1)) {
					k[j]++;
				}
			}
			int ct = S[i] - 'a';
			if (!T[ct][mae]) T[ct][mae] = ++cnt;
			mae = T[ct][mae];
			kotae += k[ct];
			k[ct] = 0;
		}

		kotae += k[S[0] - 'a'];
		k[S[0] - 'a'] = 0;

		kazu[mae] |= 1 << (S[0] - 'a');
	}
	printf("%lld\n", kotae);


	Would you please return 0;
}

Measured memory_bytes: 106732
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int N,X;
	scanf("%d %d",&N,&X);

	int sum = 0,minimum = BIG_NUM,tmp;

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

		scanf("%d",&tmp);
		sum += tmp;
		minimum = min(minimum,tmp);
	}

	X -= sum;
	int ans = N;

	ans += X/minimum;

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

	return 0;
}


Measured memory_bytes: 3788
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF 1<<50LL
#define fst first
#define snd second
#define pb push_back
#define int long long
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(auto i=(a);i<(b);i++)
#define RFOR(i,a,b) for(auto i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(int itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(int itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define debug(x)  cout << #x << " = " << (x) << endl;
typedef long long ll;
typedef pair<ll,ll> P;

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

  int n;
  string s,t;
  cin >> n >> s >> t;
  
  int cnt = 0;
  bool f;
  while(cnt < n){
    f = true;
    REP(i,n-cnt){
      if(s[i+cnt] != t[i]) f = false;
    }
    if(f) break;
    cnt++;
  }
  
  cout << n+cnt << endl;
  
  return 0;
}

Measured memory_bytes: 256
<?php
 
$input = file_get_contents('php://stdin');
 
$alphabet = array_fill_keys(range('a', 'z'), 0);
foreach (str_split($input) as $c) {
    if (! ctype_alpha($c)) { continue; }
 
    $alphabet[strtolower($c)]++;
}
 
foreach ($alphabet as $char => $count) {
    printf('%s : %d%s', $char, $count, PHP_EOL);
}

Measured memory_bytes: 6800
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using boost::multiprecision::cpp_int;
typedef long long ll;

cpp_int a, b;

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

    if (a > b) cout << "GREATER" << endl;
    else if (a < b) cout << "LESS" << endl;
    else cout << "EQUAL" << endl;

    return 0;
}

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
  int n,k;
  int d[100001] = {};
  cin >> n >> k;
  int count = 0;
  rep(i,n){
    cin >> d[i];
  }
  rep(i,n){
    if(d[i]>=k)count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int a, b;
  cin >> a >> b;
  
  if(a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0)
  	cout << "Possible" << endl;
  else
    cout << "Impossible" << endl;
  return 0;
}



Measured memory_bytes: 256
w1=[]
k1=[]
for i in range(10):
    A=int(input())
    w1.append(A)
w=sorted(w1,reverse=True)
W=w[0]+w[1]+w[2]
for j in range(10):
    B=int(input())
    k1.append(B)
k=sorted(k1,reverse=True)
K=k[0]+k[1]+k[2]

print(W,K)


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n, m, a[101010];
void solve(){
	cin >> n >> m;
	i64 cnt = 0;
	for(int i = 0; i < m; i++){
		cin >> a[i];
		cnt += a[i];
	}
	
	cout << max(-1LL, n-cnt) << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i, m, n) for(int i = (int)m; i < (int)n; i++)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;


/*FUNCs=================================================*/



/*MAIN==================================================*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化

    vi num(3); rep(i,3) cin>> num[i];
    sort(num.begin(), num.end());

    int cnt = num[2] - num[1];
    num[0] += cnt;
    if((num[2] -num[0]) % 2 == 0) cout << cnt + (num[2]- num[0])/2 << endl;
    else cout << cnt + (num[2] - num[0] + 1)/2 + 1 << endl;
}

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

#define long long int

signed main(){
    int a;
    cin >> a;

    int cnt = 0;
    int i = 1;

    while(1){
        if(i * 25 <= a)
        {
            cnt++;
            i++;
        }
        if(i * 25 > a){
            a -= (i - 1) * 25;
            break;
        }
    }

    i = 1;
    while(1){
        if(i * 10 <= a) 
        {
            cnt++;
            i++;
        }
        if(i * 10 > a)
            {
                a -= (i - 1) * 10;
                break;
            }
    }

    i = 1;
    while(1){
        if(i * 5 <= a)
        {
            cnt++;
            i++;
        }
    if(i * 5 > a){
        a -= (i - 1) * 5;
        break;
        }    
    }

    i = 1;
    while(1){
        if(i <= a){
            cnt++;
            i++;
        }
        if(i > a){
            a -= (i - 1);
            break;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3112
using System;
using System.Linq;

namespace ChokudaiScanner
{
     class MainClass
    {
        static void Main()
        {
            Scanner cin = new Scanner();

            string S = cin.Next();
            string T = cin.Next();
            int ans = 0;
            
            for(int i = 0; i < S.Length; i++)
            {
                if (S[i] == T[i])
                {

                }
                else
                {
                    ans++;
                }
            }
            Console.WriteLine(ans);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string Next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return Next();
            i = 0;
            return s[i++];
        }

        public string[] ArrayNext(int N)
        {
            string[] Array = new string[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Next();
            }
            return Array;
        }

        public int NextInt()
        {
            return int.Parse(Next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextInt() + add;
            }
            return Array;
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextLong() + add;
            }
            return Array;
        }

        public double NextDouble()
        {
            return double.Parse(Next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextDouble() + add;
            }
            return Array;
        }
    }
}



Measured memory_bytes: 27520
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBUG
int main(){
    int r;
    cin>>r;
    decp(10);
    cout<<(double)2*r*3.1415926535<<endl;
}

Measured memory_bytes: 3788
function f()

    #N = map(x->parse(Int, x), split(chomp(readline()), " "))
    N = parse(Int, chomp(readline()))
    x = []
    u = []

    goukei = 0

    for i in 1:N
        input = split(chomp(readline()), " ")
        x = parse(Float64, input[1])
        u = input[2]

        if u == "BTC"
            goukei = goukei + (x * 380000.0)
        else
            goukei = goukei + x
        end
    end
    print(goukei)

    #input = map(x->parse(Int, x), split(chomp(readline()), " "))
    #a = input[1]
    #b = input[2]

end
f()

Measured memory_bytes: 169568
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int X,A;
  cin >> X >> A;
  if (X < A) cout << 0 << endl;
  else cout << 10 << endl;
  return 0;
}

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()
typedef pair<ll, ll>    P;


int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> ruiseki(n+1, 0);
    REP(i, n) cin >> a[i];
    REP(i, n) ruiseki[i+1] = ruiseki[i] + a[i];
    
    ll left = 0, right = 0;
    ll ans = INF_LL;

    REPN(i, 1, n) {
        ans = min(ans, abs(ruiseki[i] - (ruiseki[n] - ruiseki[i])));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3328
#include"iostream"
using namespace std;
int check(int p, int k,int w[],int n)
{
	int i = 0,s;
	for (int j = 0; j < k; ++j)
	{
		s = 0;
		while (s + w[i] <= p)
		{
			s += w[i];
			++i;
			if (i == n)return n;
		}
	}
	return i;
}
int main()
{
	int n, k,i;
	cin >> n >> k;
	int* w = new int[n];
	for (i = 0; i < n; ++i)
		cin >> w[i];
	int left = 0, right = 1000000000;
	int mid;
	while(right-left>1)
	{
		mid = (left + right) / 2;
		if (check(mid, k, w, n) >= n)right = mid;
		else left = mid;
	}
	cout << right << endl;
	return 0;
}


Measured memory_bytes: 3508
import java.util.*;
import java.lang.*;

import static java.lang.StrictMath.abs;

class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        String[] s = new String[n.length()];
        List<String> ans = new ArrayList<String>();
        s = n.split("");
        int index =0;
        for (int i = 0; i < n.length(); i++) {
            if (s[i].equals("0")) {
                ans.add("0");
            } else if (s[i].equals("1")) {
                ans.add("1");
            } else {
                if(ans.contains("0")|| ans.contains("1")) {
                    ans.remove(index - 1);
                    index --;
                    continue;
                }else{
                        continue;
                }

            }
            index ++;
        }
        for (int k = 0; k < ans.size(); k++) {
            System.out.print(ans.get(k));
        }

    }
}


Measured memory_bytes: 23380
n, _ = gets.split.map(&:to_i)
xs = readlines.map { |l| l.split.map(&:to_i) }

count = 0
xs.each_with_index do |is, i|
  ((i + 1)..(n - 1)).each do |j|
    js = xs[j]
    r = 0
    is.each_with_index do |v, idx|
      r += (v - js[idx]).abs ** 2
    end
    r = r ** (1 / 2.0)
    count += 1 if r % 1 == 0
  end
end

puts count

Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
int getInt(){
    int s;
    scanf("%d", &s);
    return s;
}
int main(){
    int n;
    cin >> n;
    int x[n];
    REP(i, n) x[i] = getInt();

    int sum = 0;
    REP(i, n) sum += x[i];

    int ave;
    ave = sum / n;
    if (sum % n > (n / 2)) ave += 1;

    int ans1 = 0;
    REP(i, n){
        ans1 += (x[i] - ave) * (x[i] - ave);
    }
    cout << ans1 << endl;
    return 0;
}

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

int main(){
	int n,m;
	cin >> n >> m;
	string a[50],b[50];
	for(int i=0;i<n;++i)cin >> a[i];
	for(int i=0;i<m;++i)cin >> b[i];
	for(int i=0;i<=n-m;++i){
		for(int j=0;j<=n-m;++j){
			int x;
			for(x=0;x<m;++x){
				if(a[i+x].substr(j,m)!=b[x])break;
			}
			if(x==m){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long int
#define PB push_back
#define MP make_pair

inline bool cmp(pair<ll, ll> p1, pair<ll, ll> p2) {
	return p1.first < p2.first;
}

int main() {
	ll n, m, ans = 0, cans = 0;
	vector< pair<ll, ll> > v;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		ll a, b;
		cin >> a >> b;
		v.PB(MP(a, b));
	}
	sort(v.begin(), v.end(), cmp);
	int i = 0;
	while (cans < m) {
		ans += v[i].first*min(m - cans, v[i].second);
		cans = min(m, cans+v[i].second);
		i++;
	}
	cout << ans << endl;
	return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max<R>(x,0.0));}

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

// Problem Specific Parameter:

int k,t;

int main(void){
	cin >> k >> t;
	vector<int> a(t,0),ary(k);
	rep(i,t) cin >> a[i];
	sort(rbegin(a),rend(a));

	rep(i,k) if(i%2==0 and a[0]>0)  ary[i]=1,a[0]--;
	rrep(i,k) if(i%2==1 and a[0]>0)  ary[i]=1,a[0]--;

	int ans=0;
	rep(i,1,k) if(ary[i]==1 and ary[i]==ary[i-1]) ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
#include<cassert>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100

static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];

struct Puzzle{int f[N2], space, MD;};
Puzzle state;
int limit;
int path[LIMIT];

int getAllMD(Puzzle pz){
    int sum = 0;
    for(int i = 0; i < N2; i++){
        if(pz.f[i] == N2)continue;
        sum += MDT[i][pz.f[i] - 1];
    }
    return sum;
}

bool isSolved(){
    for(int i = 0; i < N2; i++)if(state.f[i] != i + 1)return false;
    return true;
}

bool dfs(int depth, int prev){
    if(state.MD == 0)return true;
    if(depth + state.MD > limit)return false;
    int sx = state.space / N;
    int sy = state.space % N;
    Puzzle tmp;
    
    for(int r = 0; r < 4; r++){
        int tx = sx + dx[r];
        int ty = sy + dy[r];
        if(tx < 0 || ty < 0 || tx >= N || ty >= N)continue;
        if(max(prev, r) - min(prev, r) == 2)continue;
        tmp = state;
        state.MD -= MDT[tx * N + ty][state.f[tx * N + ty] - 1];
        state.MD += MDT[sx * N + sy][state.f[tx * N + ty] - 1];
        swap(state.f[tx * N + ty], state.f[sx * N + sy]);
        state.space = tx * N + ty;
        if(dfs(depth + 1, r)){ path[depth] = r;return true;}
        state = tmp;
    }
    return false;
}

string iterative_deepening(Puzzle in){
    in.MD = getAllMD(in);
    
    for(limit = in.MD; limit <= LIMIT; limit++){
        state = in;
        if(dfs(0, -100)){
            string ans = "";
            for(int i = 0; i < limit; i++)ans += dir[path[i]];
            return ans;
        }
    }
    return "unsolvable";
}

int main(){
    for(int i = 0; i < N2; i++)
    for(int j = 0; j < N2; j++)
    MDT[i][j] = abs(i / N - j / N) + abs(i % N - j % N);
    
    Puzzle in;
    
    for(int i = 0; i < N2; i++){
        cin >> in.f[i];
        if(in.f[i] == 0){
            in.f[i] = N2;
            in.space = i;
        }
    }
    string ans = iterative_deepening(in);
    cout << ans.size() << endl;
    return 0;
}



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

#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)

typedef vector<int> vi;
typedef vector<string> vs;
typedef complex<int> P;

P d[4] = {
    P(0,1),
    P(0,-1),
    P(1,0),
    P(-1,0)
};

void f(vs& g, int i, int j){
    stack<P> s;
    s.push(P(i,j));
    char init = g[i][j];
    while(s.size()){
        P t = s.top();
        s.pop();
        int x = t.imag();
        int y = t.real();
        if(x<0 || y<0 || x>=g[0].size() || y>=g.size()) continue;
        if(g[y][x]==' ') continue;
        if(g[y][x]!=init) continue;

        g[y][x] = ' ';
        rep(i,4) s.push(t+d[i]);
    }
}

int main(){
    int h,w;
    while(cin>>h>>w, h|w){
        vs g(h);
        rep(i,h) cin>>g[i];
        int ans=0;
        rep(i,h)rep(j,w){
            if(g[i][j]!=' ') ans++;
            f(g,i,j);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1368
import java.io.*;

class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String buf;
		int list[] = {0,1,2,3,5,7,8,9};
		int mask = 7;

		try {
			while (!(buf= br.readLine()).equals("0")) {
				int n = Integer.parseInt(buf);
				int t[] = new int[11];
				int digit = 0;
				while (n>0) {
					t[digit] = (n&mask);
					n >>= 3;
					digit++;
				}
				for (int i=digit-1;i>=0;i--) {
					System.out.print(list[t[i]]);
				}
				System.out.println();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	/*
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
	*/
	int n;
	cin>>n;

	int a[n],b[n],c[n];
	for(int i=0;i<n;i++)
		cin>>a[i]>>b[i]>>c[i];

	int dp[n][3];
	dp[0][0]=a[0];
	dp[0][1]=b[0];
	dp[0][2]=c[0];

	for(int i=1;i<n;i++) {
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

Measured memory_bytes: 2560
def divisor(n):
    # 約数
    return [[i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0]


def main():
    N = int(input())
    print(divisor(N)[-1][0] + divisor(N)[-1][1] - 2)
    return


main()


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

int main() {
  int N;
  cin >>N;
  int flag = 0;
  for (int i=0;i<100;i++) {
    for (int j=0;j<100;j++) {
      if(4*i+7*j==N) {
        flag=1;
        break;
      }
    }
  }
  if(flag==1){
    cout <<"Yes"<<endl;
  } else {
    cout <<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main{
	static final int MOD=998244353;
	public static void main(String[] args) throws IOException{
		BufferedReader in= new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out= new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		
		String s=in.readLine();
		if(s.charAt(2)==s.charAt(3)&&s.charAt(4)==s.charAt(5))
			out.append("Yes\n");
		else
			out.append("No\n");
		
		out.flush();
		in.close();
		out.close();
	}
}     


Measured memory_bytes: 21204
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int d,n;cin>>d>>n;
    if(d==0){
        if(n==100)
            cout<<101<<endl;
        else
        cout<<n<<endl;
    }
        
    else if(d==1){
        if(n==100)
            cout<<10100<<endl;
        else
        cout<<n*100<<endl;
    }
    else
        if(n==100)
            cout<<1010000<<endl;
        else
        cout<<n*10000<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // 998244353 //  //100000000
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << " "; cout << endl;}

ll lx[4] = {0, 0, 1, -1};
ll ly[4] = {1, -1, 0, 0};
ll dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
ll dy[8] = {1, -1, 0, 0, 1, 1, -1, -1};
void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}
ll lcm(ll a, ll b) {return (a/__gcd(a, b))*b; }

void solve(){
    string s;
    cin >> s;
    ll n = s.size(), m = 0;
    rep(i, n-1) if(s[i] != s[i+1]) m++;
    cout << m;
}

int main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3708
# 1.Nが三の倍数でない場合、全てが0でなければならない.(a_i=Σa_k∧a_(i-1)+a_(i+1)=a_iとなるのはa_i=0のみ)
# 2.Nが3の倍数の場合、a,b,a+bを満たす三種類以下の数字で構成されていなければならず、かつそれであればよい。

N = int(input())
string = "No"
input_dict = {}
for i in map(int, input().split()):
    if(i in input_dict):
        input_dict[i] += 1
    else:
        input_dict[i] = 1
if((N % 3) == 0):
    num_count = len(input_dict.keys())
    if(num_count == 3 ):
        input_list = list(input_dict.keys())
        if(input_list[0] ^ input_list[1] == input_list[2] and input_dict[input_list[0]] == N//3 and input_dict[input_list[1]] == N//3):
            string = "Yes"
    elif(num_count == 2):
        if(0 in input_dict and input_dict[0] == N//3):
            string = "Yes"
    elif(num_count == 1):
        if(0 in input_dict):
            string = "Yes"
else:
    if(0 in input_dict and input_dict[0] == N):
        string = "Yes"
print(string)


Measured memory_bytes: 15272
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,count=0;
    cin>>n;
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        if(a==b)
            count++;
        else
            count=0;
        if(count==3){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
}

Measured memory_bytes: 3628
def main
  col_num = gets.chomp.to_i

  # 1行目の累積和
  sum = 0
  row1_cum = gets.split.map do |c|
    sum += c.to_i
    sum
  end
  # 2行目の累積和
  sum = 0
  row2_cum = gets.split.map do |c|
    sum += c.to_i
    sum
  end
  # puts [row1_cum[-1], row2_cum[-1]]

  row2_sum = row2_cum[-1]

  # x の位置で下に下がったときの合計を調べてmaxを求める
  max_ans = 0
  0.upto(col_num-1) do |x|
    # 下段合計
    row2_rest_sum = if x == 0
                      row2_sum
                    else
                      row2_sum - row2_cum[x-1]
                    end
    # 上段＋下段
    s = row1_cum[x] + row2_rest_sum
    max_ans = [s, max_ans].max
  end

  puts max_ans
end

if __FILE__ == $0
  main
end

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

int64_t comb2(int64_t n){
  return n*(n-1)/2;
}

int main(){
  
  int n; cin >> n;
  vector<vector<char>> character(n, vector<char>(10));
  for(int i=0; i<n; ++i){
    for(int j=0; j<10; ++j){
      cin >> character.at(i).at(j);
    }
    sort(character.at(i).begin(), character.at(i).end());
  }
  
  sort(character.begin(), character.end());
  int64_t sum = 0;
  
  for(int i=0; i<n-1; ++i){
    static int count = 1;
    if(character.at(i) == character.at(i+1)){
      ++ count;
      if(i == n-2){
        sum += comb2((int64_t)count);
      }
    }
    else{
      sum += comb2((int64_t)count);
      count = 1;
    }
  }
  
  cout << sum << endl;
  return 0;
}


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

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


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

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

vector< ll > divisor(ll n) {
  vector< ll > ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main()
{
    ll n;
    cin>>n;
    vector<ll> ndiv=divisor(n), n1div=divisor(n-1);

    ll ans=n1div.size()-1;
    
    for (int i = 1; i < ndiv.size(); i++)
    {

        ll kouho = ndiv[i];
        ll tmp=n;
        while (kouho<=tmp)
        {
            if(tmp%kouho==0) tmp/=kouho;
            else tmp %= kouho;
        }
        if(tmp==1) ans++;
    }
    

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

Measured memory_bytes: 384
import scala.io.StdIn.readLine
import scala.math.{max,min}

object Main extends App {

  var m = readLine.split(" ").map(_.toInt)
  while( (m(0),m(1)) != (0,0) ){
    val Array(n,x) = m
    println( ( 1 until min(n-1,x/3) ).foldLeft(0) { (sum,i) => sum + (max(i+1,x-i-n) until min(n,(x-i+1)/2)).length })

    m = readLine.split(" ").map(_.toInt)
  }
}

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

a.sort()
large = a.pop()

min_val =  0
for i in a:
    min_val =  max(min_val, min(i,large-i)
                   )

if min_val in a:
    print(large , min_val)
else:
    print(large, large-min_val)

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1e18
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int dp[3010][3010];

int main(){
    int n,t;
    cin>>n>>t;
    vii a(n);
    rep(i,n)cin>>a[i].F>>a[i].S;
    sort(all(a));
    mem(dp,0);
    rep(i,n){
        rep(j,t){
            dp[i+1][j]=dp[i][j];
            if(j-a[i].F>=0){
                dp[i+1][j]=max(dp[i][j-a[i].F]+a[i].S,dp[i+1][j]);
            }
        }
    }
    int ans=0;
    rep(i,n){
        ans=max(dp[i][t-1]+a[i].S,ans);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 38992
<?php

$string = trim(fgets(STDIN));

$parts = explode(" ", $string);

$a = $parts[0];
$b = $parts[1];
$c = $parts[2];

if (($b - $a) == ($c -$b))
{
    echo "YES";
}
else
{
    echo "NO";
}

echo "\n";

Measured memory_bytes: 3828
// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

typedef long long LL;
typedef long double LD;

int main(int argc, char* argv[]) {
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	for (int i = k; i < n; ++i) {
		cout << (a[i - k] < a[i] ? "Yes" : "No") << endl;
	}
	return 0;
}


Measured memory_bytes: 3968
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a = LIST()
    a.sort()
    print(a[0]+a[1])
if __name__ == '__main__':
    do()

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

using lint = long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

constexpr lint INF = 1'010'000'000'000'000'017LL;
constexpr lint MOD = 1'000'000'007LL;
constexpr double EPS = 1e-12;
constexpr double PI = 3.14159265358979323846;

#define FOR(i, start, end) for(lint i = (start); i < end; i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()

template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }

lint mod(lint val, lint m){ lint res = val % m; if(res < 0) res += m; return res;}
lint modinv(lint a, lint m) { lint b = m, u = 1, v = 0; while (b) { lint t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u;}
lint modpow(lint a, lint n, lint mod) { lint res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
lint gcd(lint a, lint b){ if(a < b) swap(a, b); if(b == 0) return a; return gcd(b, a%b);}
lint lcm(lint a, lint b){ return a * b / gcd(a, b);}


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

void Main()
{
    string S;
    cin >> S;
    int ans;
    if(S == "SAT"){
        ans = 1;
    }else if(S == "FRI"){
        ans = 2;
    }else if(S == "THU"){
        ans = 3;
    }else if(S == "WED"){
        ans = 4;
    }else if(S == "TUE"){
        ans = 5;
    }else if(S == "MON"){
        ans = 6;
    }else{
        ans = 7;
    }
    cout << ans << endl;
}

//---------------------------------------------------------------
int main()
{
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 256
h,w=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(h)]
ans=[]
for i in range(h):
    for j in range(w-1):
        if a[i][j]%2==1:
            a[i][j+1]+=1
            ans.append([i+1,j+1,i+1,j+2])
for i in range(h-1):
    if a[i][w-1]%2==1:
        a[i+1][w-1]+=1
        ans.append([i+1,w,i+2,w])
print(len(ans))
for i in ans:
    print(*i)

Measured memory_bytes: 30288
#include<bits/stdc++.h>
 
 
using namespace std;
 
 
 
int main() {
 
	string a, b, c;
	cin >> a >> b >> c;
	char x = a[0];
	x += 'A' - 'a';
	cout <<x <<char(b[0]+ 'A' - 'a') <<char(c[0] + 'A' - 'a') << endl;
 
	return 0;
 
}
 

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int n;
    int i;
    int cnt;
    
    
    while (1){
        scanf("%d", &n);
        if (n == 0) break;
        
        cnt = 0;
        
        while (n != 1){
            if (n % 2 == 0){
                n /= 2;
            }
            else {
                n *= 3;
                n++;
            }
            cnt++;
        }
        printf("%d\n", cnt);
    }
    
    return (0);
}

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

using namespace std;

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	int w, a, b;

	cin >> w >> a >> b;

	if (a > b)
		swap(a, b);
	
	int ans = b - a - w;

	cout << max(ans, 0) << endl;

	return 0;

}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
/**
 *  @author citizen11
 *  AtCoder Regular Contest 78
 *  Task C - Splitting Pile
 */
public class Main {
    public static void main(String[] args) {
        Reader.init(System.in);
        try {
            int n = Reader.nextInt();
            List<Integer> A = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                A.add(Reader.nextInt());
            }
            System.out.println(solve(n, A));
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    public static long solve(int n, List<Integer> A) {
        long sum = 0;
        for (long a : A) {
            sum += a;
        }
        long min = Math.abs(2*A.get(0) - sum);
        long runningSum = A.get(0);
        for (int i = 1; i < A.size()-1; i++) {
            runningSum += A.get(i);
            min = Math.min(min, Math.abs(2*runningSum - sum));
        }
        return min;
    }
}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(
                   reader.readLine());
        }
        return tokenizer.nextToken();
    }

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

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


Measured memory_bytes: 45836
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  int n,m;
  cin >> n >> m;
  int a[m],b[m];
  multiset<int> s;
  rep(i,m){
    cin >> a[i] >> b[i];
    a[i]--;b[i]--;
    s.insert(a[i]);s.insert(b[i]);
  }
  rep(i,n){
    if(s.count(i)%2!=0){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  
  return 0;
    

}


Measured memory_bytes: 10368
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			var d = new SortedDictionary<string, List<int>>();
			var s = "";
			while ((s = Console.ReadLine()) != null)
			{
				var wn = s.Split(' ');
				if (!d.ContainsKey(wn[0]))
					d.Add(wn[0], new List<int>());
				d[wn[0]].Add(int.Parse(wn[1]));
			}
			foreach(var w in d)
			{
				Console.WriteLine(w.Key);
				w.Value.Sort();
				Console.WriteLine(string.Join("", w.Value.Select(i => i + " ").ToArray()).TrimEnd(' '));
			}
		}
	}
}

Measured memory_bytes: 7200
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ffast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define filoop(n) for(ll i=0;i<(n);i++)
#define fjloop(n) for(ll j=0;j<(n);j++)

int main()
{
    ffast;
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);


//    int t;
//    cin>>t;
//    while(t--)
//    {
        int a,b,c;
        cin>>a>>b>>c;
        //if(a==b && a==c) cout<<"No\n";
        if( (a==b&&a!=c)  || (b==c&&a!=b) || (a==c&&a!=b)  ) cout<<"Yes\n";
        else cout<<"No\n";

//    }

    return 0;
}




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

int main() {
  int A,B;
  cin>>A>>B;
  
  if (A>=13) {
    cout<<B<<endl;
  }
  else if (A>=6 && A<=12) {
    cout<<B/2<<endl;
  }
  else if (A>=0 && A<6) {
    cout<<0<<endl;
  }
}

Measured memory_bytes: 256
n = int(input())
city_to_points = dict()

for i in range(n):
    s, p = input().split()
    p = int(p)
    if s not in city_to_points:
        city_to_points[s] = [[p, i + 1]]
    else:
        city_to_points[s].append([p, i + 1])

kyes = list(city_to_points.keys())
kyes.sort()

for i in kyes:
    restrans = city_to_points[i]
    restrans.sort(reverse=True)
    for j in restrans:
        print(j[1])

Measured memory_bytes: 9204
#include<stdio.h>
int main(void){
  
  int i, count0, count1, ans, dst;
  char S[100000];
  scanf("%s",S);

  count0 = count1 = ans = 0;
  dst = strlen(S);
  for(i = 0; i < dst; ++i){
    if(S[i] == '0'){
      count0++;
    } else {
      count1++;
    }
  }
  
  ans = (count0 >= count1) ? count1: count0;
  printf("%d\n", 2 * ans);
  return 0;
}


Measured memory_bytes: 256