akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

    class Program
    {
        static void Main(string[] args)
        {
			var input = Console.ReadLine();
            if (input[2] == input[3] && input[4] == input[5])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

		}
    }


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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair

const int N = 222222;
vii G(N);
vi d(N);

void dfs(int now, int par, int dep) {
  d[now] = dep;
  rep (i, G[now].size()) {
    int v = G[now][i];
    if (v == par) continue;
    dfs(v, now, dep + 1);
  }
}

int main() {
  int n;
  cin >> n;
  rep (i, n - 1) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }

  dfs(0, -1, 0);
  int ma = -1, root = -1;
  rep (i, n) {
    if (d[i] > ma) {
      ma = d[i];
      root = i;
    }
  }

  dfs(root, -1, 0);
  ma = -1;
  rep (i, n) {
    if (d[i] > ma) {
      ma = d[i];
    }
  }

  ma++;
  vi dp(ma + 10);
  dp[0] = 0;
  dp[1] = 1;
  dp[2] = 0;
  for (int i = 3; i <= ma; i++) {
    if (dp[i - 2] == 1 && dp[i - 1] == 1) {
      dp[i] = 0;
    }
    else {
      dp[i] = 1;
    }
  }

  if (dp[ma]) {
    cout << "First" << endl;
  }
  else {
    cout << "Second" << endl;
  }
    
}


Measured memory_bytes: 22784
fun main(args:Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!

    val countEastForRight = mutableListOf<Int>()
    countEastForRight.add(0)
    for(i in (0 until n - 1).reversed()) {
        if(s[i + 1] == 'E') {
            countEastForRight.add(countEastForRight.last() + 1)
        } else {
            countEastForRight.add(countEastForRight.last())
        }
    }
    countEastForRight.reverse()
    val countWestForLeft = mutableListOf<Int>()
    countWestForLeft.add(0)
    for(i in (1 until n)) {
        if(s[i-1] == 'W') {
            countWestForLeft.add(countWestForLeft.last() + 1)
        } else {
            countWestForLeft.add(countWestForLeft.last())
        }
    }
    var ans = s.length
    for(i in (0 until n)) {
        ans = Math.min(ans, countEastForRight[i] + countWestForLeft[i])
    }
    println(ans)
}

Measured memory_bytes: 50200
#include<iostream>

using namespace std;

int D[20];
int N,K;
int out = 0;

void dfs (int n);
bool chk (int n);

int main(){
  int i;
  cin >> N >> K;
  for (i=0;i<K;i++){
      cin >> D[i];
  }
  dfs(N);
  cout << out;
}


void dfs (int n ){
    if(chk(n)){
       out =n;
       return;
    }
    dfs(n+1);
}

bool chk(int n) {
    int i,t,z;
    t = n;
    while(t > 0){
       z=t%10;
       for(i=0;i<K;i++){
          if(z==D[i])return false;
       }
       t=t/10;
    }
    return true;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
using namespace std;

int n;

main()
{
    cin>>n;

    vi v;
    rep(i,n)
    {
        int a;
        cin>>a;
        if(a%2==1)continue;
        v.push_back(a);
    }

    bool f=true;
    each(it,v)
    {
        if(it%3==0||it%5==0)continue;
        f=false;
    }
    if(f)cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vs = vector<string>;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repp(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define repd(i, n) for(ll i = n - 1; i >= 0; i--)
#define all(x) x.begin(), x.end()

int k, l, m, n;
const int M = 1e9 + 7;



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

    int d, t, s;
    cin >> d >> t >> s;

    if((double)d / s <= (double)t) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
} */

int main() {
	int d, t, s;
	cin >> d >> t >> s;

	if((double)d / s <= t) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll INF = 9223372036854775807;
const ll MOD = 1000000007;
const long double PI = acos(-1);
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define o0(a) cout<<a<<" "
#define o1(a) cout<<a<<"\n"
#define o2(a, b) cout<<a<<" "<<b<<"\n"
#define o3(a, b, c) cout<<a<<" "<<b<<" "<<c<<"\n"
#define o4(a, b, c, d) cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n"
#define i1(a) cin>>a
#define i2(a, b) cin>>a>>b
#define i3(a, b, c) cin>>a>>b>>c
#define i4(a, b, c, d) cin>>a>>b>>c>>d
#define fi first
#define se second

ll power(ll a, ll b, ll z = MOD)
{
	ll res = 1;
	a = (a%z);
	while(b)
	{
		if(b&1)
			res = (res*a)%z;
		a = (a*a)%z;
		b = b>>1;
	}
	return res;
}

ll inverse(ll a, ll z = MOD)
{
	return power(a, z-2, z);
}

ll extend(ll a, ll b, ll &x, ll &y)
{
	if(b == 0)
	{
		x = 1;
		y = 0;
		return a;
	}
	ll x1, y1;
	ll g = extend(b, a%b, x1, y1);
	x = y1;
	y = x1- (a/b)*y1;
	return g;
}

ll mat_power(ll a, ll b, ll c, ll d, ll n, ll z = MOD)
{
	ll a0 = 1, b0 = 0, c0 = 0, d0 = 1;
	while(n)
	{
		if(n&1)
		{
			ll a1 = a0, b1 = b0, c1 = c0, d1 = d0;
			a0 = (a1*a + b1*c)%z;
			b0 = (a1*b + b1*d)%z;
			c0 = (c1*a + d1*c)%z;
			d0 = (c1*b + d1*d)%z;
		}
		ll a1 = a, b1 = b, c1 = c, d1 = d;
		a = (a1*a1 + b1*c1)%z;
		b = (a1*b1 + b1*d1)%z;
		c = (c1*a1 + d1*c1)%z;
		d = (c1*b1 + d1*d1)%z;
		n = n>>1;
	}
	return c0;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n, d;
	i2(n, d);
	ll ans = 0;
	ll x, y;
	while(n--)
	{
		i2(x, y);
		if((x*x+y*y) <= d*d)
			ans++;
	}
	o1(ans);
	return 0;
}

Measured memory_bytes: 3648
n=int(input())
a=list(map(int,input().split()))
x=1
if 0 in a:
  print("0")
  exit()

for i in range(n):
  x*=a[i]
  if x<=1000000000000000000:
    pass
  else:
    print("-1")
    exit()
  
print(x)

Measured memory_bytes: 21796
import sys
from collections import deque

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

sa = deque(input())
sb = deque(input())
sc = deque(input())
li = [sa, sb, sc]
turn = ["a", "b", "c"]
now = 0
while True:
    if len(li[now]) == 0:
        print(turn[now].upper())
        break
    s = li[now].popleft()
    now = turn.index(s)

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

int main()
{
	int a, b, c;

	int l, r;
	for (int i = 0; i < 3; i++)
	{
		cin >> a >> b >> c;

		if (!i)
		{
			l = abs(a - b);
			r = abs(b - c);
		}
		if (l != abs(a - b) || r != abs(b - c))
		{
			cout << "No" << endl;
			return (0);
		}
	}
	cout << "Yes" << endl;
	return (0);
}


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N;
ll T[int(1e5+5)], A[int(1e5+5)];
ll Ht[int(1e5+5)], Ha[int(1e5+5)];

int main(){
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> T[i];
  for (int i = 1; i <= N; i++) cin >> A[i];

  for (int i = 1; i <= N; i++){
    if (T[i-1] < T[i]) Ht[i] = T[i];
  }
  for (int i = N; i >= 1; i--){
    if (A[i] > A[i+1]) Ha[i] = A[i];
  }


  ll ans = 1;
  for (int i = 1; i <= N; i++){
    if (Ht[i] == 0 && Ha[i] == 0){
      ans *= min(T[i], A[i]);
    }else{
      if (Ht[i] > 0 && Ha[i] > 0 && Ht[i] != Ha[i]){
        ans *= 0;
      }
      if (Ht[i] > 0 && Ha[i] == 0 && T[i] > A[i]){
        ans *= 0;
      }
      if (Ht[i] == 0 && Ha[i] > 0 && A[i] > T[i]){
        ans *= 0;
      }
    }
    ans %= MOD;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6056
n = input()
a = map(int, raw_input().strip().split())
eve = {}
odd = {}
for i in xrange(0, n, 2):
    try: eve[a[i]] += 1
    except: eve[a[i]] = 1
for i in xrange(1, n, 2):
    try: odd[a[i]] += 1
    except: odd[a[i]] = 1
    
em1 = em2 = om1 = om2 = 0
xe1 = xe2 = xo1 = xo2 = 0
for k in eve:
    if eve[k] > em1:
        em2 = em1
        xe2 = xe1
        em1 = eve[k]
        xe1 = k
    elif eve[k] > em2:
        em2 = eve[k]
        xe2 = k
    
for k in odd:
    if odd[k] > om1:
        om2 = om1
        xo2 = xo1
        om1 = odd[k]
        xo1 = k
    elif odd[k] > om2:
        om2 = odd[k]
        xo2 = k

if xe1 != xo1:
    print n - em1 - om1
else:
    t = n // 2
    if em1 > om1: ans = n - em1 - om2
    elif em1 < om1: ans = n - om1 - em2
    else:
        ans = t - em1
        ans += min(t - em2, t - om2)
    print ans


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

int main(){
    int n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    rep(i, n-1){
        if(a[i] == a[i+1]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define PI (3.14159265358979323846)
#define INF (2147483647)
#define INF_LL (9223372036854775807)
#define DIV_NUM (1000000007)
typedef long long ll;

// 配列初期化テンプレ
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}



int main() {

	int N, A, B, C;
	cin >> N >> A >> B >> C;

	vector<string> inputs;
	vector<string> output;

	for (int i = 0; i < N; i++) {
		string tmp;
		cin >> tmp;
		inputs.push_back(tmp);
	}


	for (int i = 0; i < N; i++) {
		string input = inputs[i];

		if (input == "AB") {
			if (A == B) {
				if (i < N - 1 && inputs[i + 1] == "AC") {
					A++;
					B--;
					output.push_back("A");
				}
				else{
					A--;
					B++;
					output.push_back("B");
				}
			}
			else if (A > B) {
				A--;
				B++;
				output.push_back("B");
			}
			else {
				A++;
				B--;
				output.push_back("A");
			}
		}
		else if (input == "AC") {
			if (A == C) {
				if (i < N - 1 && inputs[i + 1] == "AB") {
					A++;
					C--;
					output.push_back("A");
				}
				else {
					A--;
					C++;
					output.push_back("C");
				}
			}else if (A > C) {
				A--;
				C++;
				output.push_back("C");
			}
			else {
				A++;
				C--;
				output.push_back("A");
			}
		}
		else if (input == "BC") {
			if (B == C) {
				if (i < N - 1 && inputs[i + 1] == "AB") {
					B++;
					C--;
					output.push_back("B");
				}
				else {
					B--;
					C++;
					output.push_back("C");
				}
			}else if (B > C) {
				B--;
				C++;
				output.push_back("C");
			}
			else {
				B++;
				C--;
				output.push_back("B");
			}
		}
		if (A < 0 || B < 0 || C < 0) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
	for (int i = 0; i < output.size(); i++) {
		cout << output[i] << endl;
	}

	return 0;

}


Measured memory_bytes: 12452
#include <bits/stdc++.h>
//#define TASK "file"

#define F first
#define S second
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long i64;
typedef long double dbl;
const dbl PI = acos(-1.0L);
const dbl EPS = 1e-12L;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

namespace task {
vector<int> a;
int k;

int main() {
  a = {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};
  cin >> k;
  cout << a[k - 1] << '\n';
  return 0;
}
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(11);
  cout.setf(ios::fixed);
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#elif defined(TASK)
  freopen(TASK".in", "r", stdin);
  freopen(TASK".out", "w", stdout);
#endif
  return task::main();
}


Measured memory_bytes: 256
import java.math.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Long> bList = new ArrayList<>();
    for (int i = 0; i < n - 1; i++) {
      bList.add(sc.nextLong());
    }
    long result = bList.get(0) + bList.get(n - 2);
    for (int i = 1; i < n - 1; i++) {
      result += Math.min(bList.get(i - 1), bList.get(i));
    }
    System.out.println(result);
  }
}


Measured memory_bytes: 27160
#include <stdio.h>

int main()
{
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	int x;
  	x = c - a;
    int y;
  	y = d - b;
	printf("%d %d %d %d\n",c-y,d+x,a-y,b+x);
}

Measured memory_bytes: 384
//Abhinav ---IIIT_A
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define f(i,x,n) for(int i=x;i<(int)n;++i)
#define vpii vector<pair<int,int>>
#define vi vector<int>
#define mpii map<pair<int,int>,int>
#define mpivpii map<int,vector<pair<int,int>>>
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define mpi map<int,int>
#define vvi vector<vector<int>>
#define vvvi vector<vvi>
ld pie=3.141592653589;
int mod=1e9+7;

bool Compare(pair<int,int> a, pair<int,int> b)
{
    int l1=a.ss-a.ff+1;
    int l2=b.ss-b.ff+1;
    if(l1!=l2) return l1>l2;
    return a.ff > b.ff;
}
std::priority_queue<pii, std::vector<pii>, std::function<bool(pii, pii)>> pq(Compare);

vi vt;

int operation(int a,int b){
  return a+b;
}

void st(int curr,int l,int r,int idx,int val){
  if(l==r){
    if(l==idx) vt[curr]+=val;
    vt[curr]=max(vt[curr],0ll);
    return ;
  }
  int mid=(l+r)/2;
  if(idx>mid) st(2*curr+2,mid+1,r,idx,val);
  else st(2*curr+1,l,mid,idx,val);
  vt[curr]=operation(vt[2*curr+1],vt[2*curr+2]);
}


int gt(int curr,int l,int r,int lx,int rx){
  if(l==r){
    if(l>=lx && l<=rx) return vt[curr];
    return 0;
  }
  if(l>=lx && r<=rx) return vt[curr];
  if(r<lx || l>rx) return 0;
  int mid=(l+r)/2;
  return gt(2*curr+1,l,mid,lx,rx) + gt(2*curr+2,mid+1,r,lx,rx);
}


int32_t main(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
  int x,y; cin>>x>>y;
  if(x%y==0) cout<<"-1";
  else cout<<x;
  return 0;
}
// check for overflows dummy !!!


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

using namespace std;

int N,M,K,L,R,H,W;
//long long int N,M,K,L,R,H,W;

//const long long int MOD=1000000007;
const int MOD=1000000007;
//const long long int MOD=998244353;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>N>>L>>R;
	vector<int>Ldis(N+2);
	vector<int>Rdis(N+2);
	cout<<"? "<<L<<" "<<R<<endl;
	cin>>K;
	vector<pair<int,int>>v;
	for(int i=1;i<=N;i++){
		cout<<"? "<<L<<" "<<i<<endl;
		cin>>H;
		cout<<"? "<<i<<" "<<R<<endl;
		cin>>W;
		if(H+W==K){
			v.push_back({H,i});
		}
	}
	sort(v.begin(),v.end());
	cout<<"!";
	for(auto i:v)cout<<" "<<i.second;
	cout<<endl;
	return 0;
}


Measured memory_bytes: 4652
#include<iostream>
#define ll long long
using namespace std;
double pi= 3.14159265358979323846;	
ll num[2000060]={0};
ll ans[2000060]={0};
int main(){
	ll N;
	cin>>N;
	ll t;
	for(int i=2;i<=N;i++){
		cin>>t;
		ans[t]++;
	}
	for(int i=1;i<=N;i++){
		cout<<ans[i]<<endl;
	}
	return 0;
} 

Measured memory_bytes: 4732
a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k == x:
                cnt+=1
print(cnt)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <iostream>


using namespace std;


int main()
{
	int sum = 0;
	double aveSum = 0;
	int cost, sales;
	int n = 0;
	while (scanf("%d,%d", &cost, &sales) != EOF)
	{
		sum += cost * sales;
		aveSum += sales;
		++n;
	}
	printf("%d\n%d\n", sum, (int)(aveSum/n+0.5));

	return 0;
}

Measured memory_bytes: 0
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <sstream> 
#include <cctype>
#include <stack>
#include <queue>
#include <cstring>
#include <map>
#include <list>
#include <cassert>
 
using namespace std; 


int main(){

	string s;
	cin>>s;


	vector<int> t[26];
	for(int i=0;i<26;i++){
		for(int j=0;j<s.size();j++){
			if(s[j]-'a'==i) t[i].push_back(1);
			else t[i].push_back(-1);
		}
	}

	int n=s.size();
	for(int i=0;i<26;i++){
		vector<int> dp(n);
		dp[0]=t[i][0];
		int l=0,r=0;
		for(int j=1;j<n;j++){
			if(dp[j-1]+t[i][j]>=t[i][j]){
				dp[j]=dp[j-1]+t[i][j];
				r=j;
			}else{
				dp[j]=t[i][j];
				l=r=j;
			}

			if(dp[j]>0 && l!=r){
				cout<<l+1<<" "<<r+1<<endl;
				return 0;
			}
		}
	}

	cout<<-1<<" "<<-1<<endl;

}

Measured memory_bytes: 11192
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;
typedef long long ll;

const int MOD = 1e9+7;
const int INF = 1e9;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin>>N;
    vector<ll> a(N);
    string ans = "second";
    rep(i,N){
        cin>>a[i];
        if(a[i] % 2 == 1){
            ans = "first";
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
// AOJ 	2546 Chocolate
// 2018.2.5 bal4u

#include <stdio.h>

 char map[101][101];
  
#define getchar_unlocked()  getchar()
int in()
{
    int n = 0;
    int c = getchar_unlocked();
    do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
    while (c >= '0');
    return n;
}
 
int main()
{
	int m, n, r, c, w, e, ans;;

	m = in(), n = in();
	for (c = 0; c < n; c++) map[0][c] = getchar_unlocked() & 1, getchar_unlocked();
	for (r = 1; r < m; r++) for (c = 0; c < n; c++)
		map[r][c] = ~getchar_unlocked() & 1, getchar_unlocked();
	
	ans = 0;
	for (r = 0; r < m; r++) {
		w = 0, e = n;
		while (w < e) {
			if (map[r][w]) { ans++, w++, map[r][w] = !map[r][w]; }
			else { ans += map[r][--e], map[r][e-1] = !map[r][e-1]; }
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 2080
//Problem D
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int n,m,a[N];
long long ans;
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        a[i]=(a[i]+a[i-1])%m;
    }
    sort(a,a+n+1);
    for(int i=0,cnt;i<=n;i++){
        if(!i||a[i]!=a[i-1])cnt=0;
        else ++cnt;
        ans+=cnt;
    }printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 640
x,y = map(int,input().split())

mod = 10**9 + 7

if (x+y)%3 != 0:
    print(0)
    
else:
    
    n=(x+y)//3
    
    r = min(x-n,y-n)
    
    if r<0:
        print(0)
        
    else:
    
        p=1
        q=1
        for i in range(r):
           
            p *= n-i
            p %= mod
            
    
            q *= i+1
            q %= mod
                
        ans = p * pow(q,mod-2,mod)
        ans %= mod
            
        print(ans)

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

using namespace std;

int main()
{
  int N;
  cin >> N;
  vector<int> H(N);
  for(auto&& h : H) {
    cin >> h;
  }
  int point = 0;
  int move = 0;
  for(int i = 0; i < N - 1; i++) {
    int m = 0;
    int j = 0;
    int dh = 0;
    dh = H[i + j] - H[i + j + 1];
    while(dh >= 0) {
      m++;
      j++;
      if(i + j + 1 >= N) break;
      dh = H[i + j] - H[i + j + 1];
    }
    i += j;
    move = max(move, m);
  }
  cout << move << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define pb push_back

using namespace std;

typedef priority_queue<int, vector<int>, greater<int>> minPq;
typedef priority_queue<int> maxPq;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<int> vll;
typedef pair<ll, ll> pll;
const int INF = 1e9 + 7;
void init() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
#ifdef _DEBUG
    freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
#endif
}

int main() {
    init();
    int N, K;
    cin >> N >> K;
    vector<int> cost(N), h(N);
    for (int i = 0; i < N; i++) {
        cin >> h[i];
    }
    int minn;
    for (int i = 1; i < N; ++i) {
        minn = INF;
        for (int j = 1; j <= K; ++j) {
            if (i - j >= 0) {
                minn = min(minn,cost[i - j] + abs(h[i] - h[i - j]));
            }
        }
        cost[i] = minn;
    }
    cout << cost[N - 1] << '\n';
}


Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
double pie=3.14159265358979;
long long mod=1000000007;
//

int main(){
	int d;
	int c[26];
	cin>>d;
	for(int i=0;i<26;i++){
		cin>>c[i];
	}
	int s[365][26];
	for(int i=0;i<d;i++){
		for(int j=0;j<26;j++){
			cin>>s[i][j];
		}
	}
	long long ans=0;
	int t[365];
	long long mem[26]={};
	for(int i=0;i<d;i++){
		cin>>t[i];
		t[i]--;
		ans+=s[i][t[i]];
		for(int j=0;j<26;j++){
			if(j==t[i]){
				mem[j]=0;
			}else{
				mem[j]+=c[j];
				ans-=mem[j];
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    int n;cin >> n;
    vector<int> a(n);
    rep(i,n)cin >> a[i];
    int s =0 ;
    rep(i,n)s += a[i];
    s /= n;
    int ret = 1e18;
    {
        int tmp = 0;
        rep(i,n){
            tmp += (a[i]-s)*(a[i] - s);
        }
        ret = min(ret,tmp);
    }
    s++;
    {
        int tmp = 0;
        rep(i,n){
            tmp += (a[i]-s)*(a[i] - s);
        }
        ret = min(ret,tmp);
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int N;
bool pri[110];
int cou[110];
int dp[110][76];

int main(){
	cin >> N;
	for(int i = 2; i <= N; i++){
		pri[i] = true;
	}
	for(int i = 2; i <= N; i++){
		if(pri[i] == true){
			int tmp = i;
			while(tmp + i <= N){
				tmp += i;
				pri[tmp] = false;
			}
		}
	}
	for(int i = 2; i <= N; i++){
		if(pri[i]){
			int tmp = N;
			while(tmp){
				tmp /= i;
				cou[i] += tmp;
			}
		}
		cou[i]++;
	}
	for(int i = 2; i <= N; i++){
		for(int j = 1; j <= cou[i]; j++){
			if(pri[i] && j != 1 && j <= 75)dp[i][j]++;		
			for(int k = 1; k <= 75; k++){
				int to = j * k;
				if(to <= 75){
					dp[i][to] += dp[i - 1][k];
				}
			}
		}
	}
	cout <<dp[N][75]<< endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

namespace AtCoder.BeginnersSelections
{
    class D_EnoughArray
    {
        static void Main(string[] args)
        {
            foreach (var result in Solve())
            {
                WriteLine(result);
            }
        }

        static IEnumerable<long> Solve()
        {
            var q = int.Parse(ReadLine().Split()[1]);
            var s = ReadLine();
            var prev = s[0];
            var summary = new int[s.Length];
            for (int i = 1; i < s.Length; i++)
            {
                char c = s[i];

                if (prev == 'A' && c == 'C')
                    summary[i] = summary[i - 1] + 1;
                else
                    summary[i] = summary[i - 1];

                prev = c;
            }

            for (int i = 0; i < q; i++)
            {
                var lr = ReadLine().Split().Select(int.Parse).ToArray();
                yield return summary[lr[1] - 1] - summary[lr[0] - 1];
            }
        }
    }
}


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

x = 1

if min(X) == 0:
  print(0)
  x = -1
else:
  for i in range(N):
    x = x * X[i]
    if x > 10 ** 18:
      print(-1)
      x = -1
      break
    
if x > 0: print(x)

Measured memory_bytes: 84800
house = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    house[b-1][f-1][r-1] += v

for i, building in enumerate(house, 1):
    for floor in building:
        for room in floor:
            print(' {0}'.format(room), end='')
        print()
    if i != 4:
        print('#' * 20)



Measured memory_bytes: 5624
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define puts(i) cout<<i<<endl
#define pi 3.14159265358979323846264338
#define pb push_back
#define mp make_pair
#define inf 10000
using ll = long long;
using P = pair<int,int>;
using Pll = pair<ll,ll>;

ll divisor=1000000007;

int main(){
	int x[5];
	rep(i,5)cin>>x[i];
	rep(i,5){
		if(x[i]!=i+1){
			puts(i+1);
			break;
		}
	}
	
}


Measured memory_bytes: 3620
import math
n = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
def a(n, P):
  ret = 0
  for i in range(n):
    ret = ret + (P[i] - 1) * math.factorial(n-i-1)
    for j in range(i+1, n):
      if P[j] > P[i]:
        P[j] = P[j] - 1
  return ret
print(abs(a(n, P)-a(n, Q)))

Measured memory_bytes: 3064
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
typedef pair<ll, int> P;
const int INF = 1000000007;

int main(){
    int N, M;
    cin >> N >> M;
    vector<ll> A(N);
    vector<P> B(M);
    
    rep(i, N) cin >> A[i];
    sort(all(A));

    rep(i, M){
        P tmp;
        cin >> tmp.second >> tmp.first;
        B[i] = tmp;
    }

    sort(all(B));
    reverse(all(B));

    vector<ll> rewrite(N, 0);
    int index = 0;
    for(auto i : B){
        for(int j = 0; j < i.second && index < N; j++){
            rewrite[index] = i.first;
            index++;
        }
        if(index == N) break;
    }

    ll sum = 0;
    rep(i, N){
        if(rewrite[i] > A[i]) sum += rewrite[i];
        else sum += A[i];
    }

    cout << sum << endl;

}

Measured memory_bytes: 3328
#include<stdio.h>
int main(){
  int k,s,ans=0;
  scanf("%d%d",&k,&s);
  for(int x=0;x<=k;x++){
    for(int y=0;y<=k;y++){
      int z=s-x-y;
      if(0<=z&&z<=k) ans++;
    }
  }
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===
n = int(input())
tmp = input().split()
items = [int(n) for n in tmp]
m = int(input())
tmp = input().split()
targets = [int(n) for n in tmp]

ans = [0]
for num in items:
    tmp = deepcopy(ans)
    for i in range(len(tmp)):
        tmp[i] += num
    ans.extend(tmp)

a = set(ans)

for tgt in targets:
    if tgt in a:
        print("yes")
    else:
        print("no")


Measured memory_bytes: 50656
#include <stdio.h>
#include <string.h>

int main(void){
    // Your code here!
    char str[100001];
    char tmpstr[100001];
    char *test[4] = {"dreamer","dream","eraser","erase"};
    
    scanf("%100000s",str);
    strcpy(tmpstr,str);
    
    while(strlen(str) > 0){
        int i;
        char *index;
        for(i = 0; i < 4; i++){
            if((index = strstr(str,test[i])) != NULL){
                if(strcmp(test[i],"dreamer") == 0 && *(index + 7) == 'a'){
                    i = 1;
                }
                break;
            }
        }
        if(i == 4){
            printf("NO\n");
            return 0;
        }
        strcpy(&tmpstr[index-str],index+(strlen(test[i])));
        strcpy(str,tmpstr);
    }
    
    printf("YES\n");
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
//#include <fstream>

using namespace std;

int main(int argc, const char * argv[]) {
//    ifstream in("input.txt");
//    cin.rdbuf(in.rdbuf());
    
    int N, A, B;
    cin >> N >> A >> B;
    
    cout << min(A*N, B) << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		// 入力
		int k = scn.nextInt();

		// 偶数の個数を取得
		int gusu = k / 2;
		// 奇数の個数を取得
		int kisu = k / 2;
		if (k % 2 != 0) {
			kisu++;
		}

		// 出力
		System.out.println(gusu * kisu);

		scn.close();
	}

}


Measured memory_bytes: 22612
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main(){
    int K;
    while(cin >> K){
        vector<int> dist(K+1, 1<<30);
        dist[K] = 0;
        priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> qu;
        qu.emplace(0, K);
        while(!qu.empty()){
            int pos = qu.top().second; qu.pop();
            for(int i=0;i<10;i++){
                if(pos == K && i == 0) continue;
                int npos = (10 * pos + i) % K;
                int ncost = dist[pos] + i;
                if(dist[npos] > ncost){
                    dist[npos] = ncost;
                    qu.emplace(ncost, npos);
                }
            }
        }
        cout << dist[0] << endl;
    }
}

Measured memory_bytes: 2804
class int(int):  
  def times(self, callback):
    for times in range(0,self):
      callback()

class list(list):
  def maps(self, callback):
    return list(map(callback, self))

  def each(self, callback):
    list(map(callback, self))
    return self

  # index will sent to the function as a second parameter.
  def each_with_index(self,callback):
    list(map(callback, self, range(0,len(self))))
    return self

# Make sure you initialize object with class name.
# Ex: int(10).times, array = list([1,2,3,4,5])

target, length = input().split()
target = int(target)
length = int(length)
nums = list(input().split())

def convert(arg):
    return int(arg)
nums = nums.maps(convert)

for i in range(0,101):
  # Xの両隣がpに存在しないかみていく（pに存在しない値をみつけたいので）
  a = target - i # まずは左隣をみていく(Xよりi小さい)
  if a not in nums:
    print(a)
    exit()

  b = target + i # 次に右隣をみていく(Xより大きい)
  if b not in nums:
    print(b)
    exit()
  
# 配列pが与えられなかったとき(長さが0のとき)でも、「Xより0小さい値がpに存在しない」ので、そのままXが返せる







Measured memory_bytes: 9176
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] nStr = Integer.toString(n).split("");

        int sum = 0;
        for (int i = 0; i < nStr.length; i++) {
            sum += Integer.valueOf(nStr[i]);
        }

        boolean ans = false;
        if (n % sum == 0) ans = true;

        if (ans) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <bitset>
#include <algorithm>

using namespace std;

int main(){
    int n; cin >> n;
    bitset<8> s;
    int num_free=0;
    for(int i=0; i<n; ++i){
        int a; cin >> a;
        int c=a/400;
        if(c>=8) ++num_free;
        else s.set(c);
    }
    int ans_min=max((int)s.count(), 1);
    int ans_max=(int)s.count()+num_free;
    cout << ans_min << " " << ans_max << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MOD=998244353,MAX_N=1<<20|5;
inline void mo(int& x){ x>=MOD?x-=MOD:0; }
inline int mo1(int x){ return x>=MOD?x-MOD:x; }
inline int mo2(int x){ return x<0?x+MOD:x; }
inline int fpow(int x,int n,int ret=1){
	for(;n;n>>=1,x=1ll*x*x%MOD)
		n&1?ret=1ll*ret*x%MOD:0;
	return ret;
}
int fac[MAX_N],inv[MAX_N],fac_inv[MAX_N];
void init(int n){
	fac[0]=fac_inv[0]=inv[1]=1;
	for(int i=1;i<=n;++i){
		fac[i]=1ll*fac[i-1]*i%MOD;
		if(i>1) inv[i]=1ll*(MOD-MOD/i)*inv[MOD%i]%MOD;
		fac_inv[i]=1ll*fac_inv[i-1]*inv[i]%MOD;
	}
}
void get_k_pow(int a[],int b[],int n,int k){
	b[0]=fpow(a[0],k);
	int inv_0=fpow(a[0],MOD-2);
	for(int i=0;i<n;++i)
		b[i+1]=mo2(1ll*a[1]*b[i]%MOD*(k+MOD-i)%MOD
			*inv[i+1]%MOD*inv_0%MOD);
}
int a[MAX_N],b[MAX_N];
int main(){
	int n,m; scanf("%d%d",&n,&m);
	init(n+1);
	a[0]=n+1; a[1]=MOD-1;
	get_k_pow(a,b,n,m);
//	for(int i=0;i<=n;++i) printf("[%d]",b[i]); puts("");
	for(int i=0,pw=1;i<=n;++i,pw=1ll*pw*(m+1)%MOD) 
		a[i]=1ll*pw*fac_inv[i]%MOD;
	int ret=0;
	for(int i=0;i<=n;++i)
		ret=(ret+1ll*a[i]*b[n-i])%MOD;
	ret=1ll*ret*fac[n]%MOD;
	printf("%d\n",ret);
	return 0;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a,b,h;
    cin>>a>>b>>h;
    cout<<0.5*(a+b)*h<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)
ll INF = 1LL << 60;

void solve(long long A, long long B){
    if(A <= 8 && B <= 8)
        cout << "Yay!" << endl;
    else 
        cout << ":(" << endl;
}

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


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

using namespace std;

int a[105];
int N;

int calc(int b){
    int ret=0;
    for(int i=1;i<=N;i++) ret+=(a[i]-b)*(a[i]-b);

    return ret;
}


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

    int sum=0;
    for(int i=1;i<=N;i++) scanf("%d",a+i),sum+=a[i];

    printf("%d\n",min(calc(sum/N),calc((sum+N)/N)));

    return 0;
}

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

using namespace std;

int main(){
	long long int N;
	cin >> N;
	auto A = vector<vector<long long int>>(N, vector < long long int >(N));
	for(size_t i = 0; i < N; i++){
		for(size_t j = 0; j < N; j++){
			cin >> A[i][j];
		}
	}

	for(size_t k = 0; k < N; k++){
		for(size_t i = 0; i < N; i++){
			for(size_t j = 0; j < N; j++){
				if(A[i][k] + A[k][j] < A[i][j]){
					cout << -1 << endl;
					return 0;
				}
			}
		}
	}

	priority_queue<pair<long long int, long long int>, vector<pair<long long int, long long int>>, greater<pair<long long int, long long int>>>que;
	set < long long int >S;
	S.insert(0);
	for(size_t i = 1; i < N; i++){
		que.push(make_pair(A[0][i], i));
	}
	long long int ans = 0;
	for(size_t i = 0; i < N; i++){
		for(size_t j = 0; j < N; j++){
			bool f = true;
			for(size_t k = 0; k < N; k++){
				if(i != k&&j != k)
					if(A[i][j] == A[i][k] + A[k][j]){
						f = false;
					}
			}
			if(f){
				ans += A[i][j];
			}
		}
	}
	cout << ans / 2 << endl;
}



Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <iomanip>

using namespace std;

int main(){
	int n;
	int arr[105][105];
	cin >> n;
	int cnt = 0;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < 2; j++){
			cin >> arr[i][j];	
		}
	}
	for(int i = 0; i < n; i++){
		if(arr[i][0] == arr[i][1]){
			cnt++;
		}
		else{
			cnt = 0;
		}
		if(cnt == 3){
			break;
		}
	}
	//cout << cnt << endl;
	if(cnt >= 3){
		cout << "Yes\n";
	}
	else{
		cout << "No\n";
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=min((a), (b))

const int MOD=1000000007;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k, x;
	cin>>n>>k;
	int ans=0;
	REP(i, n){
		cin>>x;
		ans+=2*min(x, k-x);
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <numeric>
#include <deque>
using namespace std;
typedef long long int ll;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    int a[n+1][m+1]={};
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin >> a[i][j]; 
            a[i][m]+=a[i][j];
            a[n][j]+=a[i][j];
            a[n][m]+=a[i][j];
        }
    }
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            cout << a[i][j] << (j<m?" ":"");
        }
        cout << endl;
    }
}


Measured memory_bytes: 3208
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
ll X;
  ll Y;
  cin >>X>>Y;
  ll count=1;
  while(X*2<=Y) {
    X=X*2;
    count++;
  }
  cout<<count<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct nmd{
	long long w,s,v;
}a[1010];
long long dp[20000010],g;
int n;
bool cmp(nmd a,nmd b){
	return (a.w+a.s)<(b.w+b.s);
}
int main(){
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a[i].w>>a[i].s>>a[i].v;
	}
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;++i){
		for(int j=a[i].s;j>=0;--j){
			dp[j+a[i].w]=max(dp[j+a[i].w],dp[j]+a[i].v);
			//g=max(dp[j],g);
		}
	}
	for(int i=0;i<=20000010;++i){
		g=max(g,dp[i]);
	}
	cout<<g<<endl;
	return 0;
}


Measured memory_bytes: 384
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

n = I()
W = SR(n)
used = set()
last = W[0][0]
for w in W:
    if last != w[0] or w in used:
        print("No")
        exit()
    last = w[-1]
    used.add(w)
print("Yes")

Measured memory_bytes: 63724
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	_, _ = fmt.Scan(&n)
	students := make([]int, n)
	stu := make(map[int]int, n)
	
	for i := 0; i < n; i++ {
		var s int
		_, _ = fmt.Scan(&s)
		students[i] = s
		stu[s] = i
	}
	
	sort.Ints(students)
	
	for _, s := range students {
		fmt.Print(stu[s]+1, " ")
	}
}


Measured memory_bytes: 7424
using System;

class Program
{
    static void Main(string[] args)
    {
        var hw = Console.ReadLine().Split();
        var h = int.Parse(hw[0]);
        var w = int.Parse(hw[1]);

        var c = new string[h];
        for (int i = 0; i < h; i++)
        {
            c[i] = Console.ReadLine();
        }

        for (int i = 0; i < h; i++)
        {
            Console.WriteLine(c[i]);
            Console.WriteLine(c[i]);
        }
    }
}


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

int main()
{
    int n, m, flag[100001] = {0}, cor = 0, pen = 0, tmp[100001] = {0};
    cin >> n >> m;
    rep(i, m)
    {
        int p;
        string s;
        cin >> p >> s;
        if (flag[p] == 0)
        {
            if (s.compare("WA") == 0)
                tmp[p]++;

            else
            {
                flag[p] = 1;
                pen += tmp[p];
                cor++;
            }
        }
    }
    cout << cor << " " << pen << endl;
    return 0;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)

using LL  = long long;
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int a, b;cin >> a >> b;
    if(a == 1) a = 14;
    if(b == 1) b = 14;
    string ans = "";
    if(a > b) ans = "Alice";
    if(a == b) ans = "Draw";
    if(a < b) ans = "Bob";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int N,M;
  int P=0;
  int count=0;
  cin>>N>>M;
  vector<int> vec(N);
  rep(i,N){
    int A;
    cin>>A;
    P=P+A;
    vec.at(i)=A;
  }
  rep(i,N){
    int A;
    A=vec.at(i);
    if(4*M*A>=P){
      count++;
    }
  }
  if(count>=M){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
import sys

a,b,c = map(int,input().split())

val = [a,b,c]

for i in val:
    if 1 >= i and i <= 100:
        print('No')
        sys.exit()

if val[0] == val[1] and val[1] == val[2]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060