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

namespace AtCoder
{
    class Program
    {

        static void Main()
        {
            IO io = new IO();

            //ここから

            int[] str = io.ReadLineToIntArray();
            int n = str[0];
            int x = str[1];
            int[] a = io.ReadLineToIntArray();

            int ans = 0;

            a = a.OrderBy(A => A).ToArray();
            for(int i = 0; i < n; i++)
            {
                if (x >= a[i])
                {
                    x -= a[i];
                    ans++;
                }
                else
                {
                    x -= a[i];
                    break;
                }
            }
            if (x > 0 && ans>0)
            {
                ans--;
            }


            //ここまで
            Console.Write(ans);
            Console.ReadKey();
        }
    }

    //関数
    public class Func
    {
        public void Swap<T>(ref T a,ref T b)
        {
            T temp;
            temp = a;
            a = b;
            b = temp;
        }
    }

    //IOを担う関数群
    public class IO
    {
        //stringの入力
        public string ReadLineToString()
        {
            return Console.ReadLine();
        }

        //intの入力
        public int ReadLineToInt()
        {
            return int.Parse(Console.ReadLine());
        }

        //空白区切りの複数の文字列の入力をstring[]にして返す
        public string[] ReadLineToStringArray()
        {
            return Console.ReadLine().Split(' ').ToArray();
        }


        //空白区切りの複数の整数の入力をint[]にして返す
        public int[] ReadLineToIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        //空白区切りの複数の文字列の入力をList<string>で受け取る
        public List<string> ReadLineToStringList()
        {
            return Console.ReadLine().Split(' ').ToList();
        }

        //空白区切りの複数の整数の入力をList<int>で受け取る
        public List<int> ReadLineToIntList()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToList();
        }
    }

}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
string s;
int a[100005],len;
int box[100005];
int qu[100005];
int tp;

int main(){
	cin>>s;len=s.length();
	for(int i=0;i<s.length();i++){
		if(s[i]=='L') a[i+1]=-1;
		else a[i+1]=1;
	}
	qu[1]=1;tp=1;
	for(int i=2;i<=len;i++){
		if(qu[tp]>0 && a[i]==1) qu[tp]++;
		else if(qu[tp]>0 && a[i]==-1) qu[++tp]=-1;
		else if(qu[tp]<0 && a[i]==-1) qu[tp]--;
		else if(qu[tp]<0 && a[i]==1) qu[++tp]=1;
	}
	int sum;
	for(int i=1;i<=tp;i+=2){
		sum-=qu[i-1];
		sum+=qu[i];
		box[sum]=ceil(qu[i]*0.5)+floor((-qu[i+1])*0.5);
		box[sum+1]=floor(qu[i]*0.5)+ceil((-qu[i+1])*0.5);
	}
	for(int i=1;i<=len;i++){
		cout<<box[i]<<' ';
	}
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<map>
#include<unordered_map>
#include<queue>
#include<deque>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

bool isPrime(ll n){
    if(n == 2)return true;
    if(n == 1 || n == 0)return false;
    ll sq = sqrt(n) + 1;
    ll tmp = n; 
    for(int i = 2; i <= sq; i++){
        sq = sqrt(tmp) + 1;
        while(tmp%i == 0)tmp/=i;
    }
    if(tmp == n)return  true;
    return false;
}

int main(){
    ll q;
    cin >> q;
    ll l[q], r[q];
    rep(i, q)cin >> l[i] >> r[i];

    ll mem[100010] = {};
    for(ll i = 1; i < 100001; i+=2){
        mem[i] = mem[i-1];
        if(isPrime(i) && isPrime((i+1)/2))mem[i]++;
        mem[i+1] = mem[i];
    }

    rep(i, q){
        cout << mem[r[i]] - mem[l[i]-1] << endl;
    }

}

Measured memory_bytes: 2944
#include <stdio.h>

int main() {
    long long int a, b, c, k, s = 0;
    scanf("%lld %lld %lld %lld", &a, &b, &c, &k);
    a <= k ? (k -= a, s += a) : (s += k, k = 0);
    b <= k ? (k -= b) : (k = 0);
    printf("%lld", s - k);
    return 0;
}


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

#define all(x) x.begin(), x.end()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MN = 1e5 + 5, LN = 17, INF = 0x3f3f3f3f, MOD = 1e9 + 7;

int N, A, x[52];
ll dp[2][52][2502];

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    cin >> N >> A;
    int sum = 0;
    for (int i = 1; i <= N; i++) {
        cin >> x[i];
    }
    dp[0][0][0] = 1;
    for (int i = 1; i <= N; i++) {
        int c = i & 1, p = (i - 1) & 1;
        for (int j = 0; j <= i; j++) {
            for (int k = 0; k <= 2500; k++) {
                dp[c][j][k] = dp[p][j][k];
                if (k >= x[i] && j > 0) dp[c][j][k] += dp[p][j - 1][k - x[i]];
            }
        }
    }
    ll ret = 0;
    for (int i = 1; i <= 50; i++) ret += dp[(N & 1)][i][i * A];
    cout << ret << '\n';
    return 0;
}


Measured memory_bytes: 2304
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <tuple>

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define co(x) cout << (x) << "\n"
#define ll long long
#define pb push_back
#define Never
#define To

using namespace std;

int main(){

	cin.tie(0);
	ios::sync_with_stdio(false);

	map<string, int> m;

	int N, M;

	cin >> N;

	for(int i = 0; i < N; i++){
		string v;
		cin >> v;
		if(m.count(v) == 0){
			m[v] = 1;
		} else {
			m[v]++;
		}
	}

	cin >> M;

	for(int i = 0; i < M; i++){
		string v;
		cin >> v;
		if(m.count(v) == 0){
			m[v] = -1;
		} else {
			m[v]--;
		}
	}

	int ans = 0;
	for(auto itr = m.begin(); itr != m.end(); itr++){
		ans = max(ans, itr->second);
	}

	cout << ans << endl;

	Never To return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD (1000000007LL)

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

ll fact(int n){
    if(n==0) return 1;
    ll res = 1;
    for(int i=1;i<=n;i++){
        res = (res * i) % MOD;
    }
    return res;
}

ll comb(int n, int r){
    ll bo = 1;
    ll si = 1;
    for(int i=0; i<r; i++){
        bo = (bo * (i+1)) % MOD;
        si = (si * (n-i)) % MOD;
    }
    return (si * ppow(bo, MOD - 2)) % MOD;
}

int main(void){
    int x,y;
    cin >> x >> y;
    if((x+y)%3){
        cout << 0 << endl;
        return 0;
    }
    int a = (2*x-y)/3;
    int b = (2*y-x)/3;
    if(a<0 || b<0){
        cout << 0 << endl;
        return 0;
    }
    cout << comb(a+b,a) << endl;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        a: char
    }

    if 'a' <= a && a <= 'z' {
        println!("a");
    } else {
        println!("A");
    }
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVSORT(v) sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  int n;cin>>n;
  int maxCount = 0;
  int count = 0;
  int mae = 0;
  REP(i,n){
    int h;cin>>h;
    if(i==0){
      count = 0;
      mae = h;
    }else if(mae>=h){
      count++;
      mae = h;
    }else{
      maxCount = max(maxCount,count);
      count = 0;
      mae = h;
    }
  }
  maxCount = max(maxCount,count);
  cout<<maxCount<<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++)
using ll = long long;
using P = pair<int,int>;
const long long inf = 1000000001; // const 書き換え禁止
const double PI = 3.14159265358979323846; //M_PI はライブラリ

int main(void){
    int a,b,t;
    cin >> a >> b >>t;
    int ans = t/a * b;
    cout << ans << endl;
}

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

int main(void)
{
    while (1){
        int n;
        scanf("%d", &n);
        if (!n) break;
        int num[13] = {0};
        int prev[13] = {0};
        int ans = 0;
        for (int i = 0; i < n; i++){
            scanf("%d", &num[i]);
        }
        while (1){
            ans++;
            for (int i = 0; i < n; i++){
                prev[i] = 0;
                for (int j = 0; j < n; j++){
                    if (num[i] == num[j]){
                        prev[i]++;
                    }
                }
            }
/*            printf("%d\n", ans);
            for (int i = 0; i < n; i++){
                printf("%d", prev[i]);
                ((i + 1) == n) ? printf("\n") : printf(" ");
            }*/
            
            bool flag = true;
            for (int i = 0; i < n; i++){
                if (num[i] != prev[i]) flag = false;
            }
            if (flag) break;
            
            for (int i = 0; i < n; i++){
                num[i] = prev[i];
            }
        }
        printf("%d\n", ans - 1);
        for (int i = 0; i < n; i++){
            printf("%d", num[i]);
            ((i + 1) == n) ? printf("\n") : printf(" ");
        }
    }
    
    return (0);
}

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

int main(void){
	int n;
	cin >> n;
	vector<int> a;
	a.resize(n);
	bool flag = false;
	for(int i = 0; i < n; ++i){
		cin >> a[i];
		if(a[i] % 2 == 1) flag = true;
	}
	if(flag){
		cout << "first" << endl;
	}else{
		cout << "second" << endl;
	}
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
#include <math.h>
#include <stdlib.h>
int main()
{
    char a[100005];
    scanf("%s",a);
    int i,len=strlen(a);
    char b[100005],c[100005];
    for(i=0;i<len;i++)
    {
        if(i&1)
        {b[i]='0';c[i]='1';}
        else
         {b[i]='1';c[i]='0';}
    }
    b[i]=0;c[i]=0;
    int num1=0,num2=0;
    for(i=0;i<len;i++)
    {
        if(a[i]!=b[i])
            num1++;
        if(a[i]!=c[i])
            num2++;
    }
    printf("%d\n",num1>num2?num2:num1);
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n;
    string a,b,c;
    cin>>n>>a>>b>>c;
    int ans=0;
    for(int i=0;i<n;i++){
        if(a[i]!=b[i]&&b[i]!=c[i]&&c[i]!=a[i])ans+=2;
        else if(a[i]==b[i]&&b[i]==c[i]&&c[i]==a[i]);
        else ans++;
    }
    cout<<ans<<endl;
}


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

using namespace std;

int main()
{
    int n,m;cin>>n>>m;bool is = false;
    int total = 0,count=  0;
    vector<int>arr;
    while(n--){
        int x; cin>>x;total+=x;
        arr.push_back(x);
        
    }
    double me = (1.0/(4.0*m))*total;
    for(int i = 0;i<arr.size();i++){
        if(arr[i]>=me){
            count++;
        }
        if(count>=m){
            is = true;
            break;
        }
    }
    if(is)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


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


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


def main():
    N, M = readnums()
    ml = make_divisors(M)
    print(max([x for x in ml if x <= M // N]))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
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 (b<a) {a=b; return 1;} return 0;}

vector<int> enum_div(int n) {
    vector<int> result;
    for (int i = 1; i*i <= n; i++) {
        if (n % i == 0) {
            result.push_back(i);
            if (i*i != n) {
                result.push_back(n/i);
            }
        }
    }
    return result;
}

int main(){
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i += 2) {
        auto div = enum_div(i);
        if (div.size() == 8) ans++;
    }
    cout << ans << endl;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    string s;cin>>s;
    cout<<s[0]<<s[1]<<s[2]<<endl;
}

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

using namespace std;

#define mp make_pair
#define pb push_back

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> iill;
inline void add(int& a, const int& b, const int& modulo) {
	a += b;
	if (a > modulo) a -= modulo;
}
inline int mul(const int& a, const int& b, const int& modulo) {	return int((1LL * a * b) % (1LL * modulo)); }

const int N = 1e5 + 3;
const ll oo = 1e18;
ll s[N], t[N];
int A, B, Q;

void solve() {
	scanf("%d%d%d", &A, &B, &Q);
	for (int i = 1; i <= A; ++i)
		scanf("%lld", &s[i]);
	for (int i = 1; i <= B; ++i)
		scanf("%lld", &t[i]);
	s[0] = t[0] = -oo;
	s[A + 1] = +oo;
	t[B + 1] = +oo;
	while (Q--) {
		ll x;
		scanf("%lld", &x);
		int si, ti;
		si = lower_bound(s + 1, s + A + 1, x) - s;
		ti = lower_bound(t + 1, t + B + 1, x) - t;
		ll ans = oo;
		for (int i = si - 1; i <= si; ++i)
			for (int j = ti - 1; j <= ti; ++j)
				ans = min(ans, abs(s[i] - t[j]) + min(abs(s[i] - x), abs(t[j] - x)));
		printf("%lld\n", ans);	
	}	
}

int main(int argc, char* argv[]) {
	if (argc >= 2) {
		freopen("in", "r", stdin);
		freopen("out", "w", stdout);
	}
	solve();
	return 0;
}


Measured memory_bytes: 2816
n=int(input())
a=list(map(int,input().split()))
c=[0]*8
sums=0
sai=0
for i in a:
    if i<3200:
        c[i//400]=1
    else:
        sai+=1
sums=sum(c)
print(max(1,sums),sums+sai)

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

int main() {
	unsigned long long int N, X, T, x; cin >> N >> X >> T;
	if (N % X == 0) {
		x = N / X;
	}
	else {
		x = (N / X) + 1;
	}
	cout << (x * T) << endl;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define INF 0xfffffffff
typedef long long ll;

using namespace std;

int n, w, wt[100], val[100], ans;
ll dp[101][100001];

int main()
{
  for(int i = 0; i<101; i++)
    for(int j = 0; j<100001; j++)
      dp[i][j] = INF;
  cin >> n >> w;
  for(int i = 0; i<n; i++)
    cin >> wt[i] >> val[i];
  dp[0][0] = 0;
  for(int i = 0; i<n; i++)
    for(int j = 0; j<=100000; j++)
    {
      dp[i+1][j] = min(dp[i+1][j],dp[i][j]);
      if(j+val[i]<=100000)
        dp[i+1][j+val[i]] = min(dp[i+1][j+val[i]],dp[i][j]+wt[i]);
      if(dp[i+1][j]<=w)
        ans = max(ans,j);
    }
  cout << ans << endl;
}


Measured memory_bytes: 79104
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	int a[3][3];
	bool map[105];
	memset(map,0,sizeof(map));
	for(int i=0;i<3;i++)
		for(int j=0;j<3;j++)
			cin>>a[i][j];
	int n;
	cin>>n;
	int b[n];
	for(int i=0;i<n;i++)
	{
		cin>>b[i];
		map[b[i]]=1;	
	}
	if(n<3)
	{
		cout<<"No\n";
		return 0;
	}
	int ans=0;
	for(int i=0;i<3;i++)
	{
		int q1=1,q2=1,q3=1,q4=1;
		for(int j=0;j<3;j++)
		{
			if(!map[a[i][j]])
				q1=0;
			if(!map[a[j][i]])
			    q2=0;
			if(!map[a[j][j]])
			    q3=0;
			if(!map[a[j][2-j]])
			    q4=0;
		}
		if(q1||q2||q3||q4)
		{
			ans=1;
			cout<<"Yes\n";
			break;
		}
	}
	if(!ans)
	cout<<"No\n";
	return 0;
}

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

using namespace std;
int main(){
    int n,k;
    string s;
    cin>>n>>k>>s;
    
    
    
   if(s.at(k-1)=='A'){
       s.at(k-1)='a';
   }
   else if(s.at(k-1)=='B'){
       s.at(k-1)='b';
   }
   else {
       s.at(k-1)='c';
   }
   cout<<s<<endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
ll a,b;
ll gcd(ll x,ll y)
{
	if(y==0) return x;
	return gcd(y,x%y);
}
int main()
{
	scanf("%lld%lld",&a,&b);
	printf("%lld",a*b/gcd(a,b));
	return 0;
}

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

int main(){
    double a, b;
    cin >> a >> b;
    int ans = -1;
    for (double k = 10 * b; k < 10 * b + 10; k++){
        if (25 * a / 2 <= k && k < 25 * a / 2 + 25 / 2){
            ans = k;
            break;
        }
    }
    cout << ans << endl;
}

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

int main() {
  string s;
  while(getline(cin,s)) {
    stringstream ss;
    int w,x;
    vector<int> v;
    ss << s;
    ss >> w;
    while(ss >> x) v.push_back(x);
    int n=v.size();
    double dp[1<<n][n];
    for(int i=0; i<(1<<n); i++)for(int j=0;j<n;j++)dp[i][j]=1<<30;
    for(int i=0; i<n; i++) dp[1<<i][i]=v[i];
    for(int t=1; t<(1<<n); t++) {
      for(int i=0; i<n; i++) {
        if(dp[t][i]==1<<30) continue;
        for(int j=0; j<n; j++) {
          if(t&(1<<j)) continue;
          dp[t|(1<<j)][j]=min(dp[t|(1<<j)][j],dp[t][i]+sqrt((v[i]+v[j])*(v[i]+v[j])-(v[i]-v[j])*(v[i]-v[j])));
        }
      }
    }
    double ans=1<<30;
    for(int i=0; i<n; i++) ans=min(ans,dp[(1<<n)-1][i]+v[i]);
    if(ans<=w) cout << "OK" << endl;
    else cout << "NA" << endl;
  }
  return 0;
}


Measured memory_bytes: 3476
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0; }
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
ll nod(ll F) { return log10(F) + 1; }
//**定義場所**//
//gcd, isPrime, eratos, modinv, bitSearch, dfs, bfs, dijkstra, UnionFind//
ll i, j, k, l, m, n; ll N, M, K, H, W, L; string S, T;
ll MOD = 1000000007; ll ans = 0; ll INF = 9999999999999;
vl flag, color; vll path;
//***********//
int main() {
	cin >> N;
	vl A(N);
	for (i = 0; i < N; i++) {
		cin >> A[i];
	}
	ll now = 1;
	for (i = 0; i < N; i++) {
		if (A[i] == now) {
			now++;
		}
		else {
			ans++;
		}
	}
	if (now == 1) {
		cout << -1;
	}
	else {
		cout << ans;
	}
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int ans;
char a;
int main()
{
    for(int i=0;i<4;i++)
    {
    	cin>>a;
    	if(a=='2')
    	{
    		ans++;
		}
	} 
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
program main
  implicit double precision (a-h, o-z)
  read(*, *) i, j
  k = ibits(i, 0, 1) * ibits(j, 0, 1)
  if (k == 0) then
    write(*, *) "Even"
  else
    write(*, *) "Odd"
  endif
  stop
end program main


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

int main()
{
    string s;
    cin >> s;
    int a, z;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == 'A')
        {
            a = i;
            break;
        }
    }
    for (int i = s.size() - 1; i > 0; i--)
    {
        if (s[i] == 'Z')
        {
            z = i;
            break;
        }
    }
    cout << z - a + 1;
}

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

typedef long long ll;
constexpr ll MOD = ll(1e9+7);

ll dp[200005][2][2];

int main(){
    string s, t;
    cin >> s >> t;
    int n = s.size();
    dp[0][0][1] = 1;
    for(int i=0;i<n;i++){
        int sd = s[i]-'0';
        if(t[i]=='?'){
            for(int j=0;j<2;j++){
                for(int d=0;d<=(j?9:sd);d++){
                    dp[i+1][j||(sd>d)][0] += dp[i][j][0] * 10 + dp[i][j][1] * d;
                    dp[i+1][j||(sd>d)][0] %= MOD;
                    dp[i+1][j||(sd>d)][1] += dp[i][j][1];
                    dp[i+1][j||(sd>d)][1] %= MOD;
                }
            }
        }
        else{
            int td = t[i]-'0';
            for(int j=0;j<2;j++){
                if(sd < td &&j == 0) continue;
                dp[i+1][j||(sd>td)][0] += dp[i][j][0] * 10 + dp[i][j][1] * td;
                dp[i+1][j||(sd>td)][0] %= MOD;
                dp[i+1][j||(sd>td)][1] += dp[i][j][1];
                dp[i+1][j||(sd>td)][1] %= MOD;
            
            }
        }
    }
    ll ans = 0;
    ans = (dp[n][1][0] + dp[n][0][0]) % MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9720
# 解説 https://betrue12.hateblo.jp/entry/2019/03/17/011847
# from collections import defaultdict

mod = 10 ** 9 + 7

N = int(input())
C = [int(input()) for _ in range(N)]
# L = [-1] * (N + 10)  # 出たところ
# dp = [-1] * (N + 10)
# dp[0] = 1
L  = [-1] * (2*10**5 + 10)
dp = [-1] * (2*10**5 + 10)
dp[0] = 1
 

for i in range(N):
    if L[C[i]] == -1:
        dp[i + 1] = dp[i]
    elif C[i] == C[i - 1]:
        dp[i + 1] = dp[i]
    else:
        dp[i + 1] = dp[i] + dp[L[C[i]]]
    
    dp[i + 1] %= mod
    L[C[i]] = i + 1

print(dp[N])


Measured memory_bytes: 91244
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
ll n,W;
V<P>dat;
V<P> top,back;
void make_top(int now,ll wei,ll val){
    if(now==(n+1)/2){
        if(wei<=W)top.emplace_back(wei,val);
        return ;
    }
    make_top(now+1,wei+dat[now].fi,val+dat[now].se);
    make_top(now+1,wei,val);
}
void make_back(int now,ll wei,ll val){
    if(now==n){
        if(wei<=W)back.emplace_back(wei,val);
        return ;
    }
    make_back(now+1,wei+dat[now].fi,val+dat[now].se);
    make_back(now+1,wei,val);
}
int main(){
    cin>>n>>W;
    dat.resize(n);
    for(int i=0;i<n;i++)cin>>dat[i].se>>dat[i].fi;
    sort(all(dat));
    make_top(0,0,0);
    make_back((n+1)/2,0,0);
    sort(all(top));
    sort(all(back));
   V<ll> ma(back.size(),0);
   ma[0]=back[0].se;
   for(int i=1;i<back.size();i++){
       ma[i]=max(ma[i-1],back[i].se);
   }
   ll ans=0;
   for(int i=0;i<top.size();i++){
       int ind=upper_bound(all(back),P(W-top[i].fi,inf))-back.begin();
       ind--;
       chmax(ans,top[i].se+ma[ind]);
   }
   cout<<ans<<"\n";
}


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

int main()
{
	int n, k;
	cin >> n >> k;

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

	sort(array, array+n);
	int answer = 0;
	int index = n-1;
	while(k--)
	{
		answer += array[index];
		index--;
	}

	cout << answer;

	return 0;
}

Measured memory_bytes: 256
s=gets.chomp
q=gets.to_i
pre,suf="",""
rev=false
q.times{
a=gets.split
if a[0].to_i==1
pre,suf=suf,pre
rev=!rev
elsif a[1].to_i==1
pre<<a[2]
else
suf<<a[2]
end
}
puts pre.reverse+(rev ? s.reverse : s)+suf

Measured memory_bytes: 3196
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#

"""
agc014 B
"""

from collections import Counter
n, m = map(int, input().split())

cnt = Counter()
for i in range(m):
    a, b = map(int, input().split())
    cnt[a] += 1
    cnt[b] += 1

for a in range(1, n+1):
    if cnt[a] % 2 == 1:
        print('NO')
        exit()

print('YES')


Measured memory_bytes: 9448
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>

using namespace std;

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


int main(){
    int k, a, b;
    cin >> k >> a >> b;
    for (int i = 1; i * k <= b; i++){
        if(i * k >= a){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}


Measured memory_bytes: 3596
def main(c,S):
    count=0
    while S.count(c)!=len(S):
        T=""
        count+=1
        for i in range(len(S)-1):
            if c in [S[i],S[i+1]]:
                T+=c
            else:
                T+=S[i]
        S=T
    return(count)


S=input()
lst=[chr(i) for i in range(ord("a"),ord("z")+1) if chr(i) in S]
print(min([main(i,S) for i in lst]))


Measured memory_bytes: 40812
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N >> M;
	vector< int > A(N);
	rep(i, N) cin >> A[i];
	int s = 0;
	rep(i, N) s += A[i];
	int tmp = 0;
	rep(i, N) if (A[i] * 4 * M >= s) tmp++;
	if (tmp >= M)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
def m():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0
    B = [a[i-1]-i for i in range(1, n+1)]
    B.sort()
    b = B[n//2]
    for i in range(n):
        ans += abs(B[i]-b)
    return ans

print(m())

Measured memory_bytes: 25200
#include <bits/stdc++.h>
#define  ll      long long 
#define  int     ll 
#define  mod     1000000007
#define  pb      push_back
#define  pob     pop_back
#define  f1      first
#define  s2      second
#define  N       3003
#define  K       100005
#define  bol     (int)ceil((say-1)/2.0)
#define  PII     pair<int,int>
#define  PIII    pair<int,PII>
#define  PIIII   pair<PII,PII>
#define  PIIIII  pair<PIII,PII>
#define  PIIIIII pair<PIII,PIII>

using namespace std; 

char s[N];
int n;


int dp[N][N],pre[N][N];


int32_t main(){
    // freopen("a.gir","r",stdin);      
    // freopen("a.cik","w",stdout);
    scanf("%lld\n",&n);
    scanf("%s",s+2);

    dp[1][1]=1;
    for(int i=1;i<=n;i++){
        pre[1][i]=1;
    }

    for(int i=2;i<=n;i++){
        for(int j=1;j<=(i);j++){
            if(s[i]=='<'){
                dp[i][j]=pre[i-1][j-1];     
            }
            else if(s[i]=='>'){
                dp[i][j]=pre[i-1][i-1]-pre[i-1][j-1];
            }
            pre[i][j]=(pre[i][j-1]+dp[i][j])%mod;
        }
    }
    printf("%lld\n", (((pre[n][n])%mod)+mod)%mod);
}


Measured memory_bytes: 139520
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  char c;
  cin >> c;
  if('a'<=c && c<='z'){
    cout << 'a';
  }else{
    cout <<'A';
  }
}

Measured memory_bytes: 3588
import java.io.*;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		int left_ingredient = Arrays.stream(stdin.readLine().split(" ")).mapToInt(Integer::parseInt).toArray()[1];
		int[] need_ingredient = stdin.lines().mapToInt(Integer::parseInt).toArray();
		int min = Arrays.stream(need_ingredient).min().getAsInt();
		int count = 0;
		for(int gram : need_ingredient) {
			left_ingredient -= gram;
			count++;
		}
		count += Math.floor(left_ingredient/min);
		System.out.println(count);
	}
}

Measured memory_bytes: 30164
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os << "[ "; 
  for(auto v:V)os << v << " "; return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){ os << "{ "; 
  for(auto s:S) os<<s<<" ";  return os<<"}"; 
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
  return os<<"("<<P.first<<","<< P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
  os<<"{ ";for(auto m:M)os<<"("<<m.first<<":"<<m.second<<")";
  return os<<"}";
}
#define cerr cout
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
//For multiset use less_equal operator but it does support erase operations for multiset
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define I insert 
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define all(v) (v).begin(),(v).end()
#define For(i,n) for(int i=0;i<(int)n;++i)
#define Rev(i,n) for(int i=(int)n-1;i>=0;--i)
#define Rep(i,n) for(int i=1;i<=(int)n;++i)
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mp make_pair
// inline void modadd(int &a,int &b){a+=b;if(a>=mod)a-=mod;} 
const int N = 3e5 + 100;
set<int> row[N];
set<int> col[N];
int freqcol[N];
int freqrow[N];


int main(){
  fio; cout<<fixed<<setprecision(25);	
  int h , w, m ; cin >> h >> w >> m;
  set<pii> s;
  int u , v;
  for(int i = 1;i <= m ; ++i){
    cin >> u >> v;
    s.insert(mp(u , v));
    freqrow[u]++;
    freqcol[v]++;
    if(freqrow[u] != 1) row[freqrow[u]-1].erase(u);
    row[freqrow[u]].insert(u);
    if(freqcol[v] != 1) col[freqcol[v]-1].erase(v);
    col[freqcol[v]].insert(v);
  }

  int x = N-1 , y = N-1;
  while(row[x].size() == 0) --x;
  while(col[y].size() == 0) --y;

  if( (row[x].size()*1ll*col[y].size()) >= 10*N){
    cout << x + y << endl; 
  }
  else{
    for(auto it : row[x]){
      for(auto it1 : col[y]){
        if(s.find(mp(it , it1)) == s.end()){
          cout << x + y << endl;
          return 0;
        }
      }
    }
    cout << x+y-1 << endl;
  }
  return 0; 
}


Measured memory_bytes: 76288
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = (int)1e9 + 7;

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

    int n;
    string s;
    cin >> n >> s;

    int num1 = 0, num2 = 0;
    REP(i, n){
        if(s[i] == '('){
            num2++;
        }else{
            if(num2 == 0){
                num1++;
            }else{
                num2--;
            }
        }
    }
    REP(i, num1) cout << '(';
    cout << s;
    REP(i, num2) cout << ')';
    cout << endl;
}

Measured memory_bytes: 256
s = input()
n = len(s)
Ccnt = 0
def end():
  print('WA')
  exit(0)
  return 
for i in range(n):
  if i == 0:
    if s[i] != 'A':end()
  else:
    if s[i].isupper():
      if 2<=i<n-1 and s[i] == 'C':Ccnt += 1
      else:end()
if Ccnt != 1:end()
print('AC')
     

Measured memory_bytes: 3060
#include <stdio.h>
#define NIL -1
#define N 27

typedef struct data{
  int p,l,r;
}DATA;
DATA T[N];

void Preorder(int );
void Inorder(int );
void Postorder(int );

int main(){
  int i;
  int n;
  int id,left,right,root;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p = NIL;
  }

  for(i=0;i<n;i++){
    scanf("%d %d %d",&id ,&left, &right);
    T[id].l = left;
    T[id].r = right;
    if( left != NIL )T[left].p = id;
    if( right != NIL )T[right].p = id;
  }

  for(i=0;i<n;i++){
    if(T[i].p == NIL ) root = i;
  }

  printf("Preorder\n");
  Preorder(root);
  printf("\n");
  
  printf("Inorder\n");
  Inorder(root);
  printf("\n");
 
  printf("Postorder\n");
  Postorder(root);
  printf("\n");
  
  return 0;
}

void Preorder(int u){
  if(u == NIL)return;
  
  printf(" %d",u);
  Preorder(T[u].l);
  Preorder(T[u].r);
}

void Inorder(int u){
  if(u == NIL)return;
 
  Inorder(T[u].l);
  printf(" %d",u);
  Inorder(T[u].r);
}
void Postorder(int u){
  if(u == NIL)return;
   
  Postorder(T[u].l);
  Postorder(T[u].r);
  printf(" %d",u);
}



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

using namespace std;
#define inf 1000000000
#define unvisited -1
#define visited 1
#define eps 1e-9
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define uint64 unsigned long long
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define debug if(true)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

int main(){
	int n,i,j;
	scanf("%d",&n);
	int a[] = {599, 799, 999, 1199, 1399, 1599, 1799, 1999};
	int ans = 8;
	for(i=0;i<8;i++){
		if(n <= a[i]){
			break;
		}
		ans--;
	}
	printf("%d\n",ans);
	
	return 0;
};

Measured memory_bytes: 3816
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
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; }

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

int main(){
    int n;
    cin >> n;
    vector<int> x(n), y(n), h(n);
    rep(i,n) cin >> x[i] >> y[i] >> h[i];
    rep(cx, 101) rep(cy, 101){
        bool ok = true;
        int ans = -1;
        rep(i,n){
            if (h[i] == 0) continue;
            int H = h[i] + abs(cx - x[i]) + abs(cy - y[i]);
            if (ans == -1){
                ans = H;
            }else{
                if (ans != H){
                    ok = false;
                    break;
                }
            }
        }
        if (!ok) continue;
        rep(i,n){
            if (h[i] != 0) continue;
            int dist = abs(cx - x[i]) + abs(cy - y[i]);
            if (ans > dist){
                ok = false;
                break;
            }
        }
        if (!ok) continue;
        printf("%d %d %d\n", cx, cy, ans);
    }
}

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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  cin >> N;
  int A[100001], B[100001];
  rep(i, N) cin >> A[i] >> B[i];

  int ans = 0;
  for(int i = N-1; i >= 0; i--) {
    if((A[i]+ans)%B[i] != 0) {
      ans += B[i] - (A[i]+ans)%B[i];
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
int main(){
    bool check = true;
    while(check){
        int H,W;
        cin >> H >> W;
        if(H*W != 0){
            rep(i,H){
                rep(j,W){
                    if((i+j)%2 == 0){
                        cout << '#';
                    }
                    else{
                        cout << '.';
                    }
                }
                cout << endl;
            }
            cout << endl;
        }
        else{
            check = false;
        }
    }
}


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

int n, a[1000];
double v;
int main()
{
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    sort(a, a + n);
    v = a[0];
    for (int i = 1; i < n; ++i)
        v = ((double)a[i] + v) / 2.0;
    cout << v << endl;
    return 0;
}


Measured memory_bytes: 256
X = list(input())
if len(X)<=2:
    print(0)
    exit()
con = X[len(X)-2:len(X)]
kak = X[0:len(X)-2]
kak = int("".join(kak))
con = int("".join(con))
if con>=5:
    imp1 = con//5
    imp2 = con%5
else:
    imp1 = 1
    imp2 = 0
#print(kak, imp1, imp2)
if kak>=imp1+imp2:
    print(1)
else:
    print(0)

Measured memory_bytes: 3064
--https://www.lua.org/pil/11.4.html
local List = {}
function List.new ()
  return {first = 0, last = -1}
end

function List.pushleft (list, value)
  local first = list.first - 1
  list.first = first
  list[first] = value
end

function List.pushright (list, value)
  local last = list.last + 1
  list.last = last
  list[last] = value
end

function List.popleft (list)
  local first = list.first
  if first > list.last then return false end
  local value = list[first]
  list[first] = nil
  list.first = first + 1
  return value
end

function List.popright (list)
  local last = list.last
  if list.first > last then return false end
  local value = list[last]
  list[last] = nil
  list.last = last - 1
  return value
end

----------

local h,w=io.read("n","n","l")
local maze={}
local shounter=0
for i=1,h do
    local s=io.read()
    maze[i]={}
    for j=1,w do
        local sub=s:sub(j,j)
        if sub=="#" then
            shounter=shounter+1
        end
        maze[i][j]=sub
    end
end

local dx={1,0,-1,0}
local dy={0,1,0,-1}

local function bfs(x,y)
    local dist={}
    for i=1,h do
        dist[i]={}
        for j=1,w do
            dist[i][j]=-1
        end
    end
    local que=List.new()
    
    List.pushright(que,{x,y})
    dist[x][y]=1

    while x~=h and y~=w do
        local q=List.popleft(que)
        if not q then break end
        local x,y=q[1],q[2]
        for i=1,4 do
            local nx,ny=x+dx[i],y+dy[i]
            local checker=(nx<1 or nx>h or ny<1 or ny>w)
            if not checker and maze[nx][ny]~="#" and dist[nx][ny]==-1 then
                dist[nx][ny]=dist[x][y]+1
                List.pushright(que,{nx,ny})
            end
        end
    end
    
    return dist[h][w]
end

if bfs(1,1)>-1 then
    print(h*w-(bfs(1,1)+shounter))
else
    print(-1)
end

Measured memory_bytes: 3196
s = str(input())
m = abs(753-int(s[0])*100-int(s[1])*10-int(s[2]))
for i in range(1,len(s)-2):
  a = int(s[i])*100+int(s[i+1])*10+int(s[i+2])
  m = min(m,abs(753-a))
  
print(m)
  


Measured memory_bytes: 3060
#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>

#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<tuple>
#include<utility>
#define rep(i,n) for(ll i=0; i<n; i++)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  vi x(5);
  int k;
  rep(i,5){
    cin >> x[i];
  }
  cin >> k;
  rep(i,5){
    for(int j = i; j < 5; j++){
      if(x[j]-x[i] > k){
        cout << ":(";
        return 0;
      }
    }
  }
  cout << "Yay!";
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
int main(){
	long long n,m,sum;
	while(~scanf("%ld%ld",&n,&m)){
		sum=1;
		for(int i=1;i<=m;i++){
			sum=sum*2;
		}
		printf("%ld\n",(1900*m+100*(n-m))*sum);
	}
}

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

#define ll long long
#define fr(n) for(ll i=0;i<n;i++)
#define frr(n) for(ll i=n-1;i>=0;i--)
#define nl printf("\n")
#define sc(n) scanf("%lld",&n)
#define pr(n) printf("%lld",n)
#define pb push_back
#define debug(arr,n) for(int i=0; i<n; i++) printf("%lld ", arr[i])
#define debugr(arr,s,e) for(int i=s; i<=e; i++) printf("%lld ", arr[i])



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

	ll n,q;
    cin>>n>>q;
    vector<stack<int>>vec(n);
    while(q--){
        ll a,t,x;
        cin>>a;
        if(a==0){
            cin>>t>>x;
            vec[t].push(x);
        }
        else if(a==1){
            cin>>t;
            if(!vec[t].empty()){
                    cout<<vec[t].top();nl;
            }
        }
        else{
            cin>>t;
            if(!vec[t].empty()){
            	vec[t].pop();
	        }
        }
    }
    return 0;
}


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



void solve(){
  int x,y,z,k;
  cin >> x >> y >> z >> k;
  vector<long> a,b,c;
  rep(i,x){
    long tmp;
    cin >> tmp;
    a.emplace_back(tmp); 
  }
  rep(i,y){
    long tmp;
    cin >> tmp;
    b.emplace_back(tmp); 
  }
  rep(i,z){
    long tmp;
    cin >> tmp;
    c.emplace_back(tmp); 
  }
  
  vector<long> ab;
  rep(i,x){
    rep(j,y){
      ab.emplace_back(a[i]+b[j]); 
    }
  }
  sort(ab.begin(), ab.end(), greater<long>());
  while(ab.size()>k){
    ab.pop_back();  
  }
  int siz = ab.size();
  
  vector<long> abc;
   rep(i,siz){
    rep(j,z){
      abc.emplace_back(ab[i]+c[j]); 
    }
  }
  sort(abc.begin(), abc.end(), greater<long>());
  while(abc.size()>k){
    abc.pop_back();  
  }
  rep(i,k){
    cout << abc[i] << endl; 
  }
  

}

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


Measured memory_bytes: 43256
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
int main() {

std::vector<int> ans;
	int n=1,x=1,cnt=0;

    std::vector<int> vn,vx;
    
while(true){

	cnt=0;
    	
    cin>>n>>x;
    if (n==0&&x==0)
    {
    	break;
    }

    for (int i = 1; i <=n ; ++i)
    {
    	for (int j = i+1; j <=n; ++j)
    	{
    		for (int k = j+1; k <= n; ++k)
    		{
    			if(i+j+k==x){cnt++;}
    		}
    	}
    }

    ans.push_back(cnt);

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


return 0;
}



Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;


template<typename F>
struct FixPoint : F{
  FixPoint(F&& f):F(forward<F>(f)){}
  template<typename... Args>
  decltype(auto) operator()(Args&&... args) const{
    return F::operator()(*this,forward<Args>(args)...);
  }
};
template<typename F>
inline decltype(auto) MFP(F&& f){
  return FixPoint<F>{forward<F>(f)};
}

//INSERT ABOVE HERE
signed main(){
  int n,k;
  cin>>n>>k;
  vector<int> as(n);
  for(int i=0;i<n;i++) cin>>as[i],as[i]--;

  vector< vector<int> > G(n);
  for(int i=1;i<n;i++)
    G[as[i]].emplace_back(i);

  int ans=as[0]!=0;
  MFP([&](auto dfs,int v,int p)->int{
        int res=1;
        for(int u:G[v])
          chmax(res,dfs(u,v)+1);

        if(res==k&&p>0){
          ans++;
          res=0;
        }

        return res;
      })(0,-1);

  cout<<ans<<endl;
  return 0;
}


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

int main()
{
 char c;
 cin>>c;

   if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'){
       cout<<"vowel"<<endl;
    }else
    {
     cout<<"consonant"<<endl;
    }
    return 0;
}

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


int main(){
	int a,b,c;
	cin >> a >> b >> c;
	
	cout << a*b/2 << endl;
	return 0;
}

Measured memory_bytes: 256