akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
	ll n,a,b;
	ll x[100010];
	scanf("%lld%lld%lld",&n,&a,&b);
	rep(i,n)scanf("%lld",&x[i]);
	
	ll ret = 0;
	for(int i = 0 ; i+1 < n ; i ++){
		ret += min ( (x[i+1]-x[i])*a , b );
	}
	cout << ret << endl;
}



Measured memory_bytes: 1152
#include <bits/stdc++.h>
 
using namespace std;
#define int long long


 const int MAX = 1001;
const int MOD = 1000000007;



signed main(){
    int n;
    cin>>n;
    int a,k[3]={};
    for(int i=0;i<n;i++){
        cin>>a;
        if(a%2==1)k[0]++;
        else{
            if(a%4==2)k[1]++;
            else k[2]++;
        }
    }
    if(k[1]!=0){
    if(k[0]<=k[2])cout<<"Yes";
    else cout<<"No";
    }else{
        if(k[0]<=k[2]+1)cout<<"Yes";
    else cout<<"No";
    }

   return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int ma =line.indexOf(" ");
        int process = Integer.parseInt(line.substring(0, ma));
        int quantum = Integer.parseInt(line.substring(ma+1));
               
        ArrayList<String> lingerJob = new ArrayList<String>();
        ArrayList<Integer> lingerTime = new ArrayList<Integer>();
        
        for(int i=0;i<process;i++){
            String line2 = sc.nextLine();
            int ma2 =line2.indexOf(" ");
            lingerJob.add(line2.substring(0, ma2));
            lingerTime.add(Integer.parseInt(line2.substring(ma2+1)));      	
        }

        int save=-1;
        int timeCount=0;
        
        while(lingerJob.size()!=0){
        	for(int i=0;i<lingerJob.size();i++){
        		if(lingerTime.get(0)>quantum){
        			lingerTime.add(lingerTime.get(0)-quantum);
        			lingerTime.remove(0);
        			lingerJob.add(lingerJob.get(0));
        			lingerJob.remove(0);
        			timeCount=timeCount+quantum;
        		}else{
        			timeCount=timeCount+lingerTime.get(0);
        			System.out.println(lingerJob.get(0)+" "+timeCount);
        			lingerTime.remove(0);
        			lingerJob.remove(0);
        		}
        	}
        }
    }   
}

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

using namespace std;

#define X first
#define Y second
#define eps  1e-2
#define gcd __gcd
#define pb push_back
#define PI acos(-1.0)
#define lowbit(x) (x)&(-x)
#define bug printf("!!!!!\n");
#define mem(x,y) memset(x,y,sizeof(x))

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef unsigned long long uLL;

const int maxn = 2e5+7;
const LL  INF  = 1<<30;
const int mod  = 1e9+7;

struct node{
    int v,id;
}s[maxn];
bool cmp(node a ,node b){
    return a.v<b.v;
}
void solve()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>s[i].v;
        s[i].id=i;
    }
    sort(s+1,s+1+n,cmp);
    int ans=1,t=1;
    for(int i=2;i<=n;i++){
        if(s[i].id>s[i-1].id){
            t++;
        }else{
            t=1;
        }
        ans=max(ans,t);
    }
    cout<<n-ans<<endl;
    return ;
}

int main()
{
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);
//    ios::sync_with_stdio(false);
    int cas=1,t=1;
    //scanf("%d",&t);
    while(t--){
    //    printf("Case %d: ",cas++);
        solve();
    }
    return 0;
}


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  string str;
  IN(str);

  REP(i,str.size()){
    if(str[i]=='?'){
      str[i] = 'D';
    }
  }

  OUT(str);

  return 0;
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define int  long long int
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MAXN = 1e5+1;
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
 c_p_c();
 int n;
 cin >> n;
 set <string> st;
 for(int i=0;i<n;i++)
 {
  string s;
  cin >> s;
  st.insert(s);
 }
 cout<<st.size()<<endl;
 return 0;  
}


Measured memory_bytes: 19256
#include<stdio.h>
#include<string.h>
#define LEN 100005
int min(int a, int b){return a < b? a:b;}
typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;
void eneque(P);
P deque(void);

void enque(P x){
  Q[tail]=x;
  if(tail==LEN)tail=1;
  else tail++; 
}

P deque(){
  P X = Q[head];
  if(head==LEN)head=1;
  else head++;
  return X;
}


int main(){
  int elaps = 0;
  int i, q,k=0;
  P u;
  scanf("%d %d", &n, &q);
  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head =1;
  tail=n+1;
  while(head != tail){
    u = deque();
    k = min(q,u.t);
    u.t = u.t - k;
    elaps = elaps + k;
    if(u.t > 0 )enque(u);
    else{
      printf("%s %d\n",u.name,elaps);
    }
  }
  return 0;
}

Measured memory_bytes: 10756
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define pb push_back
#define fi first
#define se second
const int N=1e6+10;
const int mod7=1e9+7;
const int mod=998244353;
void read(int &a)
{
    a=0;int d=1;char ch;
    while(ch=getchar(),ch>'9'||ch<'0')
        if(ch=='-')
            d=-1;
    a=ch^48;
    while(ch=getchar(),ch>='0'&&ch<='9')
        a=(a<<3)+(a<<1)+(ch^48);
    a*=d;
}
void read(ll &a)
{
    a=0;int d=1;char ch;
    while(ch=getchar(),ch>'9'||ch<'0')
        if(ch=='-')
            d=-1;
    a=ch^48;
    while(ch=getchar(),ch>='0'&&ch<='9')
        a=(a<<3)+(a<<1)+(ch^48);
    a*=d;
}
int main()
{
    int a,b,c,d;read(a),read(b),read(c),read(d);
    int t1=c/b+(c%b==0?0:1),t2=a/d+(a%d==0?0:1);
    if(t1<=t2) puts("Yes");
    else puts("No");
    return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007

int dx[] = {1,0,0,-1};
int dy[] = {0,1,-1,0};
int h,w;
vector<vector<bool>> seen(500,vector<bool>(500,0));
vector<string> s(500);
pair<ll,ll> dfs(int y,int x){
  pair<ll,ll> res = make_pair((s[y][x] == '#'),(s[y][x] != '#'));
  seen[y][x] = true;
  rep(i,4){
    int ny = y+dy[i],nx = x+dx[i];
    if(ny < 0 || ny >= h || nx < 0 || nx >= w)continue;
    if(s[ny][nx] == s[y][x])continue;
    if(seen[ny][nx])continue;
    pair<ll,ll> k = dfs(ny,nx);
    res.first += k.first,res.second += k.second;
  }
  return res;
}

int main(){
  
  
  cin >> h >> w;
  rep(i,h)cin >> s[i];
  ll res = 0;
  rep(i,h)rep(j,w){
    if(s[i][j] != '#')continue;
    if(seen[i][j])continue;
    pair<ll,ll> k = dfs(i,j);
    res += k.first*k.second;
  }
  cout << res << endl;








  return 0;
}

Measured memory_bytes: 20480
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main() {
  int n,k;
  cin >> n>>k;
  int ans = 0;
  
  rep(i,n){
    int x;
    cin >>x;
    ans+=2*min(x,k-x);
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

void read();
template<typename First, typename... Rest> void read(First& first, Rest&... rest);
void write();
template<typename First, typename... Rest> void write(First first, Rest... rest);
template<typename T> void write_vec(vector<T>& v, char divider);

int main(){
    int N;
    read(N);
    vector<int> a(N + 1);
    for(int i = 1; i <= N; i++){
        read(a[i]);
    }
    map<int, int> mp;
    for(int i = N; i >= 1; i--){
        mp[i] = a[i];
        for(int j = 2 * i; j <= N; j += i){
            mp[i] += mp[j];
        }
        mp[i] %= 2;
    }
    vector<int> b;
    for(auto it = mp.begin(); it != mp.end(); it++){
        if(it->second) b.push_back(it->first);
    }
    write(b.size());
    write_vec(b, ' ');
    return 0;
}

//配列以外の入力を受け取る
void read(){

}
template<typename First, typename... Rest>
void read(First& first, Rest&... rest){
    cin >> first;
    read(rest...);
}
//
//配列以外を出力する
void write(){

}
template<typename First, typename... Rest>
void write(First first, Rest... rest){
    cout << first << " ";
    write(rest...);
}
//
//配列を区切って出力する
template<typename T>
void write_vec(vector<T>& v, char divider){
    for(size_t i = 0; i < v.size(); i++){
        cout << v[i] << divider;
    }
}
//

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

int main(){
  int N;
  cin>>N;
  int w[N],a[N];
  for(int i=0;i<N;++i) cin>>w[i];
  for(int i=0;i<N;++i) {
    int ans1=0;
    int ans2=0;
    int ans=0;
    for(int j=0;j<=i;++j) {
      ans1+=w[j];
    }
    for(int k=i+1;k<N;++k) {
      ans2+=w[k];
    }
    ans=ans1-ans2;
    if(ans<0) ans*=(-1);
    a[i]=ans;
  }
  sort(a,a+N);
  cout<<a[0];
}


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

int main() {
int64_t a,b,c,d;
  cin >> a >> b >> c >> d;
  int64_t x = a*c;
  int64_t y = a*d;
  int64_t z = b*c;
  int64_t w = b*d;
  int64_t answer =x;
    if (answer < y){
    answer = y;
  }
  if (answer < z){
    answer = z;
  }
  if (answer < w){
    answer = w;
  }
cout << answer << endl;
}


Measured memory_bytes: 3632
import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
n=int(input())
a=list(map(int,stdin.readline().split()))
ans=0
for i in range(n):
    if(i%2==0 and a[i]%2==1):
        ans+=1
print(ans)

Measured memory_bytes: 9480
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as BS

main=do
 [n,m]<-map read.words<$>getLine
 ba<-replicateM m ((\(a:[b])->(b,a)).map (read.BS.unpack).BS.words<$>BS.getLine)
 print (f m (sort ba) 0 0)
  where f 0 _ _ i = i
        f m ((b,a):ba) j i = if a>=j then (f (m-1) ba b (i+1)) else (f (m-1) ba j i)

Measured memory_bytes: 49532
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::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...);
}
#else
#define trace(...)
#endif

#define lsc(x)      scanf("%lld",&x)
#define sc(x)       scanf("%d",&x)
#define lpr(x)      printf("%lld ",(long long)x)
#define pr(x)       printf("%d ",x)
#define n_l         printf("\n")
#define VI          vector<int>
#define VII         vector<long long int>
#define m_p         make_pair
#define pb          push_back
#define fi           first
#define se           second
#define mset(x,y)   memset(x,y,sizeof(x))
#define sz(v)       (int)v.size()
#define all(v)      v.begin(), v.end()
#define fr(i, a, n) for(int i=a;i<=n;i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
const int N=(int)1e6+5;
const int mod = 1000000007;
typedef long long ll;
// order_of_key (val): returns the no. of values strictly less than val
// find_by_order (k): returns the kth largest element iterator.(0-based)
// vector<int>::iterator itr=lower_bound(v.begin(),v.end(),x);
// s.substr(pos[0-indexed], len(default=till end))
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

ll fmod(ll x){if (x<mod) return x;return x%mod;}
ll mul(ll a, ll b, ll c){
	ll ret=0;while(b){if (b%2) ret=(ret+a)%c;a=(a*2)%c;b>>=1;}
    return ret;
}
int modpow(ll a, ll b){
    ll ret=1;while(b){if (b%2) ret=(ret*a)%mod;a=(a*a)%mod;b>>=1;}
    return (int)ret;
}
inline int inv(int x){ return modpow(x, mod-2);}
int isprime[N];
void calc_prime(){
	isprime[1]=1;for(ll i=2;i<N;i++) if (!isprime[i]) for(ll j=i*i;j<N;j+=i) isprime[j]=1;
}
int main(){
    int n;sc(n);
    int k;sc(k);
    for(int i=k-n+1;i<k;i++){
        if (i >= -1000000) pr(i);
    }
    for(int i=k;i<k+n;i++){
        if (i <= 1000000) pr(i);

    }
    return 0;
}



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

int main() {
  int N;
  cin >> N;
  vector<int> A(N), B(N), C(N - 1);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  for (int i = 0; i < N; i++) cin >> B.at(i);
  for (int i = 0; i < N - 1; i++) cin >> C.at(i);
  int ans = B.at(A.at(N - 1) - 1);
  for (int i = 0; i < N - 1; i++) {
    ans += B.at(A.at(i) - 1);
    if (A.at(i + 1) - A.at(i) == 1) ans += C.at(A.at(i) - 1);
  }
  cout << ans << endl;
}

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

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		var p = Input().ToInt();
		var n = p[0];
		var l = p[1];
		string[] list = new string[n];
		for(int i = 0; i < n; i++)
		{
			list[i] = Console.ReadLine();
		}
		Array.Sort(list);
		for(int i = 0; i < n; i++)
		{
			Console.Write(list[i]);
		}
		Console.WriteLine();
	}

	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static long Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}


Measured memory_bytes: 13408
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
  }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);


signed main(){
  string s;cin >> s;
  int f = s.size()%2;
  if(f == 1)s.pb('1');
  int n = s.size();
  int ans = INF, cnt = 0;
  for(int i = 0;i < n;i+=2){
    if(s[i] != '0')cnt++;
    if(s[i+1] != '1')cnt++;
  }
  ans = min(ans, cnt);
  
  if(f == 1)s[n-1] = '0';
  cnt = 0;
  for(int i = 0;i < n;i+=2){
    if(s[i] != '1')cnt++;
    if(s[i+1] != '0')cnt++;
  }
  ans = min(ans, cnt);
  
  cout << ans << endl;
  return 0;
}






Measured memory_bytes: 512
import heapq
class Dijkstra:
    INF = 10**18
    threshold = 10**9

    def __init__(self, N):
        self.MAX_V = N + 1
        self.dist = [self.INF] * self.MAX_V
        self.G = [[] for _ in range(self.MAX_V)]

    def insert(self, X, Y, cost): self.G[X].append(cost * self.threshold + Y)

    def dijkstra(self, st):
        q = []
        heapq.heappush(q, st)
        self.dist[st] = 0

        while len(q):
            p = heapq.heappop(q)
            cost = p // self.threshold
            node = p - cost * self.threshold
            if cost > self.dist[node]: continue
            for to in self.G[node]:
                to_cost = to // self.threshold
                to_node = to - to_cost * self.threshold
                to_cost += self.dist[node]
                if self.dist[to_node] > to_cost:
                    self.dist[to_node] = to_cost
                    heapq.heappush(q, to_cost * self.threshold + to_node)

h, w = map(int, input().split())
sh, sw = map(int, input().split())
eh, ew = map(int, input().split())

sh -= 1
sw -= 1
eh -= 1
ew -= 1

S = [input() for _ in range(h)]

di = Dijkstra(h*w)
for x in range(h):
    for y in range(w):
        if S[x][y] == '#': continue
        for i in range(-2, 3):
            for j in range(-2, 3):
                X = x + i
                Y = y + j
                if X < 0 or Y < 0 or X >= h or Y >= w or S[X][Y] == '#': continue
                D = abs(i) + abs(j)

                if D == 1: di.insert(x * w + y, X * w + Y, 0)
                if D >= 2: di.insert(x * w + y, X * w + Y, 1)

di.dijkstra(sh * w + sw)
ans = di.dist[eh * w + ew]
if ans == 10**18: print(-1)
else: print(ans)


Measured memory_bytes: 208536
N = int(input())
S = input()
X = S.split(" ")
temp = 0
ing = []

for i in X:
    ing.append(int(i))
ing.sort()


for i in range(N-1):
    temp = (ing[0] + ing[1])/2
    ing.pop(0)
    ing.pop(0)
    ing.insert(0,temp)

print(ing[0])
    
    



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes                \
    cout << "Yes" << endl; \
    return 0;
#define No                \
    cout << "No" << endl; \
    return 0;
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;

template <typename T>
void print(const T &v);

int main()
{
    string S, T;
    cin >> S >> T;
    for (int i = 0; i < S.size(); i++)
    {
        if (S[i] != T[i])
        {
            No
        }
    }
    Yes
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


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

#define REP(i,n) for(long long i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(long long i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9

int N;
vector<double> p;
double dp[3000][3000];

int main(){
  cin >> N;
  p.resize(N+1);
  REP(i, N){
    cin >> p[i+1];
  } 
  dp[0][0] = 1;
  FOR(i, 1, N+1){
    dp[i][0] = dp[i-1][0] * (1-p[i]);
    FOR(j, 1, i+1){
      dp[i][j] = dp[i-1][j]*(1-p[i]) + dp[i-1][j-1] * p[i];
    }
  }

  double ans = 0;
  FOR(i, N/2+1, N+1){
    ans += dp[N][i];
  }
  //cout << ans << endl;
  printf("%.12f\n", ans);
  
  return 0;
}


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

int main() {
	int a, b, c, d,flag=1;
	cin >> a >> b >> c >> d;
	while (flag) {
		if (flag % 2 == 1) {
			c -= b;
			if (c > 0) {
				flag++;
				continue;
			}
			else {
				printf("Yes");
				flag = 0;
			}
			
		}
		else {
			a -= d;
			if (a > 0) {
				flag++;
				continue;
			}
			else {
				printf("No");
				flag = 0;
			}
		}
	}
}

Measured memory_bytes: 3684
#include <iostream>

using namespace std;

int main()
{
   int H,N;
   int sum=0;
   int tmp;
   cin>>H>>N;
   for(int i=0;i<N;i++)
   {
       cin>>tmp;
       sum+=tmp;
   }
   if(sum>=H)
    cout<<"Yes";
   else
    cout<<"No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
   
	int a, b, c;
	cin >> a >> b >> c;

	if((a==5&&b==5&&c==7) || (a==5&&b==7&&c==5) || (a==7&&b==5&&c==5))
		cout << "YES";
	else
		cout << "NO";
	
	return 0;

}


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

int main() {
  int n, m;
  cin >> n >> m;
  int a, b;
  vector<int> vec(m);
  for (int i = 0; i < n; i++) {
    cin >> a;
    for (int j = 0; j < a; j++) {
      cin >> b;
      vec.at(b-1)++;
    }
  }
  int cnt = 0;
  for (int i = 0; i < m; i++) {
    if (vec.at(i) == n) cnt++;
  }
  cout << cnt << endl;
}



Measured memory_bytes: 256
s = input()
t = input()
res = float('inf')
ls, lt = len(s), len(t)
for i in range(ls - lt + 1):
    f = 0
    for j in range(lt):
        if t[j] != s[i + j]:
            f += 1
    res = min(f, res)
print(res)

Measured memory_bytes: 9112
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int INF = 1001001001;
const ll LINF = 1e18;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    T r;
    while((r=a%b)) {
        a = b; b = r;
    }
    return b;
}

int main() {
    string S; ll K; cin >> S >> K;

    bool isOne = true;
    ll minInd = LINF;
    for(ll i = 0; i < min((ll)S.size(), K); i++){
        if(S[i] != '1'){
            isOne = false;
            minInd = i;
            break;
        }
    }
    
    cout << (isOne ? '1' : S[minInd]) << endl;
    return 0;
}



Measured memory_bytes: 256
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
C = Counter(A)
V = sorted([(k, v) for k, v in C.most_common() if v >= 2])
a = 0
b = 0
for v in V[::-1]:
    if a == 0:
        if v[1] >= 4:
            a, b = v[0], v[0]
            break
        else:
            a = v[0]
    else:
        b = v[0]
        break
print(a * b)


Measured memory_bytes: 26444
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for ( int i=1; i<=int(n); i++ )
#define MP make_pair
#define PB push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define X first
#define Y second
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

template <class T>
inline bool RD(T &ret) {
        char c; int sgn;
        if (c = getchar(), c == EOF) return 0;
        while (c != '-' && (c<'0' || c>'9')) c = getchar();
        sgn = (c == '-') ? -1 : 1 , ret = (c == '-') ? 0 : (c - '0');
        while (c = getchar(), c >= '0'&&c <= '9') ret = ret * 10 + (c - '0');
        ret *= sgn;
        	return 1;
}
template <class T>
inline void PT(T x) {
        if (x < 0) putchar('-') ,x = -x;
        if (x > 9) PT(x / 10);
        putchar(x % 10 + '0');
}
typedef unsigned long long LL;
typedef pair<int, int> pii;
typedef long double LD;
const int INF = 0x3f3f3f3f;


const int N = 2e5 + 100;
struct node {
	int v, col, id;
	node(int v = 0, int col = 0, int id = 0):v(v), col(col), id(id){}
};
bool cmp(node a, node b) {
	return a.col < b.col;
}
vector<node> G[N];
int vis[N];
bool book[N];

int ans[N];
int que[N], t;
int top;
int s;
int q[N], tail;
int n;
void BFS(int col) {
    for(int i = 0; i < tail; i ++) {
        int u = q[i];
        if(u == n) return ;
        int lb = -1, ub = SZ(G[u]);
        while(ub - lb > 1) {
            int mid = (lb + ub) >> 1;
            if(G[u][mid].col >= col) ub = mid;
            else lb = mid;
        }
        if(ub == SZ(G[u]) || G[u][ub].col != col) continue;
        for(int i = ub; i < SZ(G[u]); i ++) {
            if(G[u][i].col != col) break;
            int v = G[u][i].v, id = G[u][i].id;
            if(vis[v] == top || ans[v] <= ans[s]) continue;
            if(book[id]) break;
            vis[v] = top;
            book[id] = 1;
            if(ans[v] == INF) ans[v] = ans[s] + 1, que[t ++] = v;
            q[tail ++] = v;
        }
    }
}
int main() {
	memset(ans, 0x3f, sizeof(ans));
	int m;
	RD(n), RD(m);
	for(int i = 1;  i <= m; i ++) {
		int u, v, c;
		RD(u), RD(v), RD(c);
		G[u].PB(node(v, c, i));
		G[v].PB(node(u, c, i));
	}
	for(int i = 1; i <= n; i ++) sort(G[i].begin(), G[i].end(), cmp);
	ans[1] = 0;
	vis[1] = ++ top;
	que[t ++] = 1;
	for(int i = 0; i < t; i ++) {
		int u = que[i];
		if(u == n) break;

		for(int i = 0; i < SZ(G[u]); i ++) {
			int id = G[u][i].id, v = G[u][i].v;
			if(book[id] || ans[v] <= ans[u]) continue;
			vis[u] = ++ top;
			s = u;
			tail = 0;
			q[tail ++] = s;
			BFS(G[u][i].col);
		}
	}
	if(ans[n] == INF) puts("-1");
	else printf("%d\n", ans[n]);
}


Measured memory_bytes: 15104
#include <bits/stdc++.h>
#define MAXN 100100
#define pii pair<int, int>
#define pb push_back
typedef long long ll;

using namespace std;

int L, n = 2, m = 0, l = 0;

vector<pii> g[MAXN];

void mult(){
	for(int i = 1; i <= 20; i++){
		for(auto& j : g[i]){
			j.second *= 2;
		}
	}
	g[n].pb({n + 1, 0});
	g[n].pb({n + 1, 1});
	m += 2;
	l *= 2;
	n++;
}

void add(){
	g[1].pb({n, l++});
	m++;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    cin >> L;
    vector<bool> v;
    while(L > 0){
    	v.pb(L % 2);
    	L /= 2;
    }
    reverse(v.begin(), v.end());
    for(int i = 0; i < v.size(); i++){
    	if(i != 0 and l != 1) mult();
    	if(i != 0 and l == 1) add();
    	if(v[i]) add();
    }
    cout << n << " " << m << endl;
    for(int i = 1; i <= 20; i++){
		for(auto& j : g[i]){
			cout << i << " " << j.first << " " << j.second << endl;
		}
	}
}

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

int main() {
  string s;
  cin >> s;
  
  bool a = true;
  for (int i = 0; i < s.size(); i++){
    if (i % 2 == 0){
      if (s.at(i) != 'R' && s.at(i) != 'U' && s.at(i) != 'D'){
        a = false;
        break;
      }
    }
    else {
      if (s.at(i) != 'L' && s.at(i) != 'U' && s.at(i) != 'D'){
        a = false;
        break;
      }
    }
  }
  if (a == false){
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound

int N;
struct edge{int to,cost;};
vector<edge> G[100010];
ll D[100010];
void dijkstra(int S){
  priority_queue<PII,vector<PII>,greater<PII>> que;
  rep(i,N) D[i]=1000000000000000000;
  D[S]=0;
  que.push(mp(0,S));
  while(!que.empty()){
    PII P=que.top();
    que.pop();
    int X=P.second;
    if(D[X]<P.first) continue;
    rep(i,G[X].size()){
      edge E=G[X][i];
      if(D[E.to]>D[X]+E.cost){
        D[E.to]=D[X]+E.cost;
        que.push(mp(D[E.to],E.to));
      }
    }
  }
}

int main(){
  cin>>N;
  VI A(N-1),B(N-1),C(N-1);
  rep(i,N-1) cin>>A[i]>>B[i]>>C[i];
  int Q,K;
  cin>>Q>>K;
  VI X(Q),Y(Q);
  rep(i,Q) cin>>X[i]>>Y[i];
  rep(i,N-1){
    edge E1={A[i]-1,C[i]};
    edge E2={B[i]-1,C[i]};
    G[B[i]-1].pb(E1);
    G[A[i]-1].pb(E2);
  }
  dijkstra(K-1);
  rep(i,Q) cout<<D[X[i]-1]+D[Y[i]-1]<<endl;
}

Measured memory_bytes: 10740
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#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 Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int a,b,c;
    cin >> a >> b >> c;
    pr((a>(b+c)?a:b+c)-a);
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int N, K;
vector<vi> graph;
int ans = 0;
int dfs(int cur, int par) {
	int distance = 0;
	for (int n : graph[cur]) if (n != par) {
		distance = max(distance, 1 + dfs(n, cur));
	}
	if (distance == K - 1) {
		ans += (par != 0);
		return -1;
	}
	return distance;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N >> K;
	graph.resize(N);
	F0R(i, N) {
		int v; cin >> v; --v;
		if (i == 0) {
			ans += (v != 0);
		} else {
			graph[i].push_back(v);
			graph[v].push_back(i);
		}
	}
	dfs(0, 0);
	print(ans);
}

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

int main ()
{
    int h, w;
    do
    {
        cin >> h >> w;
        for (int i = 0;i < h;i++)
        {
            for (int j = 0;j < w;j++)
            {
                if (i == 0 || i == h-1 || j == 0 || j == w-1)
                {
                    cout << "#";
                }
                else cout << ".";
            }
            cout << endl;
        }
        if (!(h == 0 && w == 0))cout << endl;
    }while(!(h == 0 && w == 0));
    
    return 0;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> T gcd(T a,  T b) {return b ? gcd(b, a % b) : a;}
template<class U> U lcm( U m, U n ){if((0 == m )||( 0 == n ))return 0; return ((m / gcd(m, n)) * n); }
auto divisors(int n){
    vector<int>v;
    for(int i = 1; i *  i <= n;i++){
        if(n % i)continue;
        v.push_back(i);
        if(i != 1 and i * i != n)
            v.push_back(n /i);
    }
    if(n != 1)v.push_back(n);
    sort(v.begin(),v.end());
    return v;
}
auto isPrime(int num){
    if(num == 1) return true;
    for(int i = 2; i * i <= (num); ++i)
        if( num % i == 0) return false;
    return true;
}
signed main(){
    int A,B; cin >> A >> B;
    int gd = gcd(A,B);
    auto divs = divisors(gd);
    int ans = 0;
    for(auto e : divs) ans += isPrime(e);
    cout << ans << endl;
    
}



Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll X;
  cin >> X;
  if (X <= 599)
    cout << 8 << endl;
  else if (X <= 799)
    cout << 7 << endl;
  else if (X <= 999)
    cout << 6 << endl;
  else if (X <= 1199)
    cout << 5 << endl;
  else if (X <= 1399)
    cout << 4 << endl;
  else if (X <= 1599)
    cout << 3 << endl;
  else if (X <= 1799)
    cout << 2 << endl;
  else if (X <= 1999)
    cout << 1 << endl;

  return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);

const int MAXN = 1e5 + 5;

int n, m, d[MAXN];
vector<int> G[MAXN];

void dfs(int u) {
    d[u] = 1;
    for (int v : G[u]) {
        if (!d[v]) {
            dfs(v);
        }
        d[u] = max(d[u], d[v] + 1);
    }
}

int main() {
    IOS

    cin >> n >> m;
    
    int x, y;
    for (int i = 0; i < m; i++) {
        cin >> x >> y;
        G[x].push_back(y);
    }

    for (int i = 1; i <= n; i++) {
        if (!d[i]) {
            dfs(i);
        }
    }

    int ans = 0;
    for (int i = 1; i <= n; i++) {
        ans = max(ans, d[i]);        
    }
    cout << ans - 1 << '\n';
}

Measured memory_bytes: 11568
#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 int long long
using ldb = long double;
using pa = pair < int, int >;
using vec = vector < int >;
template < typename T > using index_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;
#define pb push_back
#define all(c) c.begin(),c.end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define F  first
#define S  second
#define f(i,x,n) for(int i=x;i<n;i++) 
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)

const int MOD = 1e9 + 7, INF = INT_MAX, N = 5e5 + 10;
const double PI = acos(-1);
const int LINF = LLONG_MAX;
int n,a,b,c,d,sum;
string s,s1,s2,s3;
int32_t main() {
    fast();
    set<int>sets;
    cin >> a;
    sets.insert(a);
    cin >> b >> c;
    sets.insert(b);
    sets.insert(c);
    if(sets.size()==2){
    	cout<<"Yes\n";
    }
    else
    	cout<<"No\n";


    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
using namespace std;

typedef long long int ll;
typedef long double ld;


int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    if (a==b && b==c){
        cout << 1 << endl;
    }else if(a==b || b==c || a==c){
        cout << 2 << endl;
    }else{
        cout << 3 << endl;
    }
        
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define INF 1234567890LL
#define ll long long

ll res = 0;
int N, com;
vector<int> g[200201];

int main()
{
	scanf("%d", &N);
	for(int i=0; i<N-1; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
	}

	ll sum = 0;
	for(int n=1; n<=N; n++)
	{
		sum += n;
		for(int next : g[n])
			if (next < n)
				sum -= next;

		res += sum;
	}

	printf("%lld", res);
	return 0;
}

Measured memory_bytes: 15004
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int n;
double px,py;//現在位置
double nx,ny;
double kaku;
#define PI 3.1415926535898
int main(){
	while(cin>>n){
		px =0;
		py =0;
		kaku = 0;
		nx = 0;
		ny = 0;
		if(n==-1)
			break;
		for(int i =0;i < n;i++){
			nx +=cos(kaku);
			ny +=sin(kaku);
			kaku =atan2(ny,nx)+PI/2.0;
		}
		printf("%.2lf\n%.2lf\n",nx,ny);
	}
	return 0;
}

Measured memory_bytes: 1304
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            int d = int.Parse(input[0]);
            int n = int.Parse(input[1]);

            double num = 1;

            switch (d)
            {
                case 0:
                    if (n == 100) num = 101;
                    else num = n;
                    break;
                case 1:
                    if (n == 100) num = 10100;
                    else num = 100 * n;
                    break;
                case 2:
                    if (n == 100) num = 1010000;
                    else num = 10000 * n;
                    break;
            }

            Console.WriteLine(num);
        }
    }
}

Measured memory_bytes: 11220
{-# LANGUAGE OverloadedStrings #-}
module Main where

import           Data.List
import           Control.Monad
import           Debug.Trace
import qualified Data.ByteString.Char8         as BC
import           Data.Maybe                     ( fromJust )
import qualified Data.Set                      as S
import qualified Data.IntMap.Strict            as IM
import qualified Data.Map.Strict               as M
import           Data.Char
import Data.Bits


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as =
    let (fo, la) = span f as
        las      = case la of
            [] -> []
            xs -> split f $ tail xs
    in  case fo of
            [] -> las
            xs -> xs : las


solve :: Int -> Int ->Int ->Int -> String
solve w h x y =  let
    isManyMax = if h `mod` 2 == 0 && h `div` 2 == y && w `mod`2 == 0 && w `div` 2 == x then "1" else "0"
    size = show $ fromIntegral (h * w) / 2
    in
    size ++ " " ++ isManyMax

    



main = do
    [w, h, x, y] <- readInts
    putStrLn $ solve w h x y






Measured memory_bytes: 508
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define INF 0x3f3f3f3f
#define lowbit(x) (x&(-x))
#define mid ((l+r)>>1)
using namespace std;
template<class T>il read(T &x){
	x=0;int f=1;char k=getchar();
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=x*10+k-'0';
	x*=f;
}
template<class T>il _print(T x){
	if(x>9) _print(x/10);
	putchar(x%10+'0');
}
template<class T>il print(T x){
	if(x<0) putchar('-'),x=-x;
	_print(x);
}
const int N = 2e5+5;
int n,val[N];
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n);
	for(ri i=1;i<=n;++i)
		read(val[i]);
	int mn=INF,ans=0;
	for(ri i=1;i<=n;++i)
		if(val[i]<=mn)
			++ans,mn=val[i];
	print(ans);
	return 0;
}

Measured memory_bytes: 1024