akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <tuple>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <complex>
#include <bitset>
#include <numeric>
#include <random>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n) ;++(i))
#define REPN(i,a,n) FOR((i),(a),(a)+(n))
#define FOR(i,a,b) for(int (i)=(a); (i)<(b) ;++(i))
#define PB push_back
#define MP make_pair
#define SE second
#define FI first
#define DBG(a) cerr<<(a)<<endl;
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;  typedef pair<LL, LL> PLL; typedef vector<LL> VLL;
const LL LINF=334ll<<53; const int INF=15<<26; const LL MOD=1E9+7;

typedef pair<int,int> pii;
struct Edge{
    int from,to;
    double cost;
    Edge(int from,int to,double cost)
        : from(from),to(to),cost(cost) {};
};
typedef vector<vector<Edge>> Graph;

double dijkstra(const int start,const int goal, const vector<vector<Edge>> &graph , vector<int> &prev){
    typedef pair<double,int> pii;
    int N = graph.size();
    vector<char> visited(N,false);
    // <<cost , where>, prev>
    priority_queue<pair<pii,int>,vector<pair<pii,int>>,greater<pair<pii,int>> > que;
    que.push(make_pair(make_pair(0,start),-1));
    while(not que.empty()){
        double cost;
        int where,from;
        cost = que.top().first.first;
        where = que.top().first.second;
        from=que.top().second;
        que.pop();
        if(visited[where]) continue;
        prev[where]=from;
        if(where == goal) return cost;
        visited[where] = true;
        for(int j=0;j<(int)graph[where].size();j++){
            que.push(make_pair(make_pair(graph[where][j].cost+cost,graph[where][j].to),where));
        }
    }
    return -1;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    double sx,sy,gx,gy;
    int n;
    cin >> sx>>sy>>gx>>gy>>n;
    vector<double> x(n+1),y(n+1),r(n+1);
    FOR(i,1,n+1){
        cin >> x[i]>> y[i]>>r[i];
    }
    Graph G(n+2);
    G[0].push_back(Edge(0,n+1,sqrt((gx-sx)*(gx-sx)+(gy-sy)*(gy-sy))));
    FOR(i,1,n+1){
        double tos=sqrt((x[i]-sx)*(x[i]-sx)+(y[i]-sy)*(y[i]-sy));
        double tog=sqrt((x[i]-gx)*(x[i]-gx)+(y[i]-gy)*(y[i]-gy));
        G[0].push_back(Edge(0,i,max(tos-r[i],0.0)));
        G[i].push_back(Edge(i,n+1,max(tog-r[i],0.0)));
    }
    FOR(i,1,n+1){
        FOR(j,1,n+1){
            double tmp=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
            G[i].push_back(Edge(i,j,max(tmp-r[i]-r[j],0.0)));
            G[j].push_back(Edge(j,i,max(tmp-r[i]-r[j],0.0)));
        }
    }
    vector<int> p(n+2);
    cout << fixed << setprecision(12)<<dijkstra(0,n+1,G,p)<<endl;
    return 0;
}


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

int main()
{
	int k,n,maxv=0;
	cin>>k>>n;
	int a[n+1],b[n+1];
	for(int i=1;i<=n;i++)
	  cin>>a[i];
	for(int i=1;i<=n-1;i++)
	  b[i]=a[i+1]-a[i];
	b[n]=k-a[n]+a[1];
	for(int i=1;i<=n;i++)
	{
		maxv=max(b[i],maxv);
	}
	cout<<k-maxv;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int N;
	int minimum = INF;
	
	cin>>N;
	
	for(int i = 1; i * i <= N; i++){
		int a = i, b = N/i;
		
		if(N%i) continue;
		
		minimum = min(minimum, abs(a-1) + abs(b-1));
	}
	
	cout<<minimum<<endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

#define MOD 1000000009
typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;


int main()
{
int arr[3];
cin>>arr[0]>>arr[1]>>arr[2];
sort(arr,arr+3);

cout<<arr[0]+arr[1]<<endl;
 return 0;
}


Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a, b;
    string x;
    cin >> a >> b;
    if(a > b){
        x = ">";
    }
    else if(a < b){
        x = "<";
    }
    else{
        x = "==";
    }
    cout << "a " << x << " b" << endl;
    return 0;
}


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

ll P;
//10のp乗
ll power(ll p){
    if(p==0){return 1;}
    if(p%2==1){return 10*power((p-1)/2)%P*power((p-1)/2)%P;}
    else{return power(p/2)*power(p/2)%P;}
}

int main() {
    ll N;
    string S;
    cin>>N>>P>>S;
    vector<ll> amari(N+1);
    ll ans=0;

    if(P==2 || P==5){
        rep(i,N){
            amari.at(i)=(S.at(i)-'0')%P;
            if(amari.at(i)==0){
                ans+=i+1;
            }
        }
    }

    else{
        reverse(S.begin(),S.end());
        ll ten=1;
    for(int i=1;i<=N;i++){
        amari.at(i)=S.at(i-1)-'0';
        amari.at(i)*=ten;
        amari.at(i)%=P;
        ten*=10;ten%=P;
        amari.at(i)+=amari.at(i-1);
        amari.at(i)%=P;
    }
    


    vector<int> count(P);
    
    rep(i,N+1){
        ans+=count.at(amari.at(i));
        count.at(amari.at(i))++;
        //if(count.at(amari.at(i)>=2)){ans+=count.at(amari.at(i))-1;}
    }
    

    /*rep(i,P){
        if(count.at(i)>=2){
            ans+=count.at(i)*(count.at(i)-1)/2;
        }
    }*/
    }
    
    cout<<ans<<endl;

    /*rep(i,N){
        cout<<amari.at(N-1-i)<<" ";
    }
    cout<<endl;*/
}

Measured memory_bytes: 2180
#include <iostream>
#include <algorithm>


using namespace std;


int main()
{
    long long a, b, c;
    cin >> a >> b >> c;

    long long s = max({a, b, c}) * 3;
    if ((s - (a + b + c)) % 2 == 0) {
        cout << (s - (a + b + c)) / 2 << endl;
    } else {
        cout << (s - (a + b + c)) / 2 + 2 << endl;
    }
}


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

#define F first
#define S second
#define pii pair<int, int>
#define pb push_back

using namespace std;

typedef long long ll;

const int N = 2e5 + 10;

ll ans, cnt, gr[N];
ll a[N];

vector<int> adj[N];

void DFS(int v, int p = -1)
{
	//par[v] = p;
	gr[v] = 0;

	for(auto u : adj[v])
	{
		if(u == p)continue;
		DFS(u, v);
		gr[v] ^= (gr[u] + 1);
	}
	return ;
}

/*
void dfs(int v, int p = -1)
{
	if(p != -1 && mark[p] && !mark[v])ans ^= (gr[v] + 1);
	for(auto u : adj[v])
	{
		if(u == p)continue;
		dfs(u, v);
	}
	return ;
}
*/

int main()
{
	//ios_base::sync_with_stdio(0); cin.tie(0);
	int t = 1;
	while(t--)
	{
		int ted = 0, n, root = 0; cin >> n;
		
		/*for(int i=0; i<n; i++){
			cin >> a[i];
			if(a[i])root = i, ted ++;
		}
		if(ted == 0)return cout << 1/0 << endl, 0;
		if(ted > 1)return cout << 1/0 << endl, 0;
		*/

		for(int i=0; i<n; i++)adj[i].clear();
		for(int i=0; i<n-1; i++)
		{
			int u, v; cin >> u >> v;
			--u; --v;
			adj[u].pb(v);
			adj[v].pb(u);
		}
		DFS(root);
		if(gr[root])cout << "Alice\n";
		else cout << "Bob\n";
	}

}	

Measured memory_bytes: 16512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int T = sc.nextInt();
		int A = sc.nextInt();
		int []H = new int[N];
		double[]deg = new double[N];

		for (int i = 0; i < N; i++) {
			deg[i] =T - sc.nextInt() * 0.006;
		}
		double min = Double.MAX_VALUE;
		int ans = -1;
		for (int i = 0; i < deg.length; i++) {
			if (min > Math.abs(A - deg[i])) {
				min = Math.abs(A - deg[i]);
				ans=i+1;
			}
		}

		System.out.println(ans);

	}


}



Measured memory_bytes: 38800
#include <cstdio>
#include <cstring>
using namespace std;
char q[6];

int main() {
  scanf("%s", q);
  int len_ = strlen(q);
  for(int i = 0;i < len_; i++) {
    if(q[i] == 'A' && q[i + 1] == 'C') {printf("Yes\n");return 0;}
  }
  printf("No\n");
  return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    
    stack<char> l, r;
    string s; cin >> s;
    for (auto it : s) l.push(it);
    
    int cnt = 0;
    while (!l.empty()) {
        if (r.empty()) {
            r.push(l.top());
            l.pop();
        }
        
        if (l.empty()) break;
        
        if (l.top() != r.top()) {
            cnt += 2;
            l.pop();
            r.pop();
        } else {
            r.push(l.top());
            l.pop();
        }
    }
    
    cout << cnt << '\n';
    
    return 0;
}


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

int main() {

    int n;
    cin >> n;

    int sum = 0;
    int a0 = 0;
    int a1 = 0;
    for ( int i = 0; i < n; i++ ) {
        if ( i == 0 ) {
            cin >> a0;
            sum += a0;
        }
        else if ( i == n - 1 ) {
            sum += a0;
        }
        else {
            cin >> a1;
            if ( a0 > a1 ) {
                sum += a1;
            }
            else {
                sum += a0;
            }
            a0 = a1;
        }
//        cout << sum << endl;
    }

    cout << sum << endl;

    return 0;
}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = 1e9+7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	string s;
	cin >>s;
	bool ok=1;
	rep(i, sz(s)-1){
		if(s[i]==s[i+1]) ok=0;
	}
	cout << (ok? "Good":"Bad") <<"\n";
	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int,input().split()))
from collections import defaultdict
d = defaultdict(int)
for i in a:
    d[i]+=1
eat_cnt = 0
pair_cnt = 0
for i in d.values():
    eat_cnt+=((i-1)//2)
    pair_cnt+=(1-i%2)

eat_cnt+=(pair_cnt//2 + pair_cnt%2)
print(n-eat_cnt*2)

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

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

	vector<int> H(N);
	for (int i = 0; i < N; i++) cin >> H.at(i);

	int ANS = 1;
	while(N > 1){
		for (int i = N - 1; i > 0; i--) {
			if (H.at(N - 1) >= H.at(i - 1)) {
				if (i == 1) ANS++;
			}else break;
		}
		N--;
	}
	cout << ANS << endl;
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;
#define rep(i,s,e) for(int i = (int)(s); i < (int)(e); ++i)
#define per(i,s,e) for(int i = (int)(s)-1; i >= (int)(e); --i)

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int n; cin >> n;
  vector<int> v(n);
  cin >> v;
  sort(v.begin(),v.end());
  vector<ll> s(n);
  s[0] = v[0];
  rep(i,1,n)s[i] = s[i-1] + v[i];
  int ans = 1;
  {
    int idx = n - 2;
    while(idx>=0 && v[idx+1]<=s[idx--]*2)ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>

int main(){
  int i;
  int x[10];
  int n = scanf("%d %d %d %d %d",&x[1],&x[2],&x[3],&x[4],&x[5]);
  for(i=1;i<=5;i++){
    if (x[i] != i){
      printf("%d",i);
    }
  } 
  
return 0;
}

Measured memory_bytes: 1728
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)

using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int, int>;
using vpii=vector<pii>;

template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;}
template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;}

constexpr int inf = 1e9;
constexpr ll linf = 3e18;
constexpr double eps = 1e-9;

string s;

int main()
{
    cin >> s;

    int N = s.size();

    vector<char> v;
    v.PB(s[0]);
    v.PB(s[1]);

    int cnt = 0;

    for (int i = 2; i < N; ++i) {
        v.PB(s[i]);
        if (v[v.size() - 1] != v[v.size() - 1 - 2]) {
            char hoge = s[i];
            v.pop_back();
            v.pop_back();
            v.PB(hoge);
            cnt++;
        }
        if (v.size()>=3){
            if (v[v.size() - 1] != v[v.size() - 1 - 2]) {
                char hoge = v[v.size() - 1];
                v.pop_back();
                v.pop_back();
                v.PB(hoge);
                cnt++;
            }
        }
        if (v.size()>=3){
            if (v[v.size() - 1] != v[v.size() - 1 - 2]) {
                char hoge = v[v.size() - 1];
                v.pop_back();
                v.pop_back();
                v.PB(hoge);
                cnt++;
            }
        }
        if (v.size()>=3){
            if (v[v.size() - 1] != v[v.size() - 1 - 2]) {
                char hoge = v[v.size() - 1];
                v.pop_back();
                v.pop_back();
                v.PB(hoge);
                cnt++;
            }
        }
        if (v.size()>=3){
            if (v[v.size() - 1] != v[v.size() - 1 - 2]) {
                char hoge = v[v.size() - 1];
                v.pop_back();
                v.pop_back();
                v.PB(hoge);
                cnt++;
            }
        }
    }

    cout << (cnt % 2 == 0 ? "Second" : "First") << endl;
}


Measured memory_bytes: 640
type ABC(stream:System.IO.TextReader) =
  member this.Scan1 f = stream.ReadLine() |> f
  member this.Scan2 f = stream.ReadLine().Split() |> Array.map f |> (fun a -> (a.[0], a.[1]))
  member this.Scan3 f = stream.ReadLine().Split() |> Array.map f |> (fun a -> (a.[0], a.[1], a.[2]))
  member this.Scan4 f = stream.ReadLine().Split() |> Array.map f |> (fun a -> (a.[0], a.[1], a.[2], a.[3]))
  member this.ScanVecH f = stream.ReadLine().Split() |> Array.map f
  member this.ScanVecV n f = [| for i in 1..n -> stream.ReadLine() |> f |]
  member this.ScanMatrix n f  = [| for i in 1..n -> stream.ReadLine().Split() |> Array.map f |]
  member this.ScanCharMatrix n = [| for i in 1..n -> stream.ReadLine().ToCharArray() |]
  member this.Close () = stream.Close()

let util = ABC(stdin)

let N, T = util.Scan2 int
let xs = util.ScanMatrix N int

[
  for [|c;t|] in xs do
    if t <= T then
      yield c
]
|> function
   | [] -> printfn "TLE"
   | x -> printfn "%d" (List.min x)


util.Close()


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

using namespace __gnu_pbds;

#define int long long
#pragma GCC optimize ("O3")
#define ll long long
#define vec vector <int>
#define rep(i,a,b) for (ll i=a;i<b;i++)
#define repD(i,a,b) for (ll i=a;i>b;i--)
#define pb push_back
#define pii pair <int,int>
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define maa 1000000007
#define Eps 1e-9
#define PI 3.14159265359

typedef tree<pii,null_type,less <pii >,rb_tree_tag,tree_order_statistics_node_update>ind_set;
typedef gp_hash_table<int, int, hash<int> > ht1;   /// if clear is required
typedef cc_hash_table<int, int, hash<int> > ht2;

///*X.find_by_order("index")
///X.order_of_key("key")

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

int n,a[100005],b[100005],c[100005];
int DP[100005][3];
void solve()
{

    cin>>n;rep(i,0,n)cin>>a[i]>>b[i]>>c[i];
    DP[0][0]=a[0];DP[0][1]=b[0];DP[0][2]=c[0];

    rep(i,1,n)
    {
        DP[i][0]=a[i]+max(DP[i-1][1],DP[i-1][2]);
        DP[i][1]=b[i]+max(DP[i-1][0],DP[i-1][2]);
        DP[i][2]=c[i]+max(DP[i-1][1],DP[i-1][0]);
    }
    cout<<max(DP[n-1][0],max(DP[n-1][1],DP[n-1][2]));
}
signed main()
{

    srand(time(NULL));

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

///freopen("input.txt","r",stdin);
///freopen("output.txt","w",stdout);

    int t=1;
///cin>>t;
    rep(a,0,t)
    {
        ///cout<<"Case "<<a+1<<": ";
        solve();
    }
}


Measured memory_bytes: 4992
package main

import (
	"fmt"
)

func searchCombination(remain int, count int, limit int) int {
	//	fmt.Printf("searchCombination(%d, %d, %d)\n", remain, count, limit)
	if count > limit || remain < 0 {
		return 1
	} else if remain == 0 {
		return 1
	}
	for _, num := range []int{5, 4, 3, 2, 1} {
		if searchCombination(remain-num, count+1, limit) == 1 {
			return 1
		}
	}
	return 0
}

func main() {
	var x int
	fmt.Scanf("%d", &x)
	var result int
	if x < 100 {
		result = 0
	} else {
		mod100 := x % 100
		div100 := x / 100
		if mod100 == 0 {
			result = 1
		} else if div100*5 < mod100 {
			result = 0
		} else {
			result = searchCombination(mod100, 0, div100)
		}
	}
	fmt.Printf("%d\n", result)
}


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

using namespace std;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    std::map <long long, int> mp;

    int n;
    std::cin >> n;
    long long sum = 0;
    for (int i = 0; i < n; ++i) {
        long long x;
        std::cin >> x;
        ++mp[x];
        sum += x;
    }

    int q;
    std::cin >> q;

    for (int i = 0; i < q; ++i) {
        int a, b;
        std::cin >> a >> b;
        auto it = mp.find(a);
        if (it != mp.cend()) {
            sum += (b - it -> first) * it -> second;
            int cnt = it -> second;
            mp.erase(a);
            auto it_s = mp.find(b);
            if (it_s != mp.cend()) {
                mp[b] += cnt;
            } else {
                mp[b] = cnt;
            }
        }

        std::cout << sum << '\n';
    }

    return 0;
}


Measured memory_bytes: 7536
#include <iostream>
using namespace std ; 
int main()
{
int a ; cin >> a ;
int sum = 0 ; 
while (a>=500) {
sum +=1000 ; 
    a-=500 ; 
}
while (a>=5 ) { 
sum += 5 ; 
a-= 5 ; }
cout<< sum ; 

    return 0;
}

Measured memory_bytes: 256
unittest
{
	assert( [ "3", "1 2 2" ].parse.expand.solve == "Yes" );
	assert( [ "3", "1 1 2" ].parse.expand.solve == "No" );
	assert( [ "5", "4 3 4 3 4" ].parse.expand.solve == "No" );
	assert( [ "3", "2 2 2" ].parse.expand.solve == "Yes" );
	assert( [ "4", "2 2 2 2" ].parse.expand.solve == "Yes" );
	assert( [ "5", "3 3 3 3 3" ].parse.expand.solve == "No" );
	
	assert( [ "6", "5 4 3 4 3 4" ].parse.expand.solve == "No" );		// 追加ケース
	assert( [ "6", "4 4 3 4 3 4" ].parse.expand.solve == "Yes" );		// 追加ケース
	assert( [ "6", "4 4 4 4 3 4" ].parse.expand.solve == "No" );		// 追加ケース
	assert( [ "6", "2 2 2 3 3 3" ].parse.expand.solve == "No" );		// 追加ケース
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( as );
}

auto solve( long[] as )
{
	auto gs = as.sort().group.array;
	auto mi = gs.front[ 0 ];
	auto ma = gs.back[ 0 ];
	switch( ma - mi )
	{
		case 0:
			// 全体の色数をn、各色1匹ずつにできれば成り立つ。
			// 全体の色数をmi、各色2匹以上にできれば成り立つ。
			if( ( mi == as.length.signed - 1 ) || ( mi * 2 <= as.length.signed ) ) return "Yes";
			break;
		
		case 1:
			// 全体の色数をma、miと発言した猫の色を1匹ずつ、maと発言した猫の色を2匹以上にできれば成り立つ。
			auto mit = gs.front[ 1 ];
			if( mit <= mi && mit + ( ma - mit ) * 2 <= as.length ) return "Yes";
			break;
		
		default:
			// 全体の色数は「a+0(自分が他と同じ色のとき) or a+1(自分が他と違う色のとき)」しかありえないので、
			// miとmaが2以上離れていたら絶対に成り立たない。
			break;
	}
	return "No";
}


Measured memory_bytes: 4476
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int dp[2001][2001][2];
int main(void)
{
	int n,k,i,j,w,x,m,mx;
	char s[2001],t[2001];
	scanf("%d %d",&m,&n);
	scanf("%s",s);
	scanf("%s",t);
	for(i=0;i<=m;i++)	{
		for(j=0;j<=n;j++)	{
			dp[i][j][0]=-1;	dp[i][j][1]=-1;
		}
	}
	if(s[0]=='I')	dp[1][0][1]=1;
	else dp[1][0][0]=0;
	if(t[0]=='I')	dp[0][1][1]=1;
	else dp[0][1][0]=0;
	for(i=0;i<=m;i++)	{
		for(j=0;j<=n;j++)	{
			if(i<m)	{
				if(s[i]=='I')	{
					dp[i+1][j][1]=max(1,dp[i+1][j][1]);
					dp[i+1][j][1]=max(dp[i][j][0]+1,dp[i+1][j][1]);
				}
				else {
					dp[i+1][j][0]=max(0,dp[i+1][j][0]);
					dp[i+1][j][0]=max(dp[i][j][1]+1,dp[i+1][j][0]);
				}
			}
			if(j<n)	{
				if(t[j]=='I')	{
					dp[i][j+1][1]=max(1,dp[i][j+1][1]);
					dp[i][j+1][1]=max(dp[i][j][0]+1,dp[i][j+1][1]);
				}
				else {
					dp[i][j+1][0]=max(0,dp[i][j+1][0]);
					dp[i][j+1][0]=max(dp[i][j][1]+1,dp[i][j+1][0]);
				}
			}
		}
	}
/*	for(i=0;i<=m;i++)	{
		for(j=0;j<=n;j++)	{
			printf(" %2d",dp[i][j][0]);
			printf(" %2d ",dp[i][j][1]);
		}
		printf("\n");
	}
*/	
	
	mx=-1;
	for(i=0;i<=m;i++)	{
		for(j=0;j<=n;j++)	{
			mx=max(mx,dp[i][j][0]);
			mx=max(mx,dp[i][j][1]);
		}		
	}
	if(mx%2==0 && mx!=0)	mx--;
	printf("%d\n",mx);
	return 0;
}


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

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {


		int N =nextInt();
		int K =nextInt();

		double ans = 0;

		for(int i=1;i<=N;i++){
			int x=i;
			int n=0;
			while(x<K){
				x*=2;
				n++;
			}
			ans+=Math.pow(0.5,n);

		}
		System.out.printf("%.9f%n",ans/(double)N);
	}


	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 21332
N = int(input())
h_list = list(map(int, input().split()))

count = min(h_list)
h_list = [item - min(h_list) for item in h_list] + [0]

first = 0
for h in range(len(h_list) - 1):
    if h_list[h] > h_list[h + 1]:
        count += h_list[h] - first
        first = h_list[h + 1]
    else:
        continue
print(count)

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

using namespace std;

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

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

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

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

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

bool dp[20][20][20];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n;
  string s;
  cin>>n>>s;
  dp[0][0][0]=true;
  REP(i, n){
    int tmp=s[i]-'0'+1;
    FORR(y, 0, 11){
      FORR(x, 0, 11){
        if(!dp[x][y][0]){
          continue;
        }
        if(y>0){
          if(dp[x][y][0]){
            dp[x][y][tmp]=true;
          }
        }
        else{
          if(x>0){
            dp[x][tmp][0]=true;
          }
          else{
            dp[tmp][0][0]=true;
          }
        }
      }
    }
  }
  int ans=0;
  FOR(x, 1, 11){
    FOR(y, 1, 11){
      FOR(z, 1, 11){
        if(dp[x][y][z]){
          // cout<<x-1<<' '<<y-1<<' '<<z-1<<'\n';
          ++ans;
        }
      }
    }
  }
  cout<<ans<<'\n';
  return 0;
}

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

using ll = long long;
using ld  = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=9223372036854775807;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-10; //微調整用（EPSより小さいと0と判定など）

int ii() { int x; if (scanf("%d", &x)==1) return x; else return 0; }
long long il() { long long x; if (scanf("%lld", &x)==1) return x; else return 0; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od_nosp(double x) { printf("%.15f", x); } // 古い問題用
void od(double x) { printf("%.15f ", x); }
// long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る
// それをなんとかするには独自の出力を作らなければならなそう
void os(const string &s) { printf("%s ", s.c_str()); }
void oc(const char &c) { printf("%c ", c); }
#define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認
void br() { putchar('\n'); }

// #define gcd __gcd //llは受け取らない C++17~のgcdと違うので注意
// int lcm(int a, int b){return a / gcd(a, b) * b;}
#define begin_end(a) a.begin(),a.end() //sort(begin_end(vec));
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll)(n) ; i++ )
#define DREP(i,m,n) for(ll i=(ll)(m) ; i > (ll)(n) ; i-- )
#define rep(i,n) REP(i,0,n)
#define m_p(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define p_b push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに


// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
  }
  return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

//最大値、最小値の更新。更新したor等しければtrueを返す
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

//4近傍（上下左右） rep(i, 2) にすると右・下だけに進む
vector<int> dx_4 = {1, 0, -1, 0};
vector<int> dy_4 = {0, 1, 0, -1};

// -------- template end - //


// - library ------------- //



// --------- library end - //


int main(){

  ll N = il();

  vector<ll> as;
  rep(i, N){
    as.push_back(il());
  }

  ll money = 1000;
  ll kabu = 0;

  rep(i, N){
    // i 日目 

    // とりあえず全部売る
    money += kabu * as[i];
    kabu = 0;

    if (i!=N-1){
      // 最終日でなかった場合、買うかどうかの判断をする

      // 明日上がるかどうか？
      if (as[i] < as[i+1]){
        ll purchace = money / as[i];
        money -= as[i] * purchace;
        kabu += purchace;
      }
      // 同じ値段か下がるなら、買わない
    }

  }

  cout << money << endl;


  
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
pair<int,int> P[2020];
ll dp[2020][2020];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>x;
		P[i]={x,i};
	}
	
	sort(P,P+N);
	reverse(P,P+N);
	
	FOR(x,N+1) FOR(y,N+1) dp[x][y]=-1LL<<60;
	dp[0][0]=0;
	FOR(i,N) {
		ll k=P[i].first;
		r=P[i].second;
		for(x=0;x<=i;x++) {
			y=i-x;
			
			dp[x+1][y]=max(dp[x+1][y],dp[x][y]+abs(r-(x))*k);
			dp[x][y+1]=max(dp[x][y+1],dp[x][y]+abs(r-(N-1-y))*k);
			
		}
	}
	
	ll ret=-1LL<<60;
	FOR(x,N+1) ret=max(ret,dp[x][N-x]);
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 35256
#pragma warning(disable: 4996)

#include <iostream>
#include <iomanip>
#include <random>
#include <unordered_map>
#include <functional>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <vector>
#include <bitset>
#include <numeric>
#include <string>
#include <set>
#include <tuple>
#include <utility>
#include <regex>
#include <deque>
#include <map>
#include <queue>
using namespace std;

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, m;
	cin >> n >> m;
	cout << (n == m ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>

#define N 50
#define M 50

char A[N][N], B[M][M];

bool is_matching(int x, int y, int pattern_size) {
  for (int i = 0; i < pattern_size; i++) {
    for (int j = 0; j < pattern_size; j++) {
      if (A[x+i][y+j] != B[i][j]) return false;
    }
  }
  return true;
}

int main(void) {
  int n, m;

  scanf("%d %d", &n, &m);

  for (int i = 0; i < n; i++)
    scanf("%s", A[i]);
  for (int i = 0; i < m; i++)
    scanf("%s", B[i]);

  for (int i = 0; i <= n-m; i++) {
    for (int j = 0; j <= n-m; j++) {
      if(is_matching(i, j, m)) {
        printf("Yes\n");
        return 0;
      }
    }
  }
  
  printf("No\n");
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#include <cmath>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
//================================================

int a = 0, b = 0, c, d, n, k = 0;
string s, t;



int main()
{
	cin >> s; int cnt = 0;
	if (s.size() == 2)
		cout << s << endl;
	else
	{
		reverse(all(s));
		cout << s << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using i64 = int64_t;

int main() {
    string s;
    cin >> s;
    bool ok = false;
    for (int j = 0; j < s.size()-1; ++j) {
        if (s[j] == 'A' && s[j+1] == 'C') ok = true;
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}


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

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
 
////////////////////////////////////////////////////////////////////

const int N = 2e3 + 5;

int A[N], P[N];
ll ans, DP[N][N];

bool CMP(int i, int j) { return A[i] > A[j]; }

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	mt19937 Rnd(time(0));

	int n; cin >> n;
	for (int i = 0; i < n; i++) cin >> A[i], P[i] = i;
	sort(P, P + n, CMP);
	for (int x = 0; x <= n; x++) for (int y = 0; x + y <= n; y++) {
		if (!x && !y) continue;
		int i = x + y - 1;
		if (x) DP[x][y] = max(DP[x][y], DP[x - 1][y] + 1LL * A[P[i]] * ((P[i] + 1) - x));
		if (y) DP[x][y] = max(DP[x][y], DP[x][y - 1] + 1LL * A[P[i]] * ((n - y + 1) - (P[i] + 1)));
		if (x + y == n) ans = max(ans, DP[x][y]);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 26284
package main

import "fmt"

func main(){
	var n, m int
	var ans int

	fmt.Scan(&n, &m)
	var A = make([]int, m)

	for i := 0 ; i < m ; i++{
		fmt.Scan(&A[i])
	}
	for i := 0 ; i < m ; i++{
		ans += A[i]
	}

	if n - ans < 0{
		fmt.Println("-1")
	}else {
		fmt.Println(n-ans)
	}
}

Measured memory_bytes: 2424
#include<stdio.h>
int main(){
  int a,b;
	
	scanf("%d %d",&a,&b);
	
	if(a<b){
		printf("a < b\n");
	}
	else if(a>b){
		printf("a > b\n");
	}
	else if(a==b){
		printf("a == b\n");
	}
	
	return 0;


}

Measured memory_bytes: 576
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('a1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    S, T = read_str_list()
    print(T + S)


main()


Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

LL rec(LL n,LL x){
    if(n == 0)return 1;
    LL len = (1LL << n+1) - 3;      // n-1 のバーガーの長さ
    LL num = (1LL << n) -  1;        // n-1 のバーガーのパティの枚数
    if(x == 1)return 0;
    if(x == len + 2)return num + 1; // ちょうど半分
    if(x < len + 2)return rec(n-1,x-1);
    if(x > len + 2)return num + 1 + rec(n-1,x-(len+2));
}

int main(){
    LL N;cin >> N;
    LL X;cin >> X;
    cout << rec(N,X) << endl;
}



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

 using namespace std;
 int main() {
   string N;
   int two, i;
   cin >> N;
   two = 0;
   for (i = 0; i < 4; i++) {
     if (N.at(i) == '2') two++;
   }
   cout << two << endl;
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <complex>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,C,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
const long double EPS = 1e-9;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;


int main() {
    cin>>N;
    vec a(N), b(N,-1);
    rep(i,N) cin>>a[i];
    reverse(a.begin(), a.end());
    rep(i,N){
        ll id = (i%2 == 0) ? i/2 : (N - 1 - i/2);
        b[id] = a[i];
    }
    rep(i,N){
        cout<<b[i];
        if(i != N-1) cout<<' ';
    }
    cout<<endl;
}

Measured memory_bytes: 5248
n = int(input())


def num2alpha(num):
    if num <= 26:
        return chr(96 + num)
    elif num % 26 == 0:
        return num2alpha(num // 26 - 1) + chr(122)
    else:
        return num2alpha(num // 26) + chr(96 + num % 26)


print(num2alpha(n))

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

int main() {
    int mod = 1000000007;
    int s;
    cin >> s;
    vector<int> dp(s+1, 0);
    dp[0] = 1;
    for(int i = 3; i <= s; ++i) {
        for(int j = 0; j <= i-3; ++j) {
            dp.at(i) += dp.at(j);
            dp.at(i) %= mod;
        }
    }

    cout << dp.at(s) << endl;
    return 0;
}


Measured memory_bytes: 3624
n = int(input())
s_list = []
ans_list = [0, 0, 0, 0]

for i in range(n):
    s_list.append(input())

for i in range(n):
    if s_list[i] == "AC":
        ans_list[0] += 1
    elif s_list[i] == "WA":
        ans_list[1] += 1
    elif s_list[i] == "TLE":
        ans_list[2] += 1
    else:
        ans_list[3] += 1

print("AC x " + str(ans_list[0]))
print("WA x " + str(ans_list[1]))
print("TLE x " + str(ans_list[2]))
print("RE x " + str(ans_list[3]))


Measured memory_bytes: 16328
#include <stdio.h>

int binarySearch(int A[], int n, int key)
{
    int left = 0, right = n, mid;

    while (left < right) {
        mid = (left + right) / 2;
        if (A[mid] == key)  return mid;
        if (key < A[mid])   right = mid;
        else                left = mid + 1;
    }

    return 0;
}

int main()
{
    int i, n, A[100000], q, key, sum = 0;

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

    scanf("%d", &q);
    for (i = 0; i < q; i++) {
        scanf("%d", &key);
        if (binarySearch(A, n, key)) sum++;
    }

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

    return 0;
}


Measured memory_bytes: 2076
#include<stdio.h>
int main(void){
    static int cards[4][13];
    int i,j,n,m;
    char c;
    char s[5]={'S','H','C','D','\0'};
    scanf("%d\n",&n);
    for(i=0;i<n;i++){
        scanf("%c %d\n",&c,&m);
        for(j=0;j<4;j++)
            if(s[j]==c){
                cards[j][m-1]=1;
            }
    }
    for(i=0;i<4;i++){
        for(j=0;j<13;j++){
            if(cards[i][j]==0)
                printf("%c %d\n",s[i],j+1);
        }
    }
    return 0;
}


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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent
ll n,m;
const int N=1e5+5;
vector<ll> adj[N];
int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    cin>>n>>m;
    rep(i,m)
    {
        ll x,y;
        cin>>x>>y;
        adj[x].pb(y);
        adj[y].pb(x);
    }
    queue<ll> q;
    vector<ll> dist(n+1,INF);
    vector<ll> p(n+1,-1);
    dist[1]=0;
    q.push(1);
    while(!q.empty())
    {
        ll tp=q.front();
        q.pop();
        for(auto v:adj[tp])
        {
            if(dist[v] > dist[tp]+1)
            {
                dist[v]=dist[tp]+1;
                q.push(v);
                p[v]=tp;
            }
        }
    }
    repA(i,1,n)
    {
        if(dist[i]>=INF)
        {
            cout<<"No\n";
            return 0;
        }
    }
    cout<<"Yes\n";
    repA(i,2,n) cout<<p[i]<<'\n';
    return 0;
}
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!


Measured memory_bytes: 13760
abcus = {"0":"* = ****","1":"* =* ***","2":"* =** **","3":"* =*** *","4":"* =**** ",
        "5":" *= ****","6":" *=* ***","7":" *=** **","8":" *=*** *","9":" *=**** "}
num = [["" for i in range(5)] for j in range(8)]
cnt = 0
while True:
    try:
        a = input().zfill(5)
        if cnt != 0:
            print()
        for i in range(5):
            n = abcus[a[i]]
            for j in range(8):
                num[j][i] = n[j]
        for i in range(8):
            print("".join(num[i]))
        cnt+=1
    except:
        break
    


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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

vector<P> sec;
vector<bool> col;
bool ok = true;

P dfs(int now, int prev, bool nowc, const vvi &tr, const vi &d) {
  col[now] = nowc;
  P p = {-INF, INF};
  REP(i, SZ(tr[now])) {
    int nxt = tr[now][i];
    if(nxt == prev) continue;
    P tmp = dfs(nxt, now, !nowc, tr, d);
    chmax(p.first, tmp.first);
    chmin(p.second, tmp.second);
  }
  if(p.second < p.first) ok = false;

  if(d[now] != -1) {
    ok &= p.first <= d[now] && d[now] <= p.second;
    sec[now] = {d[now], d[now]};
    return {d[now]-1, d[now]+1};
  } else {
    sec[now] = p;
    return {p.first-1, p.second+1};
  }
}

vector<int> ans;

void dfs2(int now, int prev, int l, int r, const vvi &tr) {
  P tmp = {max(l, sec[now].first), min(r, sec[now].second)};
  ans[now] = tmp.first;
  REP(i, SZ(tr[now])) {
    int nxt = tr[now][i];
    if(nxt == prev) continue;
    dfs2(nxt, now, tmp.first-1, tmp.first+1, tr);
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  vvi tr(n);
  REP(i, n-1) {
    int a, b; cin >> a >> b;
    a--; b--;
    tr[a].push_back(b);
    tr[b].push_back(a);
  }

  vi d(n, -1);
  int k; cin >> k;
  REP(i, k) {
    int v, p; cin >> v >> p;
    v--;
    d[v] = p;
  }

  sec.resize(n);
  col.resize(n);
  dfs(0, -1, 0, tr, d);

  int colcheck = -1;
  REP(i, n) {
    if(d[i] != -1) {
      if(colcheck == -1) {
        colcheck = (d[i] % 2) ^ col[i];
      } else if(colcheck != ((d[i] % 2) ^ col[i])) {
        ok = false;
        break;
      }
    }
  }

  if(!ok) {
    cout << "No" << endl;
    return 0;
  }

  ans.resize(n);
  dfs2(0, -1, -INF, INF, tr);

  cout << "Yes" << endl;
  REP(i, n) {
    cout << ans[i] << endl;
  }


}
























Measured memory_bytes: 17408
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
using P = pair<ll, ll>;

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;}

const ll mod = 1000000007;
const int INF = 1<<29;

int main(){
  int X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  vector<int> r(A), g(B), n(C);
  rep(i, A) cin >> r[i];
  rep(i, B) cin >> g[i];
  rep(i, C) cin >> n[i];

  sort(r.begin(), r.end(), greater<int>());
  sort(g.begin(), g.end(), greater<int>());

  vector<int> key;
  rep(i, X) key.push_back(r[i]);
  rep(i, Y) key.push_back(g[i]);
  rep(i, C) key.push_back(n[i]);
  sort(key.begin(), key.end(), greater<int>());

  ll ans = 0;
  rep(i, X + Y) ans += key[i];
  cout << ans << endl;
}


Measured memory_bytes: 3572
N = int(input())
A = list(map(int,input().split()))

while True:
  mini = min(A)
  newA = []
  op = False
  for i in A:
    if i == mini:
      newA.append(i)
    elif i % mini == 0:
      newA.append(mini)
    else:
      newA.append(i % mini)
  A = newA
  if len(set(A)) == 1:
    break

print(A[0])

Measured memory_bytes: 14252
# include <iostream>
# include <cstdio>
# include <cstring>
using namespace std;
const int N = 2e5 + 12;
const int inf = 0x3f3f3f3f;
int a[12] = {1,6,36,216,1296,7776,46656,9,81,729,6561,59049},f[N];
int main()
{
	memset(f,0x3f3f3f3f,sizeof f);f[0] = 0;
	for(int i = 1;i < N;i++)
	 for(int j = 0;j < 12;j++)if(a[j] <= i)
	 f[i] = min(f[i],f[i - a[j]] + 1);
	 int n;scanf("%d",&n);printf("%d\n",f[n]);
}

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

#define int long long

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

int Q;
int l[100000], r[100000];
int prime[100001] = {};
int like_2017[100001] = {};

signed main() {
    for (int i = 2; i <= 100000; i++) {
        for (int j = 2; j <= sqrt(i); j++) {
            if (i % j == 0) {
                goto check;
            }
        }
        prime[i] = 1;
check:  ;
    }
    for (int i = 1; i <= 100000; i++) {
        if (prime[i] == 1 && i % 2 == 1 && prime[(i + 1) / 2] == 1) {
            like_2017[i] = 1;
        }
    }
    for (int i = 1; i <= 100000; i++) {
        like_2017[i] += like_2017[i - 1];
    }
    cin >> Q;
    for (int i = 0; i < Q; i++) {
        cin >> l[i] >> r[i];
    }
    for (int i = 0; i < Q; i++) {
        cout << like_2017[r[i]] - like_2017[l[i] - 1] << endl;
    }
    return 0;
}


Measured memory_bytes: 3712