akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace C_SMTB2019
{
    class MainClass
    {

        static int[] s;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            int div = s[0]%100;
            int deca = s[0] /100;
            if(s[0]>=2100){
                WriteLine(1);

            } else{
                if(deca*5<div){
                    WriteLine(0);
                }else{
                    WriteLine(1);
                }
            }
        }
    }
}


Measured memory_bytes: 13268
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

H, W, A, B = map(int, input().split())

ans = makelist(H, W)
for y in range(H):
    for x in range(W):
        if y < B and x < A:
            ans[y][x] = 1
        elif y >= B and x >= A:
            ans[y][x] = 1

for y in range(H):
    print("".join(map(str, ans[y])))


Measured memory_bytes: 12788
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
int n;
cin>>n;
int t;
int x;
int y;
int pota=0;
int potb=0;
for (int i=1;i<=n;i++)
{
  cin>>t>>x>>y;
  if(x+y>t||(t-x-y)%2!=0){ 
  cout<<"No"<<endl;
  return 0; 
}
}  
cout<<"Yes"<<endl;
return 0; 
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e9+7;

int main(){
    string s;
    cin >> s;
    ll n=s.length();
    ll be=-1,en=-1;
    rep(i,n){
        if(s[i]=='A'){
            be=i;
            break;
        }
    }
    for(ll i=n-1;i>=0;i--){
        if(s[i]=='Z'){
            en=i;
            break;
        }
    }
    cout << en-be+1 << endl;
    return 0;
}

Measured memory_bytes: 3756
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main()
{
	string a,b;
    cin>>a>>b;
    int i=0;
    for(int j=0;j<a.size();j++)
	{
		if(a[j]==b[2-j])
			i++;
	}
    if(i==3)
	cout<<"YES"<<endl;
	else
	cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
import heapq
n,k=map(int,input().split())

q=[]
for _ in range(n):
    a,b=map(int,input().split())
    heapq.heappush(q,(a,b))

while k>0:
    a,b=heapq.heappop(q)
    k-=b

print(a)

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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

// Aliases
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

// I/O Asynchronizing
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int t = (c - (a - b));
    cout << (t >= 0 ? t : 0)<< endl;

    return 0;
}


Measured memory_bytes: 256
a,b,c = map(float,input().split())
import math
h = b * math.sin(math.radians(c))
S = ( a * h ) / 2
L = a + b + ( math.sqrt( a**2 + b**2 - 2*a*b*math.cos(math.radians(c)) ) )
print('{0:.8f}'.format(S))
print('{0:.8f}'.format(L))
print('{0:.8f}'.format(h))


Measured memory_bytes: 5692
#include <iostream>
#include <vector>

using namespace std;

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

int main(){
  int N, ans = 1;
  cin >> N;
  vector<int> H(N);
  rep(i, N) cin >> H[i];

  for (int i = 1; i < N; ++i){
    int cnt = 0;
    rep(j, i+1){
      if (H[j] <= H[i]){
        cnt++;
      }
    }
    if (cnt == i+1){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <functional>
#include <algorithm>

using namespace std;

template<class T>
T maxflow(vector<vector<int>> E_, vector<vector<T>> C_, int s, int t)
{
    int n = (int)E_.size();
    vector<vector<int>> E(n), R(n);
    vector<vector<T>> C(n);
    T mx = {};
    for (int i=0; i<n; i++)
    for (int j=0; j<(int)E_[i].size(); j++)
    {
        int v = E_[i][j];
        R[i].push_back((int)E[v].size());
        R[v].push_back((int)E[i].size());
        E[i].push_back(v);
        E[v].push_back(i);
        C[i].push_back(C_[i][j]);
        C[v].push_back(T());
        mx = max(mx, C_[i][j]);
    }

    vector<int> D;
    vector<int> I;

    auto bfs = [&]()
    {
        D = vector<int>(n, -1);
        vector<int> Q;
        D[s] = 0;
        Q.push_back(s);
        int q = 0;
        while (q<(int)Q.size())
        {
            int v = Q[q++];
            for (int i=0; i<(int)E[v].size(); i++)
            if (C[v][i]>0 && D[E[v][i]]==-1)
            {
                D[E[v][i]] = D[v]+1;
                Q.push_back(E[v][i]);
            }
        }
    };

    function<T(int,T)> dfs = [&](int v, T f)
    {
        if (v==t)
            return f;
        for (int &i=I[v]; i<(int)E[v].size(); i++)
        if (C[v][i]>0 && D[v]<D[E[v][i]])
        {
            T d = dfs(E[v][i], min(f, C[v][i]));
            if (d>0)
            {
                C[v][i] -= d;
                C[E[v][i]][R[v][i]] += d;
                return d;
            }
        }
        return T();
    };

    T flow = {};
    while (true)
    {
        bfs();
        if (D[t]==-1)
            break;
        I = vector<int>(n, 0);
        while (true)
        {
            T f = dfs(s, mx);
            if (f == T())
                break;
            flow += f;
        }
    }
    return flow;
}

int main()
{
    int N;
    cin>>N;
    vector<long long> a(N);
    for (long long &t: a)
        cin>>t;

    long long oo = 1000000000000LL;
    vector<vector<int>> E(N+2);
    vector<vector<long long>> C(N+2);
    for (int i=0; i<N; i++)
        if (a[i] > 0)
            E[N].push_back(i),
            C[N].push_back(a[i]);
        else
            E[i].push_back(N+1),
            C[i].push_back(-a[i]);
    for (int i=1; i<=N; i++)
        for (int j=i+i; j<=N; j+=i)
            E[j-1].push_back(i-1),
            C[j-1].push_back(oo);

    long long s = 0;
    for (long long t: a)
        if (t>0)
            s += t;
    cout<<s-maxflow(E, C, N, N+1)<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    bool A[n + 1] = {}, B[n + 1] = {};
    for(int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        if(a == 1) A[b] = true;
        if(b == n) B[a] = true;
    }
    bool ok = false;
    for(int i = 1; i <= n; i++)
    {
        if(A[i] && B[i]) ok = true;
    }
    cout << (ok ? "POSSIBLE" : "IMPOSSIBLE") << endl;
    return 0;
}



Measured memory_bytes: 640
a = input().split(" ")
N = eval(a[0])
M = eval(a[1])
b = input().split(" ")
hight_lst = list(map(eval, b))
lst = []
for i in range(N):
    lst.append(1)
for i in range(M):
    c = input().split(" ")
    c1 = eval(c[0]) - 1
    c2 = eval(c[1]) - 1
    if hight_lst[c1] > hight_lst[c2]:
        lst[c2] = 0
    elif hight_lst[c1] < hight_lst[c2]:
        lst[c1] = 0
    else:
        lst[c1] = 0
        lst[c2] = 0
count = 0
for i in lst:
    if i == 1:
        count += 1

print(count)

Measured memory_bytes: 20880
import sys

a, b, k = map(int, sys.stdin.readline().split())

def main():
    if k >= b - a + 1:
        res = list(range(a, b+1))
    else:
        res = set(range(a, a+k)) | set(range(b, b-k, -1))
        res = sorted(res)
    return res

if __name__ == '__main__':
    ans = main()
    print(*ans, sep='\n')

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

bool check(string s) {
    if(s[0] != 'A') return false;
    int C = 0;
    for (int i = 2; i < s.length() - 1; i++) {
      if (s[i] == 'C') C++;
    }
    if (C != 1) return false;
    int upper = 0;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] >= 'A' && s[i] <= 'Z') upper++;
    }
    if (upper != 2) return false;
    return true;
  }

int main() {
  string s;
  cin >> s;
  if(check(s)) {
    cout << "AC" << endl;
  } else {
    cout << "WA" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <cmath>
#include <map>
#include <set>
#include <assert.h>
#define REP(i,n) for(ll i=0;i<(n);i++)
#define MOD 1000000007
#define int long long
#ifdef int
const long long INF = LLONG_MAX / 10;
#else
const int INF = 1010101010;
#endif
using namespace std;
typedef long long ll;
typedef vector<vector<ll>> mat;
typedef pair<int, int> P;
//typedef pair<double, double> P;

int N;

signed main()
{
    cin >> N;

    for (int h=1; h<=3500; h++) {
        for (int n=1; n<=3500; n++) {
            if ((4*h*n - N*h - N*n) == 0) continue;
            if ((N*h*n) % (4*h*n - N*h - N*n) == 0) {
                int w = (N*h*n) / (4*h*n - N*h - N*n);
                if (w <= 0) continue;
                cout << h << " " << n << " " << w << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<vector<int>> v(N,vector<int>(N-1));
  for (int i=0;i<N;i++){
    for (int j=N-2;j>=0;j--){
      cin >> v[i][j];
      v[i][j]--;
    }
  }
  int ans=0,count=0;
  vector<bool> list2(N);
  while(true){
    vector<bool> list1(N,true);
    bool check=false;
    for (int i=0;i<N;i++){
      if (!list2[i]){
      if (list1[i]&&v[i].size()>0){
        int y=v[i].back();
        if (list1[y]&&v[y].size()>0){
          if (v[y].back()==i){
            v[i].pop_back();
            v[y].pop_back();
            list1[i]=false;
            list1[y]=false;
            check=true;
            count++;
          }
        }
      }
      }
    }
    if (check){
      ans++;
    }
    else {
      ans=-1;
      break;
    }
    if (count==N*(N-1)/2){
      break;
    }
    list2=list1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 6272
N = int(input())
src_list=sorted(list(map(int,input().split())))

cnt= 0
remaindar = list(map(lambda x:x % 2,src_list))
while (1 not in remaindar):
    src_list=list(map(lambda x:x/2,src_list))
    remaindar = list(map(lambda x:x % 2,src_list))
    cnt+=1

print(cnt)


Measured memory_bytes: 9108
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] input = new int[n];
		
		for (int i = 0; i < n; i++) {
			input[i] = sc.nextInt();
		}
		
		System.out.println(format(input));
		
		for (int i = 1; i < input.length; i++) {
			int v = input[i];
			int j = i - 1;
			while (j >= 0 && input[j] > v) {
				input[j + 1] = input[j];
				j--;
			}
			input[j + 1] = v;
			System.out.println(format(input));
		}
	}
	
	public static String format(int[] a) {
		return IntStream.of(a).mapToObj(n -> String.valueOf(n)).collect(Collectors.joining(" "));
	}
}

Measured memory_bytes: 33232
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

namespace Shi_Jian_Shi_Jian_Yan_Zhen_Li_De_Wei_Yi_Biao_Zhun____________________By_a_Believer
{
	typedef long long ll;
	const int N=72,M=2333,MOD=1000000007;
	inline void inc(int a,int &b){b=(a+b)%MOD;}
	inline ll inv(int x){return x==1?1:(-(MOD/x)*inv(MOD%x)%MOD);}

	int fact[M];
	int C[M][M];

	void initialize()
	{
		for(int i=0;i<M;i++)C[i][0]=1;
		for(int i=1;i<M;i++)
			for(int j=1;j<M;j++)
				C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;
		fact[0]=1;
		for(int i=1;i<M;i++)fact[i]=(ll)fact[i-1]*i%MOD;
	}

	char s[N];
	int n,m,ans;

#define ml(x) (std::max(1,((x)-1)*2-1))

	int f[N];

	bool check(int tot)
	{
		int cnt=0,ind=tot,dni=tot;

		for(int i=1;i<=m;i++)
			if(s[i]=='r')
			{
				if(ind)ind--;
				else cnt-=cnt>0;
			}
			else
			{
				if(dni && dni>ind && f[dni]>1)
				{
					cnt+=f[dni]-2;
					dni--;
				}
				else cnt-=cnt>0;
			}
		return !ind && (!dni || f[dni]==1) && !cnt;
	}

	int calc(int tot)
	{
		int ret=fact[tot],tmp=0,cnt=0,fk=0;
		for(int i=1;i<=tot;i++)
		{
			cnt+=ml(f[i]),fk+=f[i]*2-1;
			tmp++;
			if(i==tot || f[i]!=f[i+1])
				ret=(ll)ret*inv(fact[tmp])%MOD,tmp=0;
		}
		cnt+=tot?tot-1:0,fk+=tot+1;
		
		ret=((ll)ret*C[n-cnt+fk-1][fk-1]%MOD+MOD)%MOD;

//		printf("cnt = %d , fk = %d\n",n-cnt,fk);
//		printf("ret = %d\n",ret);

		return ret;
	}

	void dfs(int p=0,int x=1,int len=n)
	{
		
		if(check(p))inc(calc(p),ans);

		int &y=f[p+1];
		for(y=x;ml(y)<=len;y++)
			dfs(p+1,y,std::max(len-ml(y)-1,0));
	}

	void solve()
	{
		initialize();
		scanf("%d%d",&n,&m);
		scanf("%s",s+1);
		ans=0,dfs();
		printf("%d\n",ans);
	}
}

int main()
{
	Shi_Jian_Shi_Jian_Yan_Zhen_Li_De_Wei_Yi_Biao_Zhun____________________By_a_Believer::solve();
	return 0;
}


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

int main(){
    string t;
    cin >> t;

    string ans = t;

    /*for(int i = 0; i < ans.size(); i++){
        if(i >= 1 and ans[i] == '?' and ans[i-1] == 'P'){
            ans[i] = 'D';
        }
    }*/

    for(int i = 0; i < ans.size(); i++){
        if(ans[i] == '?'){
            ans[i] = 'D';
        }
    }

    //cout << "t " << t << endl;
    //cout << "ans " << ans << endl;
    cout << ans << endl;

    return 0;
}

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


int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++){
    cin >> a.at(i);
  }

  long double rev = 0;

  for(int i=0; i<n; i++){
    rev += 1/(long double)a.at(i);
  }

  cout << fixed << setprecision(10) << (1/rev) << endl;

  
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <array>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	string n; cin >> n;
	int dig_sum = 0;
	for (auto i : n) dig_sum += (i - '0');

	cout << ((dig_sum % 9 == 0) ? "Yes" : "No");

	return 0;
}

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

#define ll long long

using namespace std;

ll res;

int main()
{
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin >> n;
    res = (1 + n) * n / 2 - n;
    cout << res;
}


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

using namespace std;

typedef pair<int,int> P;
const int INF = numeric_limits<int>::max()/2;

int n;
vector<P> stmp;
vector<vector<int>> col(4,vector<int>(4));
vector<int> dis(1<<16,INF);

int solve(){
    queue<int> q;
    dis[0]=0;
    q.push(0);
    while(!q.empty()){
        int prev=q.front();q.pop();
        for(int i=0;i<n;i++){
            for(int j=0;j<=2;j++){
                // stamp[i] with color_j
                int h=stmp[i].first,w=stmp[i].second;
                for(int sx=1-h;sx<4;sx++){
                    for(int sy=1-w;sy<4;sy++){

                        int next=prev;
                        for(int ni=max(0,-sx);ni<min(h,4-sx);ni++){
                            for(int nj=max(0,-sy);nj<min(w,4-sy);nj++){
                                int nx=sx+ni,ny=sy+nj;
                                if(nx<0 || 4<=nx || ny<0 || 4<=ny) continue;
                                int num=15-4*nx-ny;
                                if(col[nx][ny]==j) next |= (1<< num);
                                else next &= ~(1<<num); 
                            }
                        }

                        if(dis[next]!=INF) continue;
                        dis[next]=dis[prev]+1;
                        if(next==((1<<16)-1)) return dis[next];
                        q.push(next);
                    }
                }
            }
        }
    }
    return -1;
}

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

    cin>>n;
    for(int i=0;i<n;i++){
        int h,w;cin>>h>>w;
        stmp.push_back(P(h,w));
    }
    for(int i=0;i<4;i++){
        string s;cin>>s;
        for(int j=0;j<4;j++){
            if(s[j]=='R') col[i][j]=0;
            else if(s[j]=='G') col[i][j]=1;
            else col[i][j] = 2;
        }
    }
    cout<<solve()<<endl;
}


Measured memory_bytes: 3468
#include <stdio.h>
 
int main()
{
    int n,i=1,x;
    scanf("%d",&n);
    while(i<=n){
        if(i%3==0){
            printf(" %d",i);
        }
        else{
            if(i%10==3){
                printf(" %d",i);
            }
            else{
                x=i;
                while(x){
                    if(x%10!=3){
                    x/=10;
                    }
                    else{
                        printf(" %d",i);
                        break;
                    }
                }
            }
        }
        i++;
    }
    printf("\n");
    return 0;
}


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

using namespace std;

#define ll long long
#define all(x) (x).begin(),(x).end()
#define desc greater<int>()

void solve(){
    int n;
    cin >> n;
    int arr[4];
    memset(arr,0,sizeof(arr));
    string s;
    getline(cin,s);
    for (int i=0;i<n;i++){
        getline(cin,s);
        if (s=="AC"){
            arr[0]++;
        }
        if (s=="WA"){
            arr[1]++;
        }
        if (s=="TLE"){
            arr[2]++;
        }
        if (s=="RE"){
            arr[3]++;
        }
    }
    cout << "AC x " << arr[0] << endl;
    cout << "WA x " << arr[1] << endl;
    cout << "TLE x " << arr[2] << endl;
    cout << "RE x " << arr[3] << endl;
}
int main()
{
/*
    string temp;
    int t;
    cin >> t;
    getline(cin, temp);
    while (t--){
        solve();
    }
*/
    solve();
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp(a, b) make_pair(a, b)
#define pb push_back


using namespace std;

int main() {

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

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

    cout<<max(M[n-1][0], max(M[n-1][1], M[n-1][2]));

    return 0;
}


Measured memory_bytes: 2560
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int X;
	double P;
	cin >> X >> P;
	if( P == 100 ){
		double ans = (X+1)/2;
		cout << ans << endl;
		return;
	}
	if( X <= 10 ){
		double p = P/100;
		double q = 1-p;
		if( X%2 == 0 ){//Xが偶数
			vector<double> dp(X+10,0);
			dp[0] = 0.0;//距離が0の時の期待値
			int now = 0;
			for(;now<X;now += 2 ){
				dp[now+2] = dp[now] + 1.0/p;
			}
			double ans = dp[X];
			cout << ans << endl;
			return;
		}else{//距離Xが奇数
			vector<double> dp(X+20,0);
			dp[0] = 0.0;
			int now = 0;
			for(;now<X+4; now += 2 ){
				dp[now+2] = dp[now] + 1.0/p;
			}
			double ans = dp[X-1]*p + dp[X+1]*q + 1.0;/////
			cout << ans << endl;
			return;
		}
		return;
	}
	if( X&1 ){//奇数
		double p = P/100;
		double q = 1-p;
		double cnt1 = (X-1)/2;
		double cnt2 = (X+1)/2;
		double res1 = (1.0/p) * cnt1;
		double res2 = (1.0/p) * cnt2; 
		double ans = res1 * p + res2 * q + 1.0;
		cout << ans << endl;
	}else{//偶数
		double p = P/100;
		double q = 1-p;
		double cnt = X/2;//cnt回pを引き当てる。
		//pを1回引くまでの、試行回数の期待値は1/p
		double ans = (1.0/p) * cnt;
		cout << ans << endl;
	}
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

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

typedef long long ll;
#define f first 
#define s second 
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
#define pb push_back
#define all(x) (x).begin(), (x).end()
typedef pair<int, int> Pii;
typedef vector<Pii> vpii;
#define rep(i,n) for(int i = 0; i < (n); ++i)

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }
template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}
template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.f << "," << P.s << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif


int a, b, c;
ll k;
int main()
{
	scanf("%d%d%d%lld", &a, &b, &c, &k);
	int res = 0;
	if(k % 2 == 0)
		res = a - b;
	else
		res = b - a;
	printf("%d\n", res);
}



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

int main() {
    string S;
    cin >> S;
    map<char, int> p;
    for(int i = 0; i < 4; i++) {
        p[S[i]] += 1;
    }

    for(int i = 0; i < 4; i++) {
        if(p[S[i]] == 1 || p[S[i]] == 3 || p[S[i]] == 4) {
            cout << "No";
            return 0;
        }
    }

    cout << "Yes";
    return 0;
}

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

int Fib(int);

int main( ){
  int i,n,k;
  int Fib[45];
  scanf("%d",&n);
  Fib[0] =Fib[1]=1;
  for(i=2;i<=n;i++){
    Fib[i]= Fib[i-1]+Fib[i-2];
  }
  printf("%d\n",Fib[n]);
  return 0;
}



Measured memory_bytes: 2112
#include <stdio.h>

int  main(void)
{
	int x,y,z,ans;
	
	scanf("%d%d%d",&x,&y,&z);
	
	int i=0;
	
	for(int i=0;y*i+z*(i+1)<=x;i++){
		
		ans=i;
		
	}
	
	printf("%d\n",ans);
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
long long getnum(long long n){
	if(n==1) return 1;
	else return 1+2*getnum(n/2);
}
int main(){
	long long h;
	cin>>h;
	cout<<getnum(h);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,K,length=0;
  cin>>N>>K;
  int l[N];
  for (int i = 0; i < N; i++) {
    cin>>l[i];
    length+=l[i];
  }
  sort(l,l+N);
  for (int i = 0; i < N-K; i++) {
    length-=l[i];
  }
  cout<<length;
}

Measured memory_bytes: 3552
num = [5,7,5,7,7]

acm _ [] = []
acm s (n:ns) = (s+n):acm (s+n) ns

a2 [] _ = True
a2 (n:ns) s =
  let a  = zip [1..] $ acm 0 s
      a' = dropWhile (\ (a,v) -> v < n) a
      (i,v) = a'!!0
  in
    if a' == []
    then False
    else if n == v
         then a2 ns $ drop i s
         else False

a1 idx s =
  if res
  then idx
  else a1 (idx+1) $ drop 1 s
  where
    res = a2 num s

ans ("0":_) = []
ans (n:x) =
  let n' = read n :: Int
      o  = a1 1 $ map length $ take n' x
      r  = drop n' x
  in
    o:ans r

main = do
  c <- getContents
  let i = lines c
      o = ans i
  mapM_ print o

Measured memory_bytes: 4204
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int a, b, c;

int abs(int x) {
  return x < 0 ? -x : x;
}

int main() {
  scanf("%d%d%d", &a, &b, &c);
  printf("%d\n", max(abs(a - b), max(abs(a - c), abs(b - c))));
  return 0;
}


Measured memory_bytes: 256
#include <set>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits>
#include <map>
#include <numeric>

#define ll long long
using namespace std;
static ll imin = std::numeric_limits<ll>::min();
static ll imax = std::numeric_limits<ll>::max();
#define rep(i, n) for(int i = 0; i<n; ++i)
#define rep1(i, n) for(int i = 1; i<n; ++i)
#define debug(x) cout << #x << ":" << x << "\n";
#define all(v) v.begin(), v.end()

template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec){
  std::size_t n = vec.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(int i = 0; i<n - 1; ++i){
    os << vec[i] << " ";
  }
  os << vec[n - 1];
  os << std::endl;
  return os;
}

#ifndef BOOST_TEST_MAIN
int main(int const argc, char const** argv){
  ll n;
  cin >> n;
  vector<ll> a(n + 2);
  a[0] = 0;
  a[n + 1] = 0;
  rep1(i, n + 1){
    cin >> a[i];
  }
  ll all = 0;
  rep(i, n + 1){
    all += abs(a[i + 1] - a[i]);
  }
  // debug(a);
  // debug(all);
  
  rep1(i, n + 1){
    // debug(a[i - 1]);
    // debug(a[i]);
    // debug(a[i + 1]);
    cout << all + abs(a[i + 1] - a[i - 1]) - (abs(a[i + 1] - a[i]) + abs(a[i] - a[i - 1])) << endl;
  }
}
#endif


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define repll(i,n) for(ll i = 0; i < n; i++)
#define REPll(i,n) for(ll i = 1; i < n; i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yesorno(a) printf(a ? "yes\n" : "no\n")
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define YESorNO(a) printf(a ? "YES\n" : "NO\n") 
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}


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

  int n, m;
  string s;
  cin >> n >> m >> s;
  reverse(all(s));
  int now = 0;
  vi ans;
  while(now != n){
    bool ok = false;
    for(int i = m; i >= 1; i--){
      int ne = now + i;
      if(ne > n) continue;
      if(s[ne] == '0'){
        ok = true;
        now = ne;
        ans.push_back(i);
        break;
      }
    }
    if(!ok){
      cout << -1 << endl;
      return 0;
    }
  }
  reverse(all(ans));
  for(int &x : ans) cout << x << " ";
  cout << endl;
  return 0;
}

Measured memory_bytes: 1096
S = input()

n = S.count('N')
s = S.count('S')
w = S.count('W')
e = S.count('E')
d = 0
if n > 0:
  d += 1
if s > 0:
  d -= 1
if w > 0:
  d += 2
if e > 0:
  d -= 2
  
if d == 0:
  ans = 'Yes'
else:
  ans = 'No'

print(ans)

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



#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       if(DEBUG){ cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int>> vvi;
typedef vector<ll>     vl;
typedef vector<vector<ll>> vvl;
const int infi = numeric_limits<int>::max();
const ll infl = numeric_limits<ll>::max();

const   double         eps = 0;
const   int            ms  = 0;
const bool DEBUG = 0;



int main(){
    int n;
    cin >> n;
    int ans = 0;
    vi a(n);
    rep(i,n)cin >> a[i];
    for(int i=1; i < n; i++){
        if(a[i-1]==a[i]){
            ans++;
            a[i] = -1;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int N, K, A[200010];
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> A[i];
  int num[N] = {0};
  for (int i = 0; i < N; i++) num[A[i] - 1]++;
  sort(num, num + N);
  int i = 0, sortNum = N, sum = 0;
  while(sortNum > K) {
    sortNum--;
    if (num[i]) {
      sum += num[i];
    }
    i++;
  }
  cout << sum << endl;
}

Measured memory_bytes: 1792
n = int(input())
a = [int(input()) for _ in range(n)]
b = [0] * n
ans = 0
c = 0
b[c] = 1
while True:
    c = a[c] - 1
    ans += 1
    if b[c] == 1:
        ans = -1
        break
    if c == 1:
        break
    b[c] = 1
print(ans)

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

int main(){
    string n;
    cin >> n;
    if(n.at(0)=='9'||n.at(1)=='9'){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}



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

int main(){
  
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;
  bool x = true;
  
  if( e-a>k || e-b>k || e-c>k || e-d>k || d-a>k || d-b>k || d-c>k || c-a>k || c-b>k || b-a>k ){
  
    x = false;
    
  }
  
  if( x ){
    
    cout << "Yay!" << endl;
    
  }
  
  else{
    
    cout << ":(" << endl;
    
  }
  
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;

int main() {

	int a, b, c;
	string ans;

	cin >> a >> b >> c;

	if (a == b && a != c) {
		ans = "Yes";
	}
	else if (a == c && a != b) {
		ans = "Yes";
	}
	else if (b == c && b != a) {
		ans = "Yes";
	}
	else {
		ans = "No";
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)
#define p(a, b) printf(a, b);
#define c(s) cout << (s) << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define cyn(c) cout << (c ? "Yes" : "No") << endl;
#define cYN(c) cout << (c ? "YES" : "NO") << endl;
#define pyn(c) printf("%s\n", c ? "Yes" : "No");
#define pYN(c) printf("%s\n", c ? "YES" : "NO");
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> P;
template <class T>
bool contain(const std::string &s, const T &v)
{
    return s.find(v) != std::string::npos;
}

int main()
{
    int n,k,ans=1; cin>>n>>k;
    rep(i,n-1)ans*=k-1;
    c(k*ans);
}


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

long long f[50] = {};
long long fib(long long n) {
  if (f[n] > 0) return f[n];
  if (f[n-1] == 0){
    f[n-1] = fib(n-1);
  }
  if (f[n-2] == 0){
    f[n-2] = fib(n-2);
  }
  f[n] = f[n-1] + f[n-2];
  return f[n];
}

void Main()
{
  f[0] = 1; f[1] = 1;
  long long n; cin >> n;
  cout << fib(n) << endl;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}



Measured memory_bytes: 3148
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <stdio.h>
#include <string.h>
using ll = long long;

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;


int N, M;
int X[100000];

using P = pair<int, int>;
vector<P> v;

bool flg[100000] = {};

signed main()
{
	cin >> N >> M;

	if (N >= M)
	{
		cout << 0 << endl;
		return 0;
	}

	REP(i, M)
	{
		cin >> X[i];
	}

	ARY_SORT(X, M);

	for (int i = 1; i < M; i++)
	{
		int len = X[i] - X[i - 1];
		P p;
		p.first = len;
		p.second = i;
		v.push_back(p);
	}

	RSORT(v);

	flg[0] = true;
	for (int i = 0; i < N - 1; i++)
	{
		flg[v[i].second] = true;
	}

	int sum = 0;
	for (int i = 1; i < M; i++)
	{
		if (flg[i])
		{
			continue;
		}

		int len = X[i] - X[i - 1];
		sum += len;
	}

	cout << sum << endl;
}









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

int main() {
  int N, X; cin >> N >> X;
  int m, min=1000;
  for(int i=0; i<N; i++){
    cin >> m; X-=m;
    if(min>m) min=m;
  }
  cout << N + (int)(X/min) << endl;
}

Measured memory_bytes: 256
N = int(input())
h = list(map(int, input().split()))
cost = [0 for _ in range(len(h))]
for i in range(1, len(h)):
    if i == 1:
        cost[i] = abs(h[i] - h[i-1])
        continue
    cost[i] = min(cost[i-1] + abs(h[i] - h[i-1]), cost[i-2] + abs(h[i] - h[i-2]))
print(cost[-1])

Measured memory_bytes: 13980
main = do
  s <- getLine
  putStrLn $ aux s

aux :: String -> String
aux str = (show h) ++ ":" ++ (show m) ++ ":" ++ (show s)
  where
    tm = read str :: Int
    s = tm `mod` 60 
    m = ((tm - s) `div` 60 ) `mod` 60
    h = (tm - s - 60*m) `div` 3600

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	bool ok = true;
	int n = s.size();
	for(int i = 0; i < n; i += 2){
		if(s[i] != 'R' && s[i] != 'U' && s[i] != 'D')ok = false;
	}
	for(int i = 1; i < n; i += 2){
		if(s[i] != 'L' && s[i] != 'U' && s[i] != 'D')ok = false;
	}
	if(ok)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;	
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define pb push_back
#define rng(x) x.begin(),x.end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<P> vp;

struct seg {
  int x2;
  vi d;
  vp e;
  seg() {}
  seg(int mx) {
    x2 = 1;
    while (x2 < mx) x2 <<= 1;
    d = vi(x2<<1);
    e = vp(x2<<1);
  }
  P f(P a, P b, int w) {
    if (a.fi == b.fi) {
      return P(a.fi,a.se+b.se);
    } else {
      a = max(a,b);
      a.se += w/2;
      return a;
    }
  }
  void add(int a, int b, int x, int i=1, int l=0, int r=-1) {
    if (r == -1) r = x2;
    if (a <= l && r <= b) {
      d[i] += x;
      e[i].fi += x;
      return;
    }
    int c = (l+r)>>1;
    int li = i<<1, ri = li|1;
    if (a < c) add(a,b,x,li,l,c);
    if (c < b) add(a,b,x,ri,c,r);
    e[i] = f(e[li],e[ri],r-l); e[i].fi += d[i];
  }
};

int main() {
  int n;
  scanf("%d",&n);
  vi a(n);
  rep(i,n) scanf("%d",&a[i]);
  int q;
  scanf("%d",&q);
  seg t(n+5);
  rep(i,n/2) {
    t.add(i,i+1,a[i]);
  }
  rep(i,n/2) {
    t.add(i,i+1,-a[n-1-i]);
  }
  rep(qi,q) {
    int l, r, x;
    scanf("%d%d%d",&l,&r,&x);
    --l;
    // cout<<qi<<" "<<l<<" "<<r<<" "<<x<<endl;
    if (l < n/2) {
      int a = l, b = min(r,n/2);
      // cout<<a<<" "<<b<<endl;
      t.add(a,b,x);
    }
    if (r >= n/2) {
      int a = n-max(l,n/2), b = n-r;
      // cout<<a<<" "<<b<<endl;
      t.add(b,a,-x);
    }
    if (t.e[1].se) printf("%d\n",0);
    else printf("%d\n",1);
  }
  return 0;
}

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

using namespace std;

vector<int64_t> cache;

int64_t recur(int64_t h) {
  if (h == 1) return 1;
  return 2 * recur(h / 2) + 1;
}

void solve() {
  int64_t h;
  cin >> h;
  // cache.resize(h + 1, INT_MAX);
  cout << recur(h) << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
}


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

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

    Graph G(N);
    for (int i = 0; i < M; ++i)
    {
        int a, b;
        cin >> a >> b;
        G.at(a-1).push_back(b-1);
        G.at(b-1).push_back(a-1);
    }

    vector<int> dist(N, -1),pre(N, -1);
    queue<int> que;

    dist.at(0) = 0;
    que.push(0);

    while (!que.empty())
    {
        int v = que.front();
        que.pop();

        for (int nv : G.at(v))
        {
            if (dist.at(nv) != -1)
                continue;

            dist.at(nv) = dist.at(v) + 1;
            pre.at(nv)=v;
            que.push(nv);
        }
    }
    
    if (find(dist.begin(), dist.end(), -1) == dist.end())
    {
        cout << "Yes" << endl;
        rep(i,N){
            if(i==0)continue;
            int ans=pre.at(i)+1;
            cout << ans << endl;
        }
    }
    else
    {
        cout << "No" << endl;
    }
}


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

int main(){
    string s;
    cin>>s;
    cout<<s.substr(0,3)<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define int long long
int n;
int dp[3001][3001][2];
vector<int> data;
// int check( int start, int last, int  counter)
// {


//     int mul;
//     mul = (counter ? 1 : -1);
//     if (dp[start][last][counter] != -1) return dp[start][last][counter];
//     if (start == last) return data[start] * mul;

//     int v1 = data[start] * mul  + check(start + 1, last, !counter);
//     int v2 = data[last] * mul  + check(start, last - 1, !counter);
//     cout << v1 << " " << v2 << "\n";
//     return counter ? (dp[start][last][counter] = (max(v1, v2) % mod)) : ( dp[start][last][counter] = (min(v1, v2) % mod));


// }
int change(int k)
{
    if (k)return 0;
    return 1;
}
int check(int i, int j, int k)
{
    if (i == j)return (k == 1) ? -data[j] : data[j];
    if (dp[i][j][k] != -1)return dp[i][j][k];
    int value = 1;
    if (k == 1)value *= -1;
    int x = data[i] * value + check(i + 1, j, change(k));
    int y = data[j] * value + check(i, j - 1, change(k));
    if (k)
        return dp[i][j][k] = min(x, y);
    return dp[i][j][k] = max(x, y);
}
void findAns()
{


    cin >> n;
    data.resize(n);
    for (int i = 0; i < n; i++) cin >> data[i];

    int counter  = 0;
    memset(dp, -1, sizeof(dp));
    cout << check(0, n - 1, counter);


    // cout << value;
    return;




}
int32_t main()
{
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif

    FAST;

    // ll int t;
    // cin >> t;
    // while (t--)
    findAns();

    return 0;
}

Measured memory_bytes: 141184
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.OptionalInt;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = in.nextIntArray(n);
            int max = Arrays.stream(a).max().getAsInt();
            int best = -1;
            for (int i : a) {
                if (i != max && Math.abs(2 * i - max) < Math.abs(2 * best - max)) {
                    best = i;
                }
            }
            out.println(max + " " + best);
        }

    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

        public int[] nextIntArray(int n) {
            int[] ret = new int[n];
            for (int i = 0; i < n; i++) {
                ret[i] = nextInt();
            }
            return ret;
        }

    }
}



Measured memory_bytes: 37972
#include <bits/stdc++.h>
using namespace std;
int hinata(int x){
  if(x==0) return 1;
  else return x*hinata(x-1);
}
int main() {
  int a,b;
  a=1;
  b=1;
  int N;
  cin>>N;
  vector<int>P(N);
  vector<int>Q(N);
  for(int i=0;i<N;i++) cin>>P[i];
  for(int i=0;i<N;i++) cin>>Q[i];
  for(int i=0;i<N;i++){
    int x=P[i];
    int y=Q[i];
    int x_=x;
    int y_=y;
    for(int j=0;j<i;j++){
      if(x_>P[j]) x--;
      if(y_>Q[j]) y--;
    }  
    a+=(x-1)*hinata(N-1-i);
    b+=(y-1)*hinata(N-1-i);
  }
  cout<<abs(a-b)<<endl;
}


Measured memory_bytes: 256
use std::io;
use std::str::FromStr;
use std::cmp::max;

struct Item {
    weight: u64,
    value: u64
}

fn input_tuple() -> (u64, u64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<u64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

fn main() {
    let (n, w) = input_tuple();
    let mut items: Vec<Item> = Vec::new();
    for _ in 0..n {
        let (w, v) = input_tuple();
        items.push(Item {weight: w, value: v});
    }

    let mut dp: Vec<Vec<u64>> = vec![vec![0; (w + 1) as usize]; (n + 1) as usize];
    for i in (0..n as usize).rev() {
        for j in 0..(w+1) as usize {
            if items[i].weight > j as u64 {
                dp[i][j] = dp[i+1][j]
            } else {
                dp[i][j] = max(dp[i+1][j], dp[i+1][j - items[i].weight as usize] + items[i].value);
            }
        }
    }
    // for i in 0..(n+1) as usize {
    //     for j in 0..(w+1) as usize {
    //         print!("{}\t", dp[i][j]);
    //     }
    //     println!();
    // }
    println!("{}", dp[0][w as usize]);
}


Measured memory_bytes: 106748