akhauriyash/Code-Regression huggingface dataset:
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 1e5 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}

ll dp[Max+2];

ll ara[Max],n;

ll call(ll val)
{
    //cout<<i<<" "<<val<<endl;

     ll &ret=dp[val];


       if(ret!=-1)
        return ret;

       if(val==0)return dp[val]=0;

       ret=0;

          for(ll i=0; i<n && !ret; i++)
          {
              if(ara[i]<=val)
                ret=!call(val-ara[i]);
          }

          return ret;


}


int main()
{

   fastread();

   ll i,j,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r;


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

      cin>>n>>m;

      input(ara,n);



        if(call(m))
            cout<<"First"<<endl;

        else cout<<"Second"<<endl;





}




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

char mp[100][100];
int n,m;

void dfs(int h,int w,char flt){
  // cout << flt << endl;
  mp[h][w]=0;
  if(h+1<n && mp[h+1][w]==flt)dfs(h+1,w,flt);
  if(w+1<m && mp[h][w+1]==flt)dfs(h,w+1,flt);
  if(h-1>=0 && mp[h-1][w]==flt)dfs(h-1,w,flt);
  if(w-1>=0 && mp[h][w-1]==flt)dfs(h,w-1,flt);
  return;
}
  
int main(){
  while(cin >> n >> m,n){
    for(int i=0; i<n; ++i){
      for(int j=0; j<m; ++j){
        cin >> mp[i][j];
      }
    }
    int ans=0;
    for(int i=0; i<n; ++i){
      for(int j=0; j<m; ++j){
        if(mp[i][j]!=0){
          dfs(i,j,mp[i][j]);
          ++ans;
        }
      }
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 3464
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <iostream>
#include <vector>
#include <bitset>
#include <queue>
#include <map>
#include <utility>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define MOD 1000000007           //10億　= 10^9になってる
#define juu 100000               //10万 10e5
#define hyaku 1000000            //100万　10e6
#define mINF -922337200085470000 //llのmax-1桁の小さい方
#define pINF 922337203600070000  //llのmax-1桁のデカい方
#define uINF 1844674407300000000 //ullのmax-1桁してる
#define pi 3.1415926535897932384
#define all(v) v.begin(), v.end()
ll factor[300];
ll memory[300];
/*素朴法で計算
factorは必ずmemset(factor,0,sizeof(factor));
グローバルであるmemoryに個数を書き込む
memory配列の走査にはfactorの要素を使う*/
void primefac(ll num)
{
    int i = 0, kosuu = 0;
    while (*(factor + i) != 0)
    {
        while (num % *(factor + i) == 0)
        {
            num /= *(factor + i);
            memory[*(factor + i)] += 1;
        }
        if (num == 1)
            break;
        i++;
    }
}
/*グローバルにあるfactorに素数書き込む.個数を返すので配列は-1しろforは<*/
int elast(ll number)
{
    ll tmp = 0;
    int flag = 0;
    *factor = 2;
    for (int i = 3; i <= number; i++)
    {
        flag = 0;
        for (int j = 0; j <= tmp; j++)
        {
            if (i % (*(factor + j)) == 0)
            {
                flag = 1;
                break;
            }
        }
        if (flag)
            continue;
        tmp += 1;
        *(factor + tmp) = i;
    }
    return tmp + 2;
}

/*intで収まる範囲であってくれ*/
ll nCr(ll n, ll r)
{
    ll val = 1;
    ll i;
    if (r == 0)
        return 1;
    for (i = 0; i < n - r; i++)
    {
        val *= (n - i);
        val /= (i + 1);
    }
    return val;
}
/*intで収まる範囲であってくれ*/
ll nPr(ll n, ll r)
{
    ll val = 1;
    ll i;
    for (i = 0; i < r; i++)
    {
        val *= (n - i);
    }
    return val;
}
template <typename T>
bool chmin(T &a, const T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <typename T>
bool chmax(T &a, const T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

/*ソートして被りを無くす*/
template <typename T>
void eraseSame(T &a)
{
    sort(all(a));
    a.erase(unique(all(a)), a.end());
}

/*aとbで大きい方を後ろにする。変更なしならtrue、ありならfalse */
template <typename T>
bool swapmax(T &a, T &b)
{
    T temp;
    temp = a;
    if (a > b)
    {
        a = b;
        b = temp;
        return false;
    }
    return true;
}
ll gcd(ll x, ll y) { return (x % y) ? gcd(y, x % y) : y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

/*一行に入力が何個あるかを1,ぶち込むvectorを2*/
template <typename T>
void splitIn(ll N, vector<T> &array)
{
    T temp;
    int i = 0;
    while (cin >> temp)
    {
        array[temp-1]+=1;
        i++;
        if (i >= N)
        {
            break;
        }
    }
    return;
}
int main()
{
    ll n,k,q;
    ll ans =0;
    cin >> n >> k >> q;
    vector <ll> v(n,k-q);
    splitIn(q,v);
    
    for(auto &o:v){
    	if(o > 0){
    		cout << "Yes" << endl;
    		}
    	else{
    		cout << "No" << endl;
    		}
    	}
    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

int main(int argc, char *argv[]) {

	//int D = 365;
	int D; cin >> D;

	vector<int> c(26,0);
	vector<vector<int>> s(D,vector<int>(26,0));
	vector<int> t(D,0);

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

	for (int i = 0; i < D; i++) {
		for (int j = 0; j < 26; j++) {
			cin >> s[i][j];	
		}
	}

	vector<int> MAX(D,0);
	for (int i = 0; i < D; i++) {
		int ans =0;
		int idx = 0;
		for (int j = 0; j < 26; j++) {
			if (MAX[i] < s[i][j]) {
				MAX[i] = s[i][j];	
				t[i] = j+1;	
			}
		}
	}

	int ANSER = 0;
	vector<int> last(26,0);
	for (int i = 0; i < D; i++) {
		ANSER += s[i][t[i]-1];	
		last[t[i]-1] = i+1;
		for (int j = 0; j < 26; j++) {
			ANSER -	c[j] * ((i+1) - last[j]) ;
		}
	}

	int cnt = 10;
	while(cnt > 0) {
		int d = (rand() % 365);
		int q = (rand() % 26) + 1;
		int old = t[d];
		t[d] = q;
		int ans = 0;
		for (int i = 0; i < D; i++) {
			ans += s[i][t[i]-1];	
			last[t[i]-1] = i+1;
			for (int j = 0; j < 26; j++) {
				ans -=	c[j] * ((i+1) - last[j]) ;
			}
		}
		if (ans < ANSER) {
			t[d] = old;	
		}else {
			ANSER = ans;
		}
		cnt--;
	}

	for (int i = 0; i < D; i++) {
		cout << t[i] << endl;
	}



	return 0;
}


Measured memory_bytes: 3676
const p = (...args) => {
  process.env.NODE_ENV === "test" ? console.log(...args) : ""
}

const solve = (input) => {
  const [a, b, c] = input.split(" ").map(Number)

  return a == b && b == c ? "Yes" : "No"
}

if (process.env.NODE_ENV === "test") {
  module.exports = (input) => solve(input.trim())
} else {
  const input = require("fs").readFileSync("/dev/stdin", "utf8")
  console.log(solve(input.trim()))
}


Measured memory_bytes: 7372
main = do
    fst <- getLine
    snd <- getLine
    let h = head $ intList fst
    let w = head $ reverse $ intList fst
    let a = head $ intList snd
    let b = head $ reverse $ intList snd
    let y = show $ ans h w a b
    putStrLn y

intList :: [Char] -> [Int]
intList xs = map read (words xs) 

ans :: Int -> Int -> Int -> Int -> Int
ans h w a b = (h - a) * (w - b)


Measured memory_bytes: 508
// include
// ----------------------------------------------------------------------------
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>

// repetition
// ----------------------------------------------------------------------------
#define FOR(i, a, b) for (i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

// memory clear
// ----------------------------------------------------------------------------
#define CLRNUM(a) memset((a), 0, sizeof(a))
#define CLRBOOL(a, flag) memset((a), flag, sizeof(a))
#define CLRCHAR(a) memset((a), '\0', sizeof(a))

// debug
// ----------------------------------------------------------------------------
#define DEBUGNUM(x) printf("%d\n", x);
#define DEBUGCHAR(x) printf("%c\n", x);
#define DEBUGSTR(x) printf("%s\n", x);
#define DEBUGFORNUM(i, a, b, x) FOR(i, a, b){ printf("%d ", x[i]); }
#define DEBUGFORCHAR(i, a, b, x) FOR(i, a, b){ printf("%c ", x[i]); }
#define DEBUGREPNUM(i, n, x) REP(i, n){ printf("%d ", x[i]); }
#define DEBUGREPCHAR(i, n, x) REP(i, n){ printf("%c ", x[i]); }

// other
// ----------------------------------------------------------------------------
#define PUTNL printf("\n")

// constant
// ----------------------------------------------------------------------------
#define INF 1000000000

int main(void)
{
    int sum, ave;
    int val, num;
    int count;

    sum = 0;
    ave = 0;
    count = 0;
    
    while (scanf("%d, %d", &val, &num) != EOF){
        sum += val * num;
        ave += num;
        count++;
    }

    if ((((double)ave / count) - (ave / count)) * 10 > 4){
        ave = ave / count + 1;
    }
    else {
        ave /= count;
    }
    
    printf("%d\n%d\n", sum, ave);

    return 0;
        
}

Measured memory_bytes: 0
N, M = gets.split(' ').map(&:to_i)

foods = Array.new(M + 1, 0)
N.times do
  a = gets.split(' ').map(&:to_i)
  1.upto(a[0]) do |i|
    foods[a[i]] += 1
  end
end

puts foods.count(N)

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define pq priority_queue
using namespace std;
constexpr long long gcd(long long a, long long b){return b ? gcd(b, a % b) : a;}
constexpr long long lcm(long long a, long long b){return a / gcd(a, b) * b;}
constexpr int INF = 1e9, MOD = INF + 7, around[] = {0, 1, 1, -1, -1, 0, -1, 1, 0, 0};
constexpr int mod_pow(long long x, long long n, const int mod){long long ret=1;while(n){if(n&1)(ret*=x)%=mod;(x*=x)%=mod;n>>=1;}return ret;}
template<int n> struct Prime{bool arr[n+1];constexpr bool operator[](int k){return arr[k];}constexpr Prime():arr(){for(int i=2;i<n;i++){arr[i]=true;for(int j=2;j*j<=i;j++){if(!(i%j))arr[i]=false;}}}};
template<int n> struct Factorial{long long arr[n+1],ary[n+1];constexpr Factorial():arr(),ary(){arr[0]=1;ary[0]=1;for(int i=0;i<n;i++){arr[i+1]=arr[i]*(i+1)%MOD;ary[i+1]=mod_pow(arr[i+1],MOD-2,MOD);}}};
constexpr Factorial<1010> fact; constexpr Prime<10> prime;
constexpr long long comb(int a, int b){if(a < b) return 0LL;if(!a or !b) return 1LL; long long pos = fact.arr[a], pot = fact.ary[a - b], por = fact.ary[b]; return pos * pot % MOD * por % MOD;}
template<int n> struct Bernoulli{long long arr[n+1];constexpr Bernoulli():arr(){arr[0]=1;for(int i=1;i<=n;i++){long long sum=0;for(int j=0;j<i;j++){(sum+=comb(i+1,j)*arr[j]%MOD)%=MOD;}arr[i]=(MOD-mod_pow(i+1,MOD-2,MOD))%MOD*sum%MOD;}}};
constexpr int vx[] = {1, 0, -1, 0}, vy[] = {0, 1, 0, -1};
constexpr long double PI = abs(acos(-1));
constexpr int sqrtN = 512, logN = 32;
constexpr long long LINF=1e18;

int main(){
	int n, m, x; cin >> n >> m >> x; int li[110] = {};
	for(int i = 0; i < m; i++){
		int a; cin >> a;
		li[a]++;
	}
	
	int A = 0;
	for(int i = x; i > 0; i--){
		A += li[i];
	}
	
	int B = 0;
	for(int i = x; i < n; i++){
		B += li[i];
	}
	
	cout << min(A, B) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>

using namespace std;
void print(int K){
   while(K!=0){
      cout <<K%2;
      K/=2;
   }
   cout << endl;
}

int main(){
   int N,K;
   cin >> N >> K;
   vector<pair<int,int> > Num;
   long long ans = 0;
   for( int i = 0 ; i< N; i++ ){
      int A,B; cin >> A >> B;
      Num.push_back(make_pair(A,B));
      if( A == 0 ) ans += B;
   }
   int bit = 0;
   while( K > 0 ){
      long long tmp = 0;
      for( int i = 0 ; i < N; i++ ){
         int C=Num[i].first;
         if( (C&K) == C) tmp += Num[i].second;
      }
      ans = max(ans,tmp);
      K-=bit;
      bit = K-(K&(K-1))-1;
      K-=1;
   }
   cout << ans << endl;
   
   return 0;
}


Measured memory_bytes: 1400
#include <iostream>
using namespace std;
#include <functional>
#include <vector>
template<class T> struct SegTree {
  private:
    int size;
    vector<T> v;
    using F = function<T(T,T)>;
    F f; T default_value;
  public:
    SegTree(int n, T default_value, F f) : default_value(default_value), f(f) {
      size = 1;
      while (size < n) size *= 2;
      v.resize(2 * size - 1, default_value);
    }
    void update(int index, T val) {
      index = index + size - 1;
      v[index] = val;
      while (index > 0) {
        index = (index - 1) / 2;
        v[index] = f(v[2 * index + 1], v[2 * index + 2]);
      }
    }
    T query(int l, int r) { return query(l, r, 0, size, 0); }
    T query(int l, int r, int cur_l, int cur_r, int index) {
      // [l, r)に対するクエリ
      if (cur_r <= l || r <= cur_l) return default_value;
      if (l <= cur_l && cur_r <= r) return v[index];

      int mid = (cur_l + cur_r) / 2;
      return f(query(l, r, cur_l, mid, 2 * index + 1), query(l, r, mid, cur_r, 2 * index + 2));
    }
};

#define in(v) v; cin >> v;
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)

int main() {
  int in(N); int in(Q);

  SegTree<int> T(N,
  2147483647,
  [](int a, int b){return min(a, b);});
  rep(i, Q) {
    int in(com);
    if (com == 0) {
      int in(idx); int in(x);
      T.update(idx, x);
    } else {
      int in(s); int in(t);
      ++t;
      cout << T.query(s, t) << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 3872
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val (t, x, y) = Triple(0, 0, 0)
    for (i in (1..n)) {
        val (tt, xx, yy) = readLine()!!.split(" ").map{ it.toInt() }
        val dt = tt - t
        val dx = Math.abs(x-xx)
        val dy = Math.abs(y-yy)
        if ((dx + dy > dt) || ((dx+dy-dt)%2!=0)) {
            println("No")
            return
        }
    }
    println("Yes")
    return
}

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

#define REP(i, a, b) for (int i = (a); i <= (b); ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define FORV(a, A) for (auto &a : A)

using namespace std;

using ll = long long;

void Main()
{
   int K, X;
   cin >> K >> X;
   REP(a, X - K + 1, X + K - 1)
   {
      cout << a << " ";
   }
   cout << endl;
   return;
}

int main()
{
   std::cin.tie(nullptr);
   std::ios_base::sync_with_stdio(false);
   std::cout << std::fixed << std::setprecision(15);
   Main();
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <string.h>
#include <algorithm>

using namespace std;

int main(int argc, char const* argv[])
{
    int n,m;
    while (cin >> n >> m) 
    {
        //終端判断
        if (n == 0 && m==0){break;}
        //入力
        int arr[n][m];
        for (int i = 0; i < n; i++) 
        {
            for (int j = 0; j < m; j++) 
            {
                cin >> arr[i][j];
            }
        }

        vector<int> order(m);
        vector<int> count(m);
        //初期化
        for (int t = 0; t < m; t++) 
        {
            count[t]=0;
            order[t] = t;
        }
        for (int j = 0; j < m; j++) 
        {
            for (int i = 0; i < n; i++) 
            {
                count[j] += arr[i][j];
            }
        }
        //
        //
        //for (int t = 0; t < m; t++) 
        //{
        //    cout << count[t] << " ";
        //}
        //cout << endl;
        //for (int i = 0; i < m-1; i++) 
        //{
        //    for (int j = i+1; j < m; j++) 
        //    {
        //        if (count[i] < count[j]) 
        //        {
        //            swap(order[i], order[j]);
        //        }
        //    }
        //}

        //sort
        for (int i = 0; i < m; i++) 
        {
            for (int j = m-1; i < j; j--) 
            {
                //cout << "order " << endl; 
                //for (int t = 0; t < m; t++) 
                //{
                //    cout << order[t];
                //}
                //cout << endl;
                //cout << "count " << endl;
                //for (int t = 0; t < m; t++) 
                //{
                //    cout << count[order[t]] << " ";
                //}
                //    cout << endl;
                if (count[order[j-1]] < count[order[j] ]) 
                {
                    //puts("swap");
                    //cout << j-1<< " " << j << endl;
                    swap(order[j-1], order[j]);
                }
            }
        }

        for (int t = 0; t < m-1; t++) 
        {
            cout << order[t] + 1 << " " ;
        }
        cout << order[m-1] + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 1584
import java.util.Scanner;

public class Main {
    static void findNumberOfDigits(long n, int base) {

        int dig = (int)(Math.floor(
                Math.log(n) / Math.log(base))
                + 1);
        System.out.println(dig);
    }

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int base = sc.nextInt();


        findNumberOfDigits(n, base);

    }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
vector <int> v[100005];
int r[100005];
int u(int poz)
{
	if(r[poz] != 0)
	{
		return r[poz];
	}
	if(v[poz].empty())
	{
		return r[poz] = 1;
	}
	int m = 0;
	for(int i = 0; i < v[poz].size(); i++)
	{
		m = max(m, 1+u(v[poz][i]));
	}
	return r[poz] = m;
}
int main()
{
    int b, q;
    cin >> b >> q;
    int p, k;
    for(int i = 0; i < q; i++)
    {
    	cin >> p >> k;
    	p--;
    	k--;
    	v[p].push_back(k);
	}
	int maxr = 0;
	for(int i = 0; i < b; i++)
	{
		maxr = max(maxr, u(i));
	}
	cout << maxr-1 << endl;
}



Measured memory_bytes: 8192
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define int ll
#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

void solve() {
    int n;
    cin>>n;
    vector<int> v1, v2;
    f(i, n) {
        int x, y;
        cin>>x>>y;
        v1.pb(x - y);
        v2.pb(x + y);
    }
    s(v1); s(v2);
    cout<<max({v1[n - 1] - v1[0], v2[n - 1] - v2[0]});
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int t = 1;
    //cin>>t;
    for(int test = 1; test <= t; test++) {
        //cout<<"Case #"<<test<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 6644
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    N = int(input())
    A = list(map(int, input().split()))

    m, m_idx = abs(A[0]), 0
    for i, a in enumerate(A):
        if abs(a) > m:
            m = abs(a)
            m_idx = i

    ans = []
    for i in range(N):
        A[i] += A[m_idx]
        ans.append((m_idx + 1, i + 1))

    if A[m_idx] >= 0:
        for i in range(N - 1):
            ans.append((i + 1, i + 2))
    else:
        for i in range(N - 1, 0, -1):
            ans.append((i + 1, i - 1 + 1))

    print(len(ans))
    for x in ans:
        print(*x)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4080
#include <iostream>

using namespace std;

#define MAX_N 101

int n, t, h, l;

int next(int c) {
   c++;
   if (c >= n) c-=n;
   return c;
}

int main() {
    cin >> n >> t >> h >> l;
    int ts[n];
    int hs[n];
    for (int i = 0; i < n; i++) cin >> ts[i] >> hs[i];

    int cur = 0;
    int winner = 1<<28;
    int buf = 0;
    while (true) {
        //cout << cur << ' ' << ts[cur] << ' ' << hs[cur] << endl;
        if (ts[cur] == 0 && hs[cur] == 0) {
            winner = cur + 1;
            break;
        }
        if (ts[cur] == 0) {
            hs[cur]--;
            buf += 10;
            if (t < buf/10) {
                winner = cur + 1;
                break;
            } else {
                ts[cur] += buf/10;
                t -= buf/10;
                buf = 0;
                cur = next(cur);
            }
        } else {
            ts[cur]--; t++; buf += 10;
            if (t > l) {
                winner = cur + 1;
                break;
            } else if (buf == 90) {
                buf = 0;
                cur = next(cur);
            } else {
                cur = next(cur);
            }
        }
    }
    cout << winner << endl;
    return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    int n;
    cin>>n;
    vector<int> L(n);
    rep(i,n) cin>>L[i];

    sort(all(L));

    ll ans=0;
    rep(i,n){
        for(int j=i+1;j<n;j++){
            int a=L[i];
            int b=L[j];
            int r=lower_bound(all(L),a+b)-L.begin();
            r--;
            int l=upper_bound(all(L),abs(a-b))-L.begin();
            ans+=r-l+1;
            //cout<<a<<" "<<b<<" "<<l<<" "<<r<<endl;
            if(l<=i && i<=r) ans--;
            if(l<=j && j<=r) ans--;
        }
    }

    cout<<ans/3<<endl;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

struct Mod {
    static constexpr auto kMod = 1000000007L;

    Mod() : n(0) {}
    // can be implicitly converted
    Mod(int64_t n) : n(n) {}

    Mod operator*(Mod m) const { return (n * (m.n % kMod)) % kMod; }

    Mod& operator*=(Mod m) {
        *this = *this * m;
        return *this;
    }

    Mod pow(int64_t p) {
        if (p == 0) {
            return 1;
        }
        if (p == 1) {
            return n;
        }

        int64_t r = this->pow(p / 2).n;
        if (p % 2 == 0) {
            return r * r % kMod;
        } else {
            return (r * r % kMod) * n % kMod;
        }
    }

    Mod operator/(Mod m) const {
        if (n == 0) {
            return 0;
        }

        return *this * m.pow(kMod - 2);
    }

    Mod& operator/=(Mod m) {
        *this = *this / m;
        return *this;
    }

    Mod operator+(Mod m) const { return (n + m.n) % kMod; }

    Mod& operator+=(Mod m) {
        *this = *this + m;
        return *this;
    }

    Mod operator-(Mod m) const { return (kMod + n - m.n) % kMod; }

    Mod& operator-=(Mod m) {
        *this = *this - m;
        return *this;
    }

    int64_t n;
};

int main() {
    int64_t n;
    cin >> n;

    vector<int64_t> a(n);
    for (auto&& aa : a) {
        cin >> aa;
    }

    unordered_map<int64_t, int64_t> u;
    for (auto aa : a) {
        for (int64_t m = 2; m * m <= aa; ++m) {
            int64_t c = 0;
            while (aa % m == 0) {
                ++c;
                aa /= m;
            }
            if (c > 0) {
                u[m] = max(u[m], c);
            }
        }
        if (aa > 1) {
            u[aa] = max(u[aa], 1L);
        }
    }

    Mod lcm = 1;
    for (auto kv : u) {
        lcm *= Mod(kv.first).pow(kv.second);
    }

    Mod ans = 0;
    for (auto aa : a) {
        ans += lcm / aa;
    }

    cout << ans.n << endl;
}

Measured memory_bytes: 768
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
using namespace std;
int main(void)
{
    long long A, B, C, N;
    cin >> A >> B >> C >> N;
    long long ans;
    if (N % 2 == 0)
    {
        ans = A - B;
    }
    else
    {
        ans = B - A;
    }
    if (abs(ans) > (long long)1000000000000000000)
    {
        cout << "Unfair";
    }
    else
    {
        cout << ans;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<stdio.h>
#include<string.h>

int count = 1;
int int_sort(const void *a,const void *b){
    if(strcmp((char*)a,(char*)b)!=0){
    }
    return strcmp((char*)a,(char*)b);
}

int main() {
    int N;
    scanf("%d",&N);
    char S[N][11];

    for (int i = 0; i < N; ++i){
        scanf("%s",S[i]);
    }
    qsort(S, sizeof(S)/sizeof(S[0]), sizeof(S[0]),int_sort);

        for (int i = 1; i < N; i++) {
            if (strcmp(S[i - 1], S[i]) == 0) {

            } else {
                count++;
            }
    }

    printf("%d",count);




}


Measured memory_bytes: 7572
package main

import "fmt"

func main() {
  var operand1, operand2 int
  var operator string
  for {
    n, err := fmt.Scanf("%d %s %d", &operand1, &operator, &operand2)
    if n == 0 && err != nil {
      break
    }
    var answer int
    if operator == "+" {
      answer = operand1 + operand2
    } else {
      answer = operand1 - operand2
    }
    fmt.Printf("%d\n", answer)
  }
}



Measured memory_bytes: 512
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(a<b&&b<c) {
			System.out.println("Yes"); 
		} else {
			System.out.println("No"); 
		}
	}
}	

Measured memory_bytes: 26144
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n);(i)>=0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;
  int main(){
    lint N;
     cin>>N;
    lint A[N];
    vector<lint> H; 
    H.resize(100010);
    rep(i,N){
      lint g;
      cin>>g;
      H[g+1]++;
      H[g]++;
      if(g!=0)H[g-1]++;
    }
  lint y=*max_element(H.begin(),H.end());
  cout<<y;
  }

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

int main(){
    ll q; cin >> q;
    while(q--){
        ll a, b; cin >> a >> b;
        ll k = (ll)sqrt(a*b);
        if(k*k == a*b) cout << 2*k-3+(a==b?1:0) << endl;
        else if(k*(k+1) < a*b) cout << 2*k-1 << endl;
        else cout << 2*k-2 << endl;
    }
}

Measured memory_bytes: 3676
n=int(input())
s=[0,0,0,0]
for i in range(n):
    si=input()
    if si=='AC':
        s[0]+=1
    elif si=='WA':
        s[1]+=1
    elif si=='TLE':
        s[2]+=1
    else:
        s[3]+=1
print(f'AC x {s[0]}')
print(f'WA x {s[1]}')
print(f'TLE x {s[2]}')
print(f'RE x {s[3]}')
    

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) ((v).begin(),(v).end())
#define COUT(x) cout<<(x)<<"\n"


int main(){
    int n;cin>> n;
    if(n>=100){
        n%=100;
        n%=10;
    }
    else if(n>=10)n%=10;
    if(n==2||n==4||n==5||n==7||n==9)COUT("hon");
    else if(n==0||n==1||n==6||n==8)COUT("pon");
    else COUT("bon");
    return 0;
}

Measured memory_bytes: 3644
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

X, Y, Z = ISI()
n = 0
length = Z
while length <= X:
    n += 1
    length += Y + Z
print(n-1)

Measured memory_bytes: 3064
"""
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, product, accumulate, groupby
from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)
# import numpy as np

inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]
ddn9 = ddn + [(0, 0)]
'''for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:'''
"""

from collections import deque, defaultdict
import sys
sys.setrecursionlimit(10 ** 7)


def wi(): return list(map(int, sys.stdin.readline().split()))
# WideIntPoint


def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def ws(): return sys.stdin.readline().split()


def si(): return int(sys.stdin.readline())  # SingleInt


def ss(): return input()


def hi(n): return [si() for _ in range(n)]


def hs(n): return [ss() for _ in range(n)]  # HeightString


def s_list(): return list(input())


def mi(n): return [wi() for _ in range(n)]  # MatrixInt


def mip(n): return [wip() for _ in range(n)]


def ms(n): return [ws() for _ in range(n)]


def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[
    0]] for _ in range(n)]  # NumberGrid


def grid(n): return [s_list() for _ in range(n)]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def round_up(a, b):
    """ a/b の切り上げ """
    c = (a + b - 1) / b
    return c


def lcm(a, b):
    """a,bの最小公倍数"""
    return a * b // gcd(a, b)


def floor(a, b):
    """floor(a/b) 整数値を返す"""
    c = (a - a % b)/b
    return int(c)


def main():
    K = int(input())
    S = input()
    if len(S) <= K:
        print(S)
    else:

        print(S[:K] + '...')


if __name__ == '__main__':
    main()


Measured memory_bytes: 65240
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cstring>
#define MOD 1000000007
using namespace std;

long long int n, a[1000000], b[1000000], art=0, cvp=0;

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i]>>b[i];
	for (int i = n-1; i >= 0; i--){
		if((a[i]+art)%b[i]==0)continue;
		cvp+= b[i]-((a[i]+art)%b[i]);
		art+= b[i]-((a[i]+art)%b[i]);
	}
	cout<<cvp;
	return 0;
}

Measured memory_bytes: 5120
#pragma GCC optimize("O3")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

#define mp make_pair
#define all(c) (c).begin() , (c).end()
#define sz(c) ((long long)((c).size()))
#define phb push_back
#define ppb pop_back
#define phf push_front
#define ppf pop_front

using namespace __gnu_pbds;
using namespace std;

#define int ll

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

template
<
    class key,
    class val=null_type,
    class comp=less<key>
>
using ord_set=tree
<
    key,
    val,
    comp,
    rb_tree_tag,
    tree_order_statistics_node_update
>;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    string s,t;
    cin>>s>>t;
    int cnt=0;
    for(int i=0;i<3;i++)
        cnt+=s[i]==t[i];
    cout<<cnt;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(void){

    int i,j;
    int N;
    int *A; 
    int min,flag; 
    long int ans=0;

    scanf("%d",&N);
    A=malloc(sizeof(int)*N);

    for(i=0;i<N;i++){
        scanf("%d ",&A[i]);
    }

    for(i=0;i<N-1;i++){
        if(A[i]<0){
            A[i]=-A[i];
            A[i+1]=-A[i+1];
        }
    }
    if(A[N-1]<0){
        min=A[0];
        flag=0;
        for(i=1;i<N-1;i++){
            if(A[i]<min){
                min=A[i];
                flag=i;
            }
        }
        if(min<-A[N-1]){
            A[flag]=-A[flag];
            A[N-1]=-A[N-1];
        }
    }

    for(i=0;i<N;i++){
        ans+=A[i];
    }
    printf("%lu",ans);
    return 0;
}


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

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		long lcm = 1L;
		for(int i = 0; i < n; i++){
		    lcm = lcm(lcm, sc.nextLong());
		}
		
		// 計算
		long result = lcm;
		
		
		// 出力
		System.out.println(result);
	}
	
	static long gcd(long x, long y){
		if(y == 0) return x;
		return gcd(y , x%y);
	}
	static long lcm(long x, long y){
		return (x/gcd(x, y))*y;
	}
}




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

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

    int H, W;
    cin >> H >> W;
    int h, w;
    cin >> h >> w;

    cout << (H - h) * (W - w) << '\n';

    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++)
typedef long long ll;
typedef pair<int, int> P;
int main() {
  int X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  vector<int> R(A), G(B), T(C);
  REP(i, A) cin >> R[i];
  REP(i, B) cin >> G[i];
  REP(i, C) cin >> T[i];
  sort(R.begin(), R.end(), greater<int>());
  sort(G.begin(), G.end(), greater<int>());
  REP(i, X) T.push_back(R[i]);
  REP(i, Y) T.push_back(G[i]);
  sort(T.begin(), T.end(), greater<int>());
  ll ans = 0;
  REP(i, X + Y) { ans += T[i]; }
  cout << ans << endl;
}

Measured memory_bytes: 5636
"use strict";

const main = input => {
    const array = input.trim().split('\n');
    const num = parseInt(array[0], 10);
    const color = array[1].split(' ');
    let change = 0;

    for(let i = 0; i< num - 1; i++){
        if(color[i] == color[i+1]){
            change++ ;
            i++ ;
        }
    }
    console.log(change);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define ENDL "\n"
#define PRINT(x) cout << (x) << ENDL

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
inline void out(int n) {printf("%d\n", n);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};


class Combination{
    public:
        Combination(long long N, long long MOD) : fact(N), inv(N), finv(N), N(N), MOD(MOD){
            init();
        }

        void init(){
            fact[0] = fact[1] = 1;
            finv[0] = finv[1] = 1;
            inv[1] = 1;
            for(long long i = 2; i < N; ++i){
                fact[i] = fact[i - 1] * i % MOD;
                inv[i] = MOD - inv[MOD % i] *  (MOD / i) % MOD;
                finv[i] = finv[i - 1] * inv[i] % MOD;
            }
        }

        long long com(long long n, long long r){
            if(n < r || n < 0 || r < 0) return 0;
            return fact[n] * (finv[r] * finv[n - r] % MOD) % MOD;
        }

    private:
        vector<long long> fact;
        vector<long long> inv;
        vector<long long> finv;
        const long long N;
        const long long MOD;
};

const ll MOD = (ll)1e9 + 7;
ll N, K;

signed main(){
    cin >> N >> K;
    Combination cm(N, MOD);
    FOR(i, 1, K + 1){
        if(N - K + 1 < i) PRINT("0");
        else if(K == 1) PRINT(N);
        else{
            PRINT(cm.com(N - K + 1, i) * cm.com(K - 1, i - 1) % MOD);
            //cerr << cm.com(N - K + 1, i) << " " << cm.com(K - 1, i - 1) << ENDL;
        }
    }
    return 0;
}

Measured memory_bytes: 256
from collections import deque
import heapq

s = input()
s += " "

S = ""

for i in range(len(s)-1):
    if s[i] == "B" and s[i+1] == "C":
        S += "Z"

    elif i > 0 and s[i] == "C" and s[i-1] == "B":
        continue
    else:
        S += s[i]

#print (S)
la = deque([])
ans = 0
for i in range(len(S)):

    if S[i] == "A":
        la.append(i)

    elif S[i] == "Z" and len(la) > 0:
        lastA = la.popleft()
        ans += i - lastA
        la.append(i)

    else:
        la = deque([])

print (ans)


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

int main(void)
{
    double a,b,h,m,w;
    cin >> a >> b >> h >> m;

    w=abs((h*60.0+m)*0.5-m*6.0);

    double c=sqrt(a*a+b*b-2.0*a*b*cos(w*M_PI/180.0));

    std::cout << std::fixed;
    cout<< std::setprecision(20) << c << endl;
    return 0;
}


Measured memory_bytes: 4228
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<ll> vi;
const int Nmaxx = 1e5+5;
vector<vii> g(Nmaxx);
vi ans(Nmaxx,-1);

void dfs(int u, int p, int skip)
{
	int c = 1;
	for(ii b : g[u])
	{
		if(b.first==p)
			continue;
		if(skip==c)
			c++;
		ans[b.second] = c;
		dfs(b.first, u, c);
		c++;
	}
}



int main()
{
	int n,k=0; cin>>n;
	for(int i =1 ; i <n ; i++)
	{
		int a,b; cin>>a>>b;
		g[a].push_back({b,i});
		g[b].push_back({a,i});
		k = max(k,(int)max(g[a].size(),g[b].size()));
	}

	cout<<k<<endl;
	dfs(1,0,0);

	for(int i = 1 ;i <n ;i++)
		cout<<ans[i]<<endl;
	


	return 0;
}

Measured memory_bytes: 9856
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	sc := newInputScanner(true, 1024)
	var d debuggable
	N, M, V, P := sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt()
	A := sort.IntSlice(make([]int, N))
	for i, _ := range A {
		A[i] = sc.nextInt()
	}
	A.Sort()
	d.debug(func() {
		fmt.Println(A)
	})
	var answer int = P
	// if index < border, then it would not become a candidate until promoted
	border := N - P
	// if border >= V {
	// 	var threshold = A[border]
	// 	d.debug(func() {
	// 		fmt.Println(border, threshold)
	// 	})
	// 	for i := border; i > 0; i-- {
	// 		if A[i-1]+M >= threshold {
	// 			answer++
	// 		}
	// 	}
	// } else {
	// 	sum := A[border]
	// 	target := M * (V - P + 1)
	// 	d.debug(func() {
	// 		fmt.Println(target)
	// 	})
	// 	for i := border; i > 0; i-- {
	// 		if i*M+(A[i-1]+M)*(border-i+1)-sum < target {
	// 			break
	// 		}
	// 		answer++
	// 		sum += A[i-1]
	// 	}
	// }
	sum := A[border]
	target := M * (V - P + 1)
	d.debug(func() {
		fmt.Println(target)
	})
	for i := border; i > 0; i-- {
		if A[i-1]+M < A[border] {
			break
		}
		if i*M+(A[i-1]+M)*(border-i+1)-sum < target {
			break
		}
		answer++
		sum += A[i-1]
	}
	fmt.Println(answer)
}

type inputScanner struct {
	*bufio.Scanner
}

func newInputScanner(enabledScanWords bool, sizeInKB int) *inputScanner {
	scanner := bufio.NewScanner(os.Stdin)
	if enabledScanWords {
		scanner.Split(bufio.ScanWords)
	}
	capacity := sizeInKB * 1024
	buf := make([]byte, capacity)
	scanner.Buffer(buf, capacity)
	return &inputScanner{
		Scanner: scanner,
	}
}

func (inputSc *inputScanner) nextInt() int {
	i, e := strconv.Atoi(inputSc.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (inputSc *inputScanner) nextUInt64() uint64 {
	i, e := strconv.ParseUint(inputSc.nextStr(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func (inputSc *inputScanner) nextStr() string {
	inputSc.Scan()
	return inputSc.Text()
}

type debuggable struct {
}

const (
	DEBUG_ON = false
)

func (d *debuggable) debug(f func()) {
	if DEBUG_ON {
		f()
	}
}


Measured memory_bytes: 3968
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = Integer.parseInt(sc.next());
        int n = Integer.parseInt(sc.next());
        long sum = 0;
        for (int i = 0; i < n; i++) {
            sum += Integer.parseInt(sc.next());
        }
        if (sum >= h) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 46816
// In God We Trust


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

# define INF 1 << 31 - 1
# define pb push_back
# define fi first
# define se second

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b + c >= 22)
    cout << "bust";
  else
    cout << "win";
}


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

int main()
{
	double a,b,c,d,e,f;
    double x,y;
	while(cin>>a>>b>>c>>d>>e>>f){
		x=(double)((e*c-b*f)/(a*e-b*d));
		y = (double)((-(d*c)+a*f) / (a*e-b*d));
  if(x == 0){x = 0;}
  if(y == 0){y = 0;}
  printf("%.3f %.3f\n",x,y);
}
	return 0;
}

Measured memory_bytes: 3124
N, L = map(int, input().split())

apple_taste = []
apple_taste_abs = []
for i in range(1, N + 1):
    apple_taste.append(L + i - 1)
    apple_taste_abs.append(abs(L + i - 1))

print(sum(apple_taste) - apple_taste[apple_taste_abs.index(min(apple_taste_abs))])





Measured memory_bytes: 2940
using System;
using System.Linq;
using System.Collections.Generic;

public class Program{
    public static void Main(){
        var s = Console.ReadLine();
        char first = s.First(), last = s.Last();
        var n = s.Skip(1).Take(s.Count()-2).Count();
        var ans = first.ToString()+n.ToString()+last.ToString();
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11220
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<list>
#include<cmath>
using namespace std;
#define int long long
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define P pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
int f(int num) {
	int cnt = 0;
	while (num >= 10) {
		cnt += num / 10;
		num /= 10;
	}
	return cnt;
}
int mypow(int a, int b) {
	if (b == 1)return a;
	int t = mypow(a, b / 2);
	if (b % 2 == 0)return t * t;
	return t * t*a;
}
int n;
int ans = 0;
signed main(){
	cin >> n;
	if (n % 2)cout << 0 << endl;
	else {
		int num = n/10;
		while (num) {
			ans += num;
			num /= 5;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
const Main = (input) => {
  const tmp = input.split(' ')
  var a = parseInt(tmp[0])
  var b = parseInt(tmp[1])
  var c = parseInt(tmp[2])
  if (((a === b) && (b !== c)) || ((b === c) && (c !== a)) || ((c === a) && (b !== c))) {
    console.log('Yes')
  } else {
    console.log('No')
  }
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 21064
//url:
//problem name: Brick Break

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    int N; cin >> N;
    veci A(N);
    REP(i,N) {
        cin >> A[i];
        A[i]--;
    }
    int ans = 0;
    REP(i,N-1) {
        if(A[i] != i) continue;
        else {
            int tmp = A[i];
            A[i] = A[i+1];
            A[i+1] = tmp;
            ans++;
        }
    }
    if(A[N-1] == N-1) ans++;
    cout << ans << endl;
}

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

int X[100];

int main(void) {
  int N;
  cin >> N;
  float P = 0.0;
  for (int i = 0; i < N; i++) {
    cin >> X[i];
    P += X[i];
  }
  P /= N;
  int P_int = floor(P + 0.5);
  int d = 0;
  for (int i = 0; i < N; i++){
    d += (P_int - X[i]) * (P_int - X[i]);
  }
  
  cout << d << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
const int INF = 1001001001;


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

    vector<int> X(N);
    int sum = 0;
    REP(i,N) {
        cin >> X[i];
        sum += X[i];
    }

    float P = 0.0;
    float alpha = 1;
    float P_af = 0.0;
    int sa = 0;
    
    while (1)
    {
        P_af -= alpha*(N*P - sum)/N;
        if(round(P) == round(P_af)) break;
        P = P_af;
    }


    int ans = 0;
    REP(i,N) {
        ans += pow((round(P) - X[i]), 2);
    }
    
    cout << ans << endl;

    return 0;
  
}


Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
int main(){
        int n,x;
        int i;
        int cnt;
        int min=0;
        int siyou=0;
        scanf("%d %d",&n,&x);
        int m[n];
        for(i=0;i<=n-1;i++){
                scanf("%d",&m[i]);
                siyou+=m[i];
                if(m[i]<m[min])min=i;
        }

        cnt=n;

        while(x-m[min]>=siyou){
                siyou+=m[min];
                cnt++;
        }
        printf("%d\n",cnt);

        return 0;
}

Measured memory_bytes: 888
def main(h: int, w: int, n: int):
    m = max(h, w)

    if n % m == 0:
        print(n // m)
    else:
        print((n // m) + 1)


if __name__ == "__main__":
    h = int(input())
    w = int(input())
    n = int(input())

    main(h, w, n)


Measured memory_bytes: 2940
# -*- coding: utf-8 -*-
import math

###
# main
if(__name__ == '__main__'):
    # input
    n = int(input())
    a = list(map(int, input().split(" ")))

    boss_num_list = [0 for _ in range(n)]

    for elem in a:
        boss_num_list[elem-1] += 1

    for ans in boss_num_list:
        print(ans)

# else:
    # do nothing


Measured memory_bytes: 33592
use std::error::Error;
use std::io;

pub fn main() {
    if let Err(_e) = run() {
        panic!("failed.");
    }
}

fn run() -> Result<(), Box<Error>> {
    let mut input = String::new();
    io::stdin().read_line(&mut input);
    let n = input.trim().parse::<i32>().unwrap();
    input.clear();

    let mod_v = n % 10;
    if mod_v == 2 || mod_v == 4 || mod_v == 5 || mod_v == 7 || mod_v == 9 {
        println!("hon");
    } else if mod_v == 0 || mod_v == 1 || mod_v == 6 || mod_v == 8 {
        println!("pon");
    } else {
        println!("bon");
    }
    Ok(())
}


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

int main() {
  int n;
  int j=0;	
  cin >> n;
  
  while (j < n) {
    string a;
    cin >> a;
    
    if (a == "Y"){
       cout << "Four" << endl;
      break;
    }
    else {
         if (j == n - 1){
       cout << "Three" << endl;
      break;
    }
    j++;
     }
  }
  
}


Measured memory_bytes: 256