akhauriyash/Code-Regression huggingface dataset:
#![allow(unused)]

use std::io::{Read, StdinLock};
use std::iter::{FromIterator, Iterator};
use std::str::{FromStr};
use std::string::String;

macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

pub fn read_bytes<T: FromIterator<char>>(s: &mut StdinLock) -> T {
    s.bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<T>()
}

pub fn reads(s: &mut StdinLock) -> String {
    read_bytes::<String>(s)
}

pub fn read<T: FromStr>(s: &mut StdinLock) -> T {
    reads(s).parse().ok().unwrap()
}

//==============================================================================
//
// Problem specific code
//
//==============================================================================

fn main() {
    let sin = std::io::stdin();
    let mut sin = sin.lock();

    let x: i64 = read(&mut sin);
    let y: i64 = read(&mut sin);
    let z: i64 = read(&mut sin);

    println!("{} {} {}", z, x, y);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define F first
#define S second
#define eb emplace_back
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b);
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c);
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
// Iterator
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n";
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define state tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define M 1000000007
#define Z 505  //check the limits, man
#define N 100001
#define PI 3.14159265
const ll INF = 1e12;
vi v,ar;
int check(ll m,int n,ll k)
{
    int i=0;
    ll a,b,c;
    while(k>=0 && i<n)
    {
        a=v[i],b=ar[i];
        if(a*b<=m)
            i++;
        else
        {
            c=(m/a);
            if(k>=(b-c))
                k-=(b-c),i++;
            else
                k=-1;
        }
    }
    return (i==n);
}
int main()
{
    int n,i;
    ll l,r,m,k;
    in(n);
    llin(k);
    v.resize(n);
    ar.resize(n);
    read(ar,i,n);
    read(v,i,n);
    sort(all(v));
    sort(all(ar));
    reverse(all(v));
    l=0,r=INF;
    while(l<r)
    {
        m=(l+r)>>1;
        if(check(m,n,k))
            r=m;
        else
            l=m+1;
    }
    llout(l);
}









Measured memory_bytes: 1920
///AJoy Sarker ,CSE JAHANGIRNAGAR UNIVERSITY 48 Batch
#include<bits/stdc++.h>
using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define inf INT_MAX/3
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 3.141592653589793
#define in scanf
#define out printf
#define ll long long
#define ull unsigned long long
#define w(x) int x;cin>>x;while(x--)
#define fast ios_base::sync_with_stdio(0)
#define FOR(i,a,b) for( int i=(a),_b=(b);i<=_b;i++)
#define DOW(i,b,a) for( int i=(b),_a=(a);i>=_a;i--)
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}
#define N 20000009
bool prime[N];
vector<ll> prm;
void seive ()
{

    memset(prime, true, sizeof(prime));

    for( ll i=2; i*i<=N; i++)
    {
        if (prime[i] == true)
        {
            prm.pb(i);
            for (ll j=i*i; j<=N; j += i)
                prime[j] = false;
        }
    }
}
void pr (int f)
{
    if(f==1)
        cout<<"Yes\n";
    else
        cout<<"No\n";
}
int main()
{
    fast;
    ll n;
    cin>>n;
    cout<<(n*(n-1))/2<<endl;
    return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <map>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
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 (b<a) { a=b; return 1; } return 0; }

int main(){
    int h1,m1,h2,m2,K;
    cin >> h1 >> m1>>h2>>m2>>K;
    int w=h1*60+m1;
    int n=h2*60+m2;
    int ans=n-w-K;
    if(ans<0) cout << 0 <<endl;
    else cout <<ans<<endl;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long
#define endl "\n"
#define print_array(name,n) for(ll o=0;o<n;o++) cout<<name[o]<<" "
#define fr(i,f,t) for(ll i=(f);i<t;i++)
#define fb(i,f,t) for(ll i=(f);i>=t;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 2e18
bool sortbysecond(const pair<int,int> &a,const pair<int,int> &b){
	return (a.ss>b.ss);
}
template <typename T>
string NumberTostring(T Number )
{
	ostringstream ss;
	ss<<Number;
	return ss.str();
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int s,w;
    cin>>s>>w;
    if(w>=s){
    	cout<<"unsafe"<<endl;
    }
    else{
    	cout<<"safe"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define rep(i , a , b) for(int i = a ; i <= b ; i ++)
#define per(i , n , a) for(int i = n ; i >= a ; i --)
#define debug(x) cout << #x << " : " << x << endl;
#define debug2(x , y) cout << #x << " : " << x << "	 " << #y << " : " << endl;
#define debug3(x , y , z) cout << #x << " : " << x << "	 " << #y << " : " << y << "  " << #z << " : " << z << endl;
#define int long long
const int N = 2e5 + 10;
char s[N];
int sum[N][3] , a[N];
signed main()
{
	ios::sync_with_stdio(false);
	int n ;
	cin >> n >> s + 1 ;
	memset(a , - 1 , sizeof(a));
	rep(i , 1 , n)
	{
		if(s[i] == 'R') a[i] = 0;
		else if(s[i] == 'G') a[i] = 1;
		else a[i] = 2;
	}
	per(i , n , 1)
	{
		rep(j , 0 , 2)
		sum[i][j] = sum[i + 1][j];
		sum[i][a[i]] ++ ;
	}
	int ans = 0;
	rep(i , 1 , n)
	{
		rep(j , i + 1 , n - 1)
		{
			if(a[j] != a[i])
			{
				int dis = j - i;
				if(a[i] == 0 && a[j] == 1)
					ans += sum[j + 1][2];	
				else if(a[i] == 0 && a[j] == 2)
					ans += sum[j + 1][1];
				else if(a[i] == 1 && a[j] == 0)
					ans += sum[j + 1][2];
				else if(a[i] == 1 && a[j] == 2)
					ans += sum[j + 1][0];
				else if(a[i] == 2 && a[j] == 1)
					ans += sum[j + 1][0];
				else if(a[i] == 2 && a[j] == 0)
					ans += sum[j + 1][1];
				if(j + dis <= n)
				{
					if(a[j + dis] != a[j] && a[j + dis] != a[i])
					ans -- ;
				}
				
			}
		}
	}
	cout << ans << '\n' ; 
	return 0;
}

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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  
  int count = 0;
  for (int i=1; i<=N; i++){
    int t = i % 10 + (i/10)%10 + ((i/10)/10)%10 +((i/10)/10)/10%10 +i/10/10/10/10;
    if(A<=t && t<=B){
  		count +=i;
    }
  }
  cout << count << endl;
}


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

#define MAX 102

int n;
vector<int> t;
vector<int> v;


struct st {
	double lef;
	double rig;
	double hi;
};

vector<st> vv;

struct line {
	double A;
	double N;
	line(double A_, double N_) {
		A = A_;
		N = N_;
	}
	double get(double x) {
		return A*x + N;
	}
};
pair<double, double> intersect(line a, line b) {  // fraction{first/second}
	return make_pair(a.N - b.N, b.A - a.A);
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a;
		scanf("%d", &a);
		t.push_back(a);
	}
	for (int i = 0; i < n; i++) {
		int a;
		scanf("%d", &a);
		v.push_back(a);
	}
	double S = 0;
	vv.push_back({ 0,0,0 });
	for (int i = 0; i < v.size(); i++) {
		vv.push_back({ S,S + t[i],(double)(v[i]) });
		S += t[i];
	}
	vv.push_back({ S,S,0 });
	bool update = true;
	while (update) {
		update = false;
		vector<int> er;
		for (int i = 0; i < vv.size(); i++) {
			for (int j = 0; j < vv.size(); j++) {
				if (i == j)continue;
				if (j < i) {
					double L = vv[j].rig;
					double R = vv[i].lef;
					double val = vv[j].hi + R - L;
					if (val >= vv[i].hi) {
						continue;
					}
					update = true;
					double val2 = vv[j].hi + vv[i].rig - L;
					if (val2 < vv[i].hi) {
						vv[i].lef = vv[i].rig;
						vv[i].hi = val2;
						break;
					}
					double X = vv[i].hi - vv[j].hi + vv[j].rig;
					vv[i].lef = X;
					continue;
				}
				double L = vv[i].rig;
				double R = vv[j].lef;
				double sa = vv[i].hi - vv[j].hi;
				double val = vv[j].lef - vv[i].rig+vv[j].hi;
				if (val >= vv[i].hi) {
					continue;
				}
				update = true;
				double val2 = vv[j].hi + vv[j].lef - vv[i].lef;
				if (val2 < vv[i].hi) {
					vv[i].rig = vv[i].lef;
					vv[i].hi = val2;
					break;
				}
				double X = R - sa;
				vv[i].rig = X;
				continue;
			}
		}
	}
	double ar = 0;
	for (int i = 0; i < vv.size(); i++) {
		ar += vv[i].hi*(vv[i].rig - vv[i].lef);
		if (i + 1 < vv.size()) {
			line lineA = line(1, vv[i].hi - vv[i].rig);
			line lineB = line(-1, vv[i+1].hi + vv[i+1].lef);
			pair<long long int, long long int> p = intersect(lineA, lineB);
			double ich = p.first;
			ich /= (double)(p.second);
			double hi = lineA.get(ich);
			ar += (vv[i].hi + hi) / 2.0*(ich - vv[i].rig);
			ar += (vv[i + 1].hi + hi) / 2.0*(vv[i+1].lef - ich);
		}
	}
	printf("%.16f\n", ar);
	return 0;
}

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

int n, p;
string s;

void solve(int TestCase) {
    cin >> n >> p;    
    cin >> s;
    
    if(p == 2 || p == 5) {
        long long ret = 0;
        for(auto i = 0; i < n; ++i)
        {
            if((s[i] - '0') % p == 0)
                ret += i+1;
        }

        cout << ret << endl;
        return;
    }

    auto A = vector<long long>(n);
    long long t = 1;
    for(auto i = n-1; i >= 0; --i)
    {
        A[i] = t * (s[i] - '0') % p;
        t = t * 10 % p;
    }

    auto M = map<long long, long long>{};
    M[0]++;
    
    auto B = vector<long long>(A.size() + 1);
    for(auto i = 1; i < B.size(); ++i) {
        B[i] = (B[i-1] + A[i-1]) % p;
        M[B[i]]++;
    }

    long long ret = 0;
    for(auto& x : M)
        ret += x.second * (x.second - 1) / 2;

    cout << ret << endl;
}
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 
    int t = 1;
    //cin >> t;
    for(auto i = 1; i <= t; ++i) {
    //    cout << "Case #"<< i << ": ";
        solve(i);
    }
}

Measured memory_bytes: 4244
h,n = map(int,input().split())
dp = [[float("inf")]*(h+10001) for i in range(n+1)]
dp[0][0]=0

for i in range(n):
    a,b= map(int,input().split())

    for j in range(h+10001):
        dp[i+1][j] = min(dp[i][j],dp[i+1][j-a]+b)
ans = float("inf")
for i in range(h,h+10001):
    ans = min(ans,dp[n][i])

print(ans)


Measured memory_bytes: 565384
a,b,c = map(int,input().split())

def max(a,b):
    if a > b:
        return a
    else:
        return b

def min(a,b):
    if a < b :
        return a
    else:
        return b

if min(a,b) < c < max(a,b):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
using vi=vector<int>;
int main(){
  int n,m;
  cin>>n>>m;
  vector<vi> r(n);
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    a--; b--;
    r[a].push_back(b);
    r[b].push_back(a);
  }
  queue<int> q;
  vi dist(n,-1);
  vi fro(n,-1);
  dist[0]=0;
  q.push(0);
  while(!q.empty()){
    int v=q.front();
    q.pop();
    for(int i : r[v]){
      if(dist[i]!=-1){
        continue;
      }
      dist[i]=dist[v]+1;
      fro[i]=v;
      q.push(i);
    }
  }
  cout<<"Yes"<<endl;
  for(int i=1;i<n;i++){
    cout<<(fro[i]+1)<<"\n";
  }
}

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

int main() {
  int n;
  cin >> n;
  int cnt = 0, y = 0;
  while (cnt < n) {
    y++;
    cnt += y;
  }
  // cerr << cnt << " " << y << endl;
  rep(i, y) {
    if (cnt - n == i + 1) continue;
    cout << i + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 3604
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			int a = sc.nextInt();
			int b = sc.nextInt();

			int c = a + b;

			int l = 0;

			while (c != 0) {
				++l;
				c /= 10;
			}

			System.out.println(l);
		}
	}

}

Measured memory_bytes: 18604
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(INF)
#define INF 1e17
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

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

int fpow(int b,int p)
{
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n; cin>>n;
	string s;
	map<string,int> mp;
	For(i,1,n){
		cin>>s;
		sort(all(s));
		mp[s]++;
	}
	int ans=0;
	for(auto &i:mp){
		ans+=i.S*(i.S-1)/2;
		//cout<<i.F<<" "<<i.S<<"\n";
	}
	cout<<ans<<"\n";
	return 0;
}




























Measured memory_bytes: 11264
S = input()
if "N" in S and "S" in S:
    if ("W" in S and "E" in S) or ("W" not in S and "E" not in S):
        print("Yes")
    else:
        print("No")
elif "N" in S or "S" in S:
    print("No")
else:
    if "W" in S and "E" in S:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int K = s.nextInt();
        int d[] = new int[K];
        int A[] = new int[N];

        for (int i = 0; i < K; i++) {
            d[i] = s.nextInt();
            for (int j = 0; j < d[i]; j++) {
                int num = s.nextInt();
                A[num - 1] = 1;
            }
        }

        int count = 0;
        for (int i = 0; i < N; i++) {
            if (!(A[i] == 1)) {
                count++;
            }
        }
        System.out.println(count);

        s.close();
    }
}

Measured memory_bytes: 46172
//
//  main.cpp
//  競技20190629

#include <iostream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
#define ll long long int

int br(){
    printf("\n");
    return 0;
}
ll combi(int n, int k) {
    if (n == k || k == 0)
        return 1;
    else {
        return combi(n - 1, k - 1) + combi(n - 1, k);
    }
}
int gcd(int a,int b){//最大公約数
    if(b==0){
        return a;
    }else{
        return gcd(b,a%b);
    }
}


//sort(a,a+100,greater<int>());大きい順
//sort(a,a+100);小さい順
/*
 int N;
 cin >> N;
 vector<int> d(N);
 int i = 0;
 int n = N;
 while(n--){
 cin >> d[i];
 i++;
 }
 
 sort(d.begin(),d.end());
 d.erase( unique(d.begin(),d.end()), d.end());隣り合った重複を削除し、き消し多分要素数を詰める
 cout<<d.size()<<endl;
 return 0;
*/

int X(){
    string s;
    cin >> s;
    size_t size = s.length();
    
    string ans;
    
    for(int i=0;i<size;i++){
        if(i%2==0){
            ans = ans+s[i];
            
        }
    }
    cout << ans << endl;
    
    return 0;
}

int Ap(){
    string s;
    cin >> s;
    if(s[0]==s[1] && s[1]==s[2] && s[2]==s[3]){return printf("No\n");}
    if(s[0]==s[1] && s[2]==s[3]){return printf("Yes\n");}
     if(s[0]==s[2] && s[1]==s[3]){return printf("Yes\n");}
     if(s[0]==s[3] && s[1]==s[2]){return printf("Yes\n");}
  return printf("No\n");
}

int mymid(int a,int b,int c){
    if(a>=b && b>=c )return b;
    if(a<=b && b<=c )return b;
    return -1;
}

int Bp(){
    int N;
    cin >> N;
    int p[N];
    for(int i=0;i<N;i++){cin >> p[i];}
    int ans=0;
    for(int i=1;i<N-1;i++){
        if(mymid(p[i-1],p[i],p[i+1])==p[i])ans++;
    }
    printf("%d\n",ans);
    return 0;
}




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


Measured memory_bytes: 256
//package com.company;
import java.util.*;
import java.lang.*;
import java.io.*;
//****Use Integer Wrapper Class for Arrays.sort()****
public class Main {
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    public static void main(String[] Args)throws Exception{
        FastReader scan=new FastReader(System.in);
        int t=1;
//        t=scan.nextInt();
        while(t-->0){
            int n=scan.nextInt();
            int[] arr=new int[n];
            for(int i=0;i<n;i++){
                arr[i]=scan.nextInt();
            }
            int ans=0;
            for(int i=0;i<n;i++){
                for(int j=i+1;j<n;j++){
                    for(int k=j+1;k<n;k++){
                        if(arr[i]!=arr[j]&&arr[j]!=arr[k]&&arr[i]!=arr[k]) {
                            if (arr[i] + arr[j] > arr[k] && arr[j] + arr[k] > arr[i] && arr[i] + arr[k] > arr[j]) {
                                ans++;
                            }
                        }
                    }
                }
            }
            out.println(ans);
        }
        out.flush();
        out.close();
    }
    static class FastReader {

        byte[] buf = new byte[2048];
        int index, total;
        InputStream in;

        FastReader(InputStream is) {
            in = is;
        }

        int scan() throws IOException {
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) {
                    return -1;
                }
            }
            return buf[index++];
        }

        String next() throws IOException {
            int c;
            for (c = scan(); c <= 32; c = scan()) ;
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = scan()) {
                sb.append((char) c);
            }
            return sb.toString();
        }

        int nextInt() throws IOException {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan()) ;
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
        long nextLong() throws IOException {
            int c;
            long val = 0;
            for (c = scan(); c <= 32; c = scan()) ;
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
    }
}


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

ll f(ll x){
  if (x == 1) return 1;
  return f(x/2)*2+1;
}

int main(){
  ll h;
  cin >> h;
  cout << f(h) << endl;
  return 0;
  }

Measured memory_bytes: 256
#include<stdio.h>

int main(){

    int H,N,a,sum = 0;
    scanf("%d %d",&H,&N);

    for (int i =0;i < N;i++){
        scanf ("%d",&a);
        sum += a;
        if (sum >=  H){
            printf("Yes");
            return 0;
        }
    }
    puts("No");
    return 0;
}

Measured memory_bytes: 128
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define FAST            ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll              long long
#define ld              long double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define mii             map<int,int>
#define vi              vector<int>
#define vll             vector<long long>
#define all(a)          (a).begin(),(a).end()
#define clz(a)          __builtin_clz(a) // count leading zeroes
#define ctz(a)          __builtin_ctz(a) // count trailing zeroes
#define popc(a)         __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define lul             1000000007
#define rep(i,a,b)      for(int i=a;i<b;i++)
#define rfor(i,a,b)     for(int i=a; i>=b; i--)
#define debug(x)        cerr << #x << " = " << x << endl;
#define F               first
#define S               second
#define mod             998244353 
#define pll             pair<ll,ll>
#define endl            '\n'
#define deci(n)         cout<<fixed<<setprecision(n)
#define ordered_set     tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key(k)
// find_by_order(k)
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;
#define N    100005

void solve()
{
    int n; cin>>n; 
    string s; cin>>s;
    unordered_map<char,int> ma;
    vll dist(n+1,0);
    vector<vll> dp(n+1,vll(10,0));
    vll ans(10,0);
    rep(i,1,n+1)
    {
        if(ma.count(s[i-1]))
        {
            dist[i] = dist[i-1];
            continue;
        }
        dist[i] = dist[i-1] + 1;
        ma[s[i-1]]++;
    }
    rep(i,2,n+1)
    {
        rep(j,0,10) dp[i][j] = dp[i-1][j];
        dp[i][s[i-1]-'0'] = dist[i-1];
    }
    rep(i,3,n+1)
    {
        ans[s[i-1]-'0']=0;
        rep(j,0,10)
        {
            ans[s[i-1]-'0']+=dp[i-1][j];
        }
    }
    rep(i,1,10) ans[i]+=ans[i-1];
    cout<<ans[9];
}
int main()
{   
    FAST;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; t=1;  //cin>>t;
    while(t--){
       solve();
    }
    return 0;
}

Measured memory_bytes: 4096
// J'aime
// Chemise Blanche

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl

void MAIN() {
  int n; cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (to_string(i).size() % 2) ans++;
  }
  cout << ans << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3724
N, M = map(int, input().split())
AC = set()
wa = [0] * (N+1)
 
for _ in range(M):
    p, s = input().split()
    p = int(p)
    if not p in AC:
        if s == 'AC':
            AC.add(p)
        if s == 'WA':
            wa[p] += 1
 
wa_ans = 0
for i in AC:
    wa_ans += wa[i]
 
print(len(AC), wa_ans)

Measured memory_bytes: 12652
<?php

  list($h) = explode(" ", trim(fgets(STDIN)));

  echo fnc($h, 0);
  
  function fnc($x, $n){
    if($x==1){
      return 1;
    }
    
    return fnc(intdiv($x,2), $n+1) * 2 + 1;
  }

Measured memory_bytes: 4604
#include <iostream>
#include <string>
#include <map>
#define rep(i, n) for(int i ; i<n; ++i)
using namespace std;
int main(){
    map<char, string> player;
    for(char ch='A'; ch<='C'; ch++){
        string s;
        cin>>s;
        player[ch] = s;
    }
    char tern = player['A'][0];
    int i = 1, j = 0, k = 0;
    while(1){
        if(tern == 'a'){
            tern = player['A'][i];
            if(player['A'].size() == i){
                cout<<'A'<<endl;
                break;
            }
            i++;
        }
        else if(tern == 'b'){
            tern = player['B'][j];
            if(player['B'].size() == j){
                cout<<'B'<<endl;
                break;
            }
            j++;
        }
        else if(tern == 'c'){
            tern = player['C'][k];
            if(player['C'].size() == k){
                cout<<'C'<<endl;
                break;
            }
            k++;
        }
    }

}

Measured memory_bytes: 256
import math
def resolve():
    n = int(input())
    aaa = list(map(int, input().split()))
    ans = 0
    for i in range(n):
        temp = aaa[i]
        if temp % 2 != 0:
            continue
        else:
            count = 1
            for j in range(10**9):
                temp = temp / 2
                if temp % 2 != 0:
                    ans += count
                    break
                count += 1            
    print(int(ans))
resolve()

Measured memory_bytes: 4148
// 6/15 解き直し
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

const int MAX_N = 200010;
// int dp[MAX_N];
const int INF = 1000000009;

vector<int> a;

void dfs(int v, Graph &G, vector<int> &dp, vector<int> &lis) {
    int change_idx;
    int before_value;
    int n = a.size();
    // cout << "dfs v = " << v << endl;
    // *lower_bound(dp.begin(), dp.end(), a[v]) = a[v];
    // lis[v] = lower_bound(dp.begin(), dp.end(), INF) - dp.begin();

    change_idx = lower_bound(dp.begin(), dp.end(), a[v]) - dp.begin();
    // cout << "change_idx is " << change_idx << endl;
    if (change_idx < n) {
        // 値を更新する時
        before_value = dp[change_idx];
        dp[change_idx] = a[v];
    }
    lis[v] = lower_bound(dp.begin(), dp.end(), INF) - dp.begin();

    // vector<int> dp_clone;  // (n);
    // if (G[v].size() > 2) {
    //     dp_clone.resize(n);
    // }

    for (auto nv : G[v]) {
        // 既にlisが設定されていたら、それは親ノード。
        if (lis[nv] != -1) continue;

        // 子であればもういっかいdfsを回す。dpはポインタ渡しではないので値は更新されない...はず。頼むぞdp...！
        dfs(nv, G, dp, lis);
    }

    if (change_idx < n) {
        dp[change_idx] = before_value;
    }
}

int main() {
    int n;
    cin >> n;
    // vector<int> a(n);
    a.resize(n);
    rep(i, n) cin >> a[i];

    Graph G(n);
    rep(i, n - 1) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        G[u].push_back(v);
        G[v].push_back(u);
    }

    // fill(dp, dp + n, INF);
    vector<int> dp(n, INF);
    vector<int> lis(n, -1);
    stack<P> log;  // {変更するdpのINDEX, 変更前の値}

    dfs(0, G, dp, lis);

    for (int l : lis) cout << l << endl;
}

Measured memory_bytes: 30836
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
using ull = uint_fast64_t;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vull = vector<ull>;
#define rep(i, n) for (ull i = 0; i < n; ++i)
#define rep1(i, n) for (ull i = 1; i < n; ++i)
#define iter(it, v) for (auto it = v.begin(); it != v.end(); ++it)
#define pb push_back
#define fi first
#define se second
#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
template <typename T> void vecout(const T &v) {
  for (auto it = v.begin(); it != v.end();
       ++it, cout << (it != v.end() ? " " : "\n")) {
    cout << *it;
  }
}
template <typename T> void arrout(const T arr, ull n) {
  for (ull i = 0; i < n; ++i, cout << (i != n ? " " : "\n")) {
    cout << arr[i];
  }
}

void solve() {
  // main coding
  ll n; cin>>n;
  vll A(n);
  rep(i,n) cin>>A[i];
  vector<vll> dp(n);
  rep(i,n) dp[i].resize(2);
  // dp[i][j] j=0ならA[i]をFlipしてない、j=1ならFlipした時の最大
  dp[0][0]=A[0]; dp[0][1]=-A[0];
  rep1(i,n) {
    dp[i][0]=max(dp[i-1][0]+A[i],dp[i-1][1]-A[i]);
    dp[i][1]=max(dp[i-1][0]-A[i],dp[i-1][1]+A[i]);
  }
  cout<<dp[n-1][0]<<endl;
}

int main() {
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
#define int long long
#define x first
#define y second
#define pb push_back

#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

signed main()
{
    speed
    int k,pos;cin>>k>>pos;
    int mx=1000000;
    int e=min(pos+k-1,mx);
    int s=max(pos-k+1,(-1*mx));
    for(int i=s;i<=e;++i)
    {
        cout<<i<<" ";
    }
}

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

int main() {
    string S,T;
    cin >> S>>T;
    for(int i=0;i<T.size();i++){
        cout << T.at(i);
    }
    for(int i=0;i<S.size();i++){
            cout <<S.at(i);
}
}

Measured memory_bytes: 256
a, b, k = map(int, input().split(' '))

for count in range(k):
    if count % 2 == 0:
        if a % 2 == 0:
            pass
        else:
            a -= 1
        half = a / 2
        a -= half
        b += half
    else:
        if b % 2 == 0:
            pass
        else:
            b -= 1
        half = b / 2
        b -= half
        a += half
print(int(a), int(b))


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

signed main() {
	int D, N;
	cin >> D >> N;

	if (D == 0) {
		if (N < 100) cout << N << endl;
		else cout << 101 << endl;
	} else if (D == 1) {
		if (N < 100) cout << 100 * N << endl;
		else cout << 100 * 101 << endl;
	} else if (D == 2) {
		if (N < 100) cout << 10000 * N << endl;
		else cout << 10000 * 101 << endl;
	}

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n, k;
	cin >>n>>k;
	int a[n+1];
	for(int i=1;i<=n;i++)cin>>a[i]; 
	cout <<ceil((double)(n-1)/(k-1))<<endl;
	return 0;
 } 

Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
                                                                                                
  
int main(void){
                                                                                                
   
    int i,j,h,f,g;

    int a[27] = {0};

    char k[27] = "abcdefghijklmnopqrstuvwxyz";
   
    char s[100001] = "";

    char t[2] = "";
   
      
    scanf("%s", s );
      
    
    for( h = 0 ; h < strlen(s) ; h = h + 1 ){

        for( f = 0 ; f < strlen(k) ; f = f + 1 ){

            if ( strncmp( s + h, k + f, 1 ) == 0 ){

                a[f] += 1;

                }

             }

         }
   

    for( g = 0 ; g < strlen(k) ; g = g + 1 ){

        if( a[g] == 0 ){

            printf("%c\n", k[g] );

            return 0;

            }

        }


    printf("None\n");


    return 0;
                                                          
}

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

using namespace std;

typedef pair<int,int>   II;
typedef vector< II >    VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))

#define SI(n) scanf("%d",&n)
#define PI(n) printf("%d\n",n)
#define SLL(n) scanf("%lld",&n)
#define PLL(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);

int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	string ans = "No\n";
	for (int i = 0 ; i <= n ; i++) {
		for (int j = 0 ; j <= m ; j++) {
			if (i*m + j*n - 2*i*j == k)
				ans = "Yes\n";
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

sum = 0
a.each{|an| sum += an}

cnt = 0
a.each do |an|
  cnt += 1 if an*(4*m) >= sum
end
(cnt >= m) ? (puts "Yes"):(puts "No")


Measured memory_bytes: 1788
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const int MAX_N = 1020;
const int MAX_W = 1020;

typedef struct {
  int v;
  int w;
} DP;

// ??\???
int W, N;
int v[MAX_N], w[MAX_N];

// ?????¢???????????????
DP dp[MAX_N][MAX_W]; 

// i????????\?????§j????????????????????§??°??????????????????????????????????¨?????????§?????¨???????????????????????????
DP rec(int i, int j) {
  if (dp[i][j].v != -1)
    return dp[i][j];

  int res;
  int weight;
  if (i == N) {
    res = 0;
    weight = 0;
  } else if (w[i] > j) {
    DP result = rec(i+1, j);
    res = result.v;
    weight = result.w;
  } else {
    DP result1 = rec(i+1, j);
    DP result2 = rec(i+1, j-w[i]);
    result2.v += v[i];
    result2.w += w[i];

    if (result1.v > result2.v) {
      res = result1.v;
      weight = result1.w;
    } else if (result1.v < result2.v) {
      res = result2.v;
      weight = result2.w;
    } else {
      res = result1.v;
      weight = min(result1.w, result2.w);
    }
   
  }

  dp[i][j].v = res;
  dp[i][j].w = weight;
  return dp[i][j];
}

DP solve() {
  for (int i=0; i<MAX_N; i++) {
    for (int j=0; j<MAX_W; j++) {
      dp[i][j].v = -1;
    }
  }

  return rec(0, W);
}

int main() {
  int counter = 0;
  
  while(scanf("%d", &W), W) {
    counter++;
    
    scanf("%d", &N);
    for (int i=0; i<N; i++) {
      scanf("%d, %d", &v[i], &w[i]);
    }

    DP result = solve();
    printf("Case %d:\n", counter);
    printf("%d\n%d\n", result.v, result.w);
  }
}

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

namespace ABC145A
{
    class Program
    {
        static void Main(string[] args)
        {
            int r = int.Parse(Console.ReadLine());

            Console.WriteLine("{0}",r*r);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <numeric>
#include <algorithm>
#include <math.h>

using namespace std;

int N;
vector<int64_t> A(10'000);

int main(){
    cin >> N;
    for(int i=0;i<N;i++)    cin >> A[i];

    int64_t ans = 0;
    for(int i=0;i<N;i++){
        while( A[i] % 2 == 0 ){
            A[i] /= 2;
            ans++;
        }
    }
    cout << ans << endl;
}

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


int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	int n;
	cin >> n;
	int W;
	cin >> W;

	vector<int> w(n), v(n);

	for (int i = 0; i < n; ++i) cin >> w[i] >> v[i];

	vector<vector<ll>> dp(n, vector<ll>(W + 1));
	
	dp[0][w[0]] = v[0];

	for (int i = 1; i < n; ++i) {
		for (int j = 0; j <= W; ++j) {
			dp[i][j] = dp[i - 1][j];
			if (j - w[i] >= 0) {
				dp[i][j] = max(dp[i][j], dp[i - 1][j - w[i]] + v[i]);
			}
		}
	}

	ll ans = 0;
	
	for (int j = 0; j <= W; ++j) ans = max(ans, dp[n - 1][j]);

	cout << ans << endl;

}



Measured memory_bytes: 79488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 55;

int n, m, q;
int a[sz], b[sz], c[sz], d[sz];
int ara[sz], ans;

void fnc(int now, int pos)
{
    if(pos > n) {
        int now = 0;
        for(int i=1; i<=q; i++) {
            if(ara[b[i]] - ara[a[i]] == c[i]) now += d[i];
        }
        ans = max(ans, now);
        return;
    }
    for(int i=now; i<=m; i++) {
        ara[pos] = i;
        fnc(i, pos+1);
    }
}

int main()
{
    cin >> n >> m >> q;
    for(int i=1; i<=q; i++) scanf("%d %d %d %d", &a[i], &b[i], &c[i], &d[i]);
    fnc(1, 1);
    cout << ans << endl;
}


Measured memory_bytes: 3736
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.Reader;
import java.io.PrintWriter;
import java.util.Arrays;;
import java.util.StringTokenizer;

/**
 * The Java template file for AtCoder online judge.
 */
public class Main {

  private static FastScanner scanner;
  private static PrintWriter printer;

  public static void solve() {
    String s = scanner.next();
    String t = scanner.next();
    int n = s.length();
    int m = t.length();
    int[][] dp = new int[n + 1][m + 1];
    dp[0][0] = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        if (s.charAt(i - 1) == t.charAt(j - 1)) {
          dp[i][j] = dp[i - 1][j - 1] + 1;
        } else {
          dp[i][j] = Math.max(dp[i][j - 1], dp[i - 1][j]);
        }
      }
    }
    int len = dp[n][m];
    StringBuilder result = new StringBuilder();
    while (n > 0 && m > 0) {
      if (s.charAt(n - 1) == t.charAt(m - 1)) {
        result.append(s.charAt(n - 1));
        n--;
        m--;
      } else if (dp[n - 1][m] > dp[n][m - 1]) {
        n--;
      } else {
        m--;
      }
    }
    printer.println(result.reverse().toString());
  }

  public static void main(String[] args) {
    scanner = new FastScanner();
    printer = new PrintWriter(System.out);
    solve();
    printer.flush();
  }

  private static class FastScanner {
    BufferedReader br;
    StringTokenizer st;

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

    public FastScanner() {
      this(new InputStreamReader(System.in));
    }

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

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

    public long nextLong() {
      return Long.parseLong(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }

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


Measured memory_bytes: 81872
#include<stdio.h>

int main(void) {
  char s[3];

  scanf("%s", s);

  int count = 0;
  for (int i=0; i<3; i++) {
    if (s[i] == '1') {
      count++;
    }
  }

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

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define all(x) x.begin(),x.end()
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
 
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

//
int main(void) {
    int N,M;
    cin >> N >> M;
    vector<i_i> v(N);
    rep(i,N) cin >> v.at(i).second >> v.at(i).first;
    sort(all(v),
        [](const i_i& x, const i_i& y){return x.second < y.second;});
    ll ans=0;
    int cnt=0;
    int tmp=0;
    while(cnt<M){
        while(cnt<M&&v.at(tmp).first>0){
            ans += v.at(tmp).second;
            v.at(tmp).first--;
            cnt++;
        }
        tmp++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
void main() {
	auto n = ri;
	auto board = new int[][][](4, 3, 10);

	foreach(_; 0..n) {
		auto ip = readAs!(int[]), b = ip[0], f = ip[1], r = ip[2], v = ip[3];
		board[b-1][f-1][r-1] += v;
	}
	foreach(index, building; board) {
		foreach(floor; building) {
			writefln(" %(%d %)", floor);
		}
		if(index != 3) '#'.repeat(20).writeln;
	}
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}



Measured memory_bytes: 2556
#include <bits/stdc++.h>
using namespace std;
#define MAXN 100
#define MAXV 1000
#define MAXW 1000000000
#define INF 10000000000000LL


int w[MAXN], v[MAXN];
int n,C;
long long dp[MAXN*MAXV+1];
int totalV;

int main() {
	int i,j;
	scanf("%d %d",&n, &C);	
	for (totalV=i=0; i<n;i++) {
		scanf("%d %d",&w[i],&v[i]);
		totalV += v[i];
	}
	dp[0]=0;
	for (i=1; i<=totalV;i++) {
		dp[i]=INF;
	}

	for (i=0; i<n; i++) {
		for (j=totalV; j>=v[i]; j--) {
			dp[j]=min(dp[j], dp[j-v[i]]+w[i]);
		}
	}
	for (i=totalV; i>=0;i--) {
		if (dp[i]<= C) break;
	}
	printf("%d\n",i);
	return 0;
}

Measured memory_bytes: 4444
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
const int MAX = 2100; // 適宜
const int MOD = 1e9 + 7;


ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// 逆元 a^{-1} mod m
// aがmの倍数でないことが前提。O(log m)
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

// n^k
ll pp(ll a, ll k){
	ll res = 1;
	    while(k > 0){
        if(k & 1){
            (res *= a) %= MOD;
        }
        (a *= a) %= MOD;
        k >>= 1;
    }
	return res;
}

void mainsolve(){

	//COMinit();
	ll n,a,b;
	cin >> n >> a >> b;

	ll res = (pp(2,n) - 1 + MOD) % MOD;

	ll nca = 1;
	rep(i,a){
		(nca *= ((n+1-(i+1)) * modinv(i+1, MOD)) % MOD) %= MOD;
	}
	ll ncb = 1;
	rep(i,b){
		(ncb *= ((n+1-(i+1)) * modinv(i+1, MOD)) % MOD) %= MOD;
	}	

	res = (res - nca + MOD) % MOD;
	res = (res - ncb + MOD) % MOD;
	cout << res << endl;
	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
const int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int n;
  cin >> n;
  map<string, int> mp;
  rep(i, n) {
    string s;
    cin >> s;
    mp[s]++;
  }
  int m;
  cin >> m;
  rep(i, m) {
    string s;
    cin >> s;
    mp[s]--;
  }
  int ma = 0;
  for (auto a : mp) chmax(ma, a.S);
  cout << ma << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int n = Integer.parseInt(scanner.next());
    int k = Integer.parseInt(scanner.next());
    int[] a = new int[n];
    boolean[] dp = new boolean[k + 1];
    int m;
    for (int i = 0; i < n; i++) {
      a[i] = Integer.parseInt(scanner.next());
    }
    dp[0] = false;
    for (int i = 1; i < k + 1; i++) {
      dp[i] = false;
      for (int j = 0; j < n; j++) {
        m = i - a[j];
        if (m >= 0 && !dp[m]) {
          dp[i] = true;
          break;
        }
      }
    }
    if (dp[k]) {
      System.out.println("First");
    } else {
      System.out.println("Second");
    }
  }
}


Measured memory_bytes: 23764
#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;

void solve(long long R) {


    cout << 2*M_PI*R << endl;
    return;
}



// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 3852