akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bits/stdc++.h>
using namespace std;
#define SIZE 200005
#define INF 10000000000000000LL
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,P> PP;
struct UF{
	int par[SIZE],rank[SIZE];
	void init(int n){
		for (int i=0;i<n;i++){
			par[i]=i;
			rank[i]=0;
		}
	}
	int find(int x){
		if (par[x]==x) return x;
		return par[x]=find(par[x]);
	}
	void unite(int x,int y){
		x=find(x);
		y=find(y);
		if (x==y) return;
		if (rank[x]<rank[y]) par[x]=y;
		else{
			par[y]=x;
			if (rank[x]==rank[y]) rank[x]++; 
		}
	}
	bool same(int x,int y){
		return find(x)==find(y);
	}
}uf; 
ll A[SIZE];
ll D;
vector <PP> edge;
void solve(int l,int r){
	if (l==r) return;
	int m=(l+r)/2;
	ll mn=INF;
	int pl=-1;
	for (int i=l;i<=m;i++){
		ll vl=A[i]-D*(ll)i;
		if (mn>vl){
			mn=vl;
			pl=i;
		}
	}
	mn=INF;
	int pr=-1;
	for (int i=m+1;i<=r;i++){
		ll vl=A[i]+D*(ll)i;
		if (mn>vl){
			mn=vl;
			pr=i;
		}
	}
	for (int i=l;i<=m;i++){
		ll vl=A[i]-D*(ll)i;
		ll vr=A[pr]+D*(ll)pr;
		edge.push_back(PP(vl+vr,P(i,pr))); 
	}
	for (int i=m+1;i<=r;i++){
		ll vl=A[pl]-D*(ll)pl;
		ll vr=A[i]+D*(ll)i;
		edge.push_back(PP(vl+vr,P(pl,i))); 
	}
	solve(l,m);
	solve(m+1,r);
}
int main(){
	int n;
	scanf ("%d%lld",&n,&D);
	for (int i=0;i<n;i++) scanf ("%lld",&A[i]);
	solve (0,n-1);
	sort (edge.begin(),edge.end());
	uf.init(n+2);
	ll ret=0;
	for (int i=0;i<edge.size();i++){
		P p=edge[i].second;
		if (!uf.same(p.first,p.second)){
			uf.unite(p.first,p.second);
			ret+=edge[i].first;
		}
	}
	printf("%lld",ret);
	return 0;
}

Measured memory_bytes: 69472
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    int cnt = 0;
    for (int i = a; i <= b; i++)
    {
        if (c % i == 0)
        {
            cnt++;
        }
    }
    cout<<cnt<<endl;
 //   system("pause");
    return 0;
}


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

using namespace std;

int main() {
    unsigned int n;
    cin >> n;

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

    int tot = accumulate(vt.begin(), vt.end(), 0);
    int ans = 1000000;
    int subTotal = 0;
    for (int i = 0; i < n; ++i) {
        subTotal += vt[i];
        ans = min(ans, abs(2 * subTotal - tot));
    }

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


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

int main() {
	int count[300] = {0};
	char word;
	
	while ((word = getchar()) !=EOF) {
		count[word]++;
	}

	for (int i = 97; i <= 122; i++)printf("%c : %d\n", i, count[i] + count[i - 32]);

	return 0;
}




Measured memory_bytes: 3196
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

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

int main() {

    int N;
    scanf("%d", &N);

    string s;
    cin >> s;

    int ans = 0;
    REP(0, i, N) {
        string lhs = s.substr(0, i);
        sort(lhs.begin(), lhs.end());
        string::iterator lit = unique(lhs.begin(), lhs.end());
        lhs.erase(lit, lhs.end());

        string rhs = s.substr(i, N - i);
        sort(rhs.begin(), rhs.end());
        string::iterator rit = unique(rhs.begin(), rhs.end());
        rhs.erase(rit, rhs.end());

        int cnt = 0;
        for (lit = lhs.begin(); lit != lhs.end(); ++lit) {
            for (rit = rhs.begin(); rit != rhs.end(); ++rit) {
                if (*lit == *rit) {
                    cnt++;
                    break;
                }
            }
        }
        if (ans < cnt) ans = cnt;
    }

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

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

using namespace std;

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

    long long n;
    long long i = 0;
    n = s.size();
    long long maxv = 0;
    while(i < n){
        if(s[i] == 'A' || s[i] == 'T' || s[i] == 'C' || s[i] == 'G'){
            long long length  = 0;
            while(i < n and(s[i] == 'A' || s[i] == 'T' || s[i] == 'C' || s[i] == 'G')){
                i++;
                length++;
            }
            maxv = max(maxv, length);
           
        }
        i++;
    }

    cout << maxv << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int n;
	int a,tmp;
	
	while(~scanf("%d",&n))
	{
		tmp=0;
		while(n)
		{
			a=n%10;
			if(a==9) 
			{
			printf("Yes\n");
			tmp=1;break;
			}
			n/=10;
		}
		if(tmp!=1) printf("No\n");
	}
} 

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

char mat[500][500];
int dp[500][500];
int h, w;

int solve(){
    int ret = -1;

    for(int i = 0; i < h; i++){
        // 長方形の左端、高さを積む
        stack<pair<int,int> > s;
        for(int j = 0; j < w; j++){
            if(s.empty()){
                s.push({j, dp[i][j]});
            }else if(s.top().second < dp[i][j]){
                s.push({j, dp[i][j]});
            }else if(s.top().second > dp[i][j]){
                int lastl;
                while(!s.empty() && s.top().second > dp[i][j]){
                    pair<int,int> out = s.top(); s.pop();
                    ret = max(ret, (j-out.first)*(out.second));
                    lastl = out.first;
                }
                s.push({lastl, dp[i][j]});
            }else if(s.top().second == dp[i][j]){
                // do nothing.
            }
        }

        while(!s.empty()){
            pair<int,int> out = s.top(); s.pop();
            ret = max(ret, (w-out.first)*out.second);
        }
    }

    return ret;
}

int main(){
    while(cin >> h >> w){
        if(w + h == 0)  break;

        // input
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                cin >> mat[i][j];
            }
        }

        // preparation
        for(int j = 0; j < w; j++){
            if(mat[0][j]=='.')  dp[0][j] = 1;
            else                dp[0][j] = 0;
        }
        for(int i = 1; i < h; i++){
            for(int j = 0; j < w; j++){
                if(mat[i][j]=='.')  dp[i][j] = dp[i-1][j]+1;
                else                dp[i][j] = 0;
            }
        }

        cout << solve() << endl;
    }

    return 0;
}


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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  int N, M;
  cin >> N >> M;

  vector<tuple<int, int, int>> pref_year_id(M);
  for (int i = 0; i < M; i++) {
    int pid, year;
    cin >> pid >> year;
    pref_year_id.at(i) = make_tuple(pid, year, i);
  }

  sort(pref_year_id.begin(), pref_year_id.end());

  vector<int> pref_id(M), city_id(M), cnt(N + 1);
  for (auto& pyi : pref_year_id) {
    int pid, id;
    tie(pid, ignore, id) = pyi;
    pref_id.at(id) = pid;
    cnt[pid]++;
    city_id.at(id) = cnt[pid];
  }

  rep(i, M) {
    cout << setfill('0') << setw(6) << pref_id.at(i);
    cout << setfill('0') << setw(6) << city_id.at(i) << endl;
  }
  return 0;
}


Measured memory_bytes: 3840
#include<iostream>

using namespace std;

int main()
{
	int a,b,c,d,n;
	int num[10];
	while(scanf("%d",&n)!=EOF){
		int i;
		for(i=1;i<=4;++i){
			num[i]=n%10;
			n/=10;
		}
		a=num[4];
		b=num[3];
		c=num[2];
		d=num[1];
		if(a+b+c+d==7) printf("%d+%d+%d+%d=7",a,b,c,d);
		else if(a+b+c-d==7)printf("%d+%d+%d-%d=7",a,b,c,d);
		else if(a-b+c+d==7)printf("%d-%d+%d+%d=7",a,b,c,d);
		else if(a+b-c+d==7)printf("%d+%d-%d+%d=7",a,b,c,d);
		else if(a-b+c-d==7)printf("%d-%d+%d-%d=7",a,b,c,d);
		else if(a+b-c-d==7)printf("%d+%d-%d-%d=7",a,b,c,d);
		else if(a-b-c+d==7)printf("%d-%d-%d+%d=7",a,b,c,d);
		else printf("%d-%d-%d-%d=7",a,b,c,d);
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>

int N,Q,l[100000],r[100000];

std::string S;

int t[100000],temp;

int main(){

    std::cin>>N>>Q>>S;

    for(int i=0;i<Q;i++){
        std::cin>>l[i]>>r[i];
    }

    for(int i=0;i<N;i++){
        if(S[i]=='A'&&S[i+1]=='C'){
            temp++;
        }
        t[i]=temp;
    }

    for(int i=0;i<Q;i++){
        std::cout<<t[r[i]-2]-t[l[i]-2]<<std::endl;
    }

    return 0;

}

Measured memory_bytes: 2176
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define     int 	    long long
#define 	pb 	        push_back
#define 	mp 	        make_pair
#define 	pi 	        2*acos(0.0)
#define     scan(i)     scanf("%d",&i)
#define     loop(i,n) 	for(int i = 0 ; i <n ; i++)
#define 	vect 	    vector<int>
#define 	vec_it 	    vector<int>::iterator vi
#define     sorta(v)    sort(v.begin(),v.end())
#define     sortd(v)    sort(v.begin(),v.end(),greater<>());
#define 	mapp 	    map<string,int>
#define 	pairr 	    pair<int,int>
#define 	sett	    set<int>s
#define 	set_it 	    set<int>::iterator si
#define     map_it      map<int,int> ::iterator mi;
#define 	yes 	    cout<<"YES"<<endl
#define 	no 	        cout<<"NO"<<endl
#define 	ff 	        first
#define 	ss 	        second
#define     mx          INT_MAX
#define     lmx         LLONG_MAX
#define     mn          INT_MIN
#define     lmn         LLONG_MIN
#define     GCD         __gcd(a,b)
#define     LCM         (a/GCD)*b
template <typename T> T gcd(T a,T b){return (b==0)?a:gcd(b,a%b);}
template <typename T> T lcm(T a,T b) {return a*(b/gcd(a,b));}
int modulo (int a, int b) { return a >= 0 ? a % b : ( b - abs ( a%b ) ) % b; }

void solve()
{
  // freopen ("(input).txt" , "r",  stdin) ;
   string st,stt ;
  // int low=0,high=0;
  // int l,r;
    int n,k,t,b,c,x,y,z,d=0,temp=0,cnt=0,sum=0; //int ar[3];
    cin>>n ; vect v,a  ; sett ; set_it ; mapp m,mp; pairr p;
    for(int i=0;i<n;i++)
    {
        cin>>st;
        m[st]++;
    }
    cout<<m.size();

}
main()
{
    int t;
  //  cin>>t;
  //  while(t--)
        solve();
}


Measured memory_bytes: 19132
#include <iostream>

using namespace std;

int main()
{


    string s;
    cin >> s;
    if (s.length() % 2 != 0){
        cout << "No";
        return 0;
    }

    for (int i = 0; i < s.length(); i++){
        if (i % 2 == 0){
            if (s[i] != 'h'){
                cout << "No";
                return 0;
            }
        }
        else {
            if (s[i] != 'i'){
                cout << "No";
                return 0;
            }
        }
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
typedef long long ll;
ll v[2002][2002];
int main(){
    ll n,k,res;
    cin>>n>>k;
    for(int i=0;i<=n;i++){
        v[i][0] = 1;
        for(int j=1;j<=i;j++){
            v[i][j] = (v[i-1][j-1]+v[i-1][j])%mod;
        }
    }
    for(int i=1;i<=k;i++){
        res= (v[k-1][i-1]*v[n-k+1][i])%mod;
        cout<<res<<endl;
    }
    return 0;
}

Measured memory_bytes: 30080
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class EAlmostEverywhereZero {
        static int[][][] dp = new int[105][4][2];

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.nextLine();
            int K = in.nextInt();
            int n = s.length();
            dp[0][0][0] = 1;

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < 4; j++) {
                    for (int k = 0; k < 2; k++) {
                        int nd = s.charAt(i) - '0';
                        for (int digit = 0; digit < 10; digit++) {
                            int ni = i + 1, nj = j, nk = k;
                            if (digit != 0) nj++;
                            if (nj > K) continue;
                            if (k == 0) {
                                if (digit > nd) continue;
                                if (digit < nd) nk = 1;
                            }
                            dp[ni][nj][nk] += dp[i][j][k];
                        }
                    }
                }
            }

            int ans = dp[n][K][0] + dp[n][K][1];
            out.println(ans);
        }

    }
}



Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    map<int,int> mp;
    for(int i=0;i<n;++i){
        int a; cin >> a;
        if(mp[a] >=1) mp[a]--;
        else mp[a]++;
    }
    int ans = 0;
    for(auto itr : mp){
        if(itr.second>=1) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 998244353
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
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;} //最小公倍数

//-------------------------------------------------
//コピペするとこ

ll mpow(ll a, ll b){
  ll c = 1 ;
  REP(i,b){
    c = c*a%MOD ;
  }
  return c ;
}



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


int main()
{ 
  int n ;
  cin >> n ;
  ll ans = 1 ;
  
  vector<ll> vec(n) ;
  
  ll m = 0 ;
  
  REP(i,n){
    cin >> vec.at(i) ;
    m = max(m,vec.at(i)) ;
  }
  if(vec.at(0)!=0){
    cout << 0 <<endl ;
    return 0 ;
  }
  
  m++ ;
  
  vector<ll> vecy(m,0) ;
  
  REP(i,n){
    vecy.at(vec.at(i))++ ;
  }
  
  if(vecy.at(0)!=(ll)1){
    cout << 0 <<endl ;
    return 0; 
  }
  
  FOR(i,1,m){
    ans = ans*mpow(vecy.at(i-1),vecy.at(i))%MOD ;
  }
  
  cout <<ans%MOD<<endl ;
  
  return 0 ;
}






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

int RestaurantCalculation(int n){
    int sum = 0;
    sum += n * 800;
    sum -= (n - n % 15) / 15 * 200;
    return sum;
}

int main() {
    int N;
    cin >> N;
    int x;
    x = RestaurantCalculation(N);
    cout << x << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int P[100001];
long long A[100001], B[100001], C[100001];
int D[100001];

int main() {
	int N,M;
	long long R=0;

	cin>>N>>M;
	for(int i=1; i<M+1; i++)cin>>P[i];
	for(int i=1; i<N; i++)cin>>A[i]>>B[i]>>C[i];

	for(int i=1; i<M; i++){
		if(P[i]<P[i+1]){
			for(int j=P[i]; j<P[i+1]; j++)D[ j ] += 1;
		}else{
			for(int j=P[i+1]; j<P[i]; j++)D[ j ] += 1;
		}
	}

	for(int j=1; j<N; j++) R += min(D[ j ]*B[ j ]+C[ j ],  D[ j ]*A[ j ]);
	cout<<R<<endl;
	return 0;
}



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

#define debug(x) cerr << x << " = "(x) << endl;
#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int x,n; cin >> x >> n;
    int p[n];
    bool se[102] = {};
    int locate=0;
    rep(i,0,n){
        cin >> p[i];
        se[p[i]] = true;
    }
    int ans = 1000;
    rep(i,0,102){
        if(se[i]) continue;
        if(ans > abs(x-i)){
            //cout << i << endl;
            ans = abs(x-i);
            locate = i;
        }
    }
    cout << locate << endl;
}   

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
const int MAXN=110;
int n,m,dp[MAXN][MAXN];
char c[MAXN][MAXN];
int main () {
	scanf("%d%d",&n,&m);
	for (int i=2;i<=max(n,m);i++) {dp[0][i]=dp[i][0]=1e9;}
	for (int i=1;i<=n;i++) {
		scanf("%s",c[i]+1);
		for (int j=1;j<=m;j++) {
			if (c[i][j]=='.') {dp[i][j]=min(dp[i-1][j],dp[i][j-1]);}
			else {dp[i][j]=min(dp[i-1][j]+(c[i-1][j]!='#'),dp[i][j-1]+(c[i][j-1]!='#'));}
		}
	}
	printf("%d\n",dp[n][m]);
	return 0;
}

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

using ll = long long;
constexpr ll INF = 1000000000;
constexpr ll mod = 1e9 + 7;

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

using namespace std;

//fixed << setprecision(10)

/////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
	int x, n;
	cin >> x >> n;
	
	vector<int>p(x);
	for (int i = 0; i < x; i++)cin >> p[i];

	sort(p.begin(), p.end());

	int sum = 0;

	for (int i = 0; i < n; i++) {
		sum += p[i];
	}

	cout << sum << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define SIZE 2000005
#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved
long long fac[SIZE],finv[SIZE],inv[SIZE];
long long MOD=mod;

void make() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < SIZE; 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;
    }
}

// 二項係数計算
long long C(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;
}
int main(){
    
    long long x,y;
    cin>>x>>y;

    if(abs(x-y)>min(x,y)||(x+y)%3!=0){
        cout<<"0"<<endl;
        return 0;
    }

    long long n=(x+y)/3;
    long long k=(n-abs(x-y))/2;
    make();
    cout<<C(n,k)<<endl;
    return 0;

}
/*


*/


Measured memory_bytes: 47104
#include<stdio.h>
int main(){
  int h,w,num,i,j,k,l,hlen=1,wlen=1,sum=0;
  scanf("%d%d%d",&h,&w,&num);
  char c[h+1][w+1];
  for(i=0;i<h;i++)
    scanf("%*c%s",c[i]);
  for(i=0;i<h;i++)
    hlen*=2;
  for(i=0;i<w;i++)
    wlen*=2;
  for(i=0;i<hlen;i++){
    for(j=0;j<wlen;j++){
      int hnum=i,count=0;
      for(k=0;k<h;k++){
        int wnum=j;
        if(hnum%2==1){
          for(l=0;l<w;l++){
            if(wnum%2==1 && c[k][l]=='#')
              count++;
            wnum/=2;
          }
        }
        hnum/=2;
      }
      if(count==num)
        sum++;
    }
  }
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 1728
#include <stdio.h>
 
using namespace std;
 
int main(){
    int a,b;
    double a_d,b_d;
    scanf("%d %d",&a,&b);
    a_d = static_cast<double>(a);
    b_d = static_cast<double>(b);
    printf("%d %d %.5f\n",a/b,a%b,a_d/b_d);
}


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

int main() {
  int N, M, L, i, j;
  cin >> N >> M;
  vector<int> cnt(N);
  L = 2 * M;
  vector<int> pos(L);
  for (i = 0; i < L; i++) {
    cin >> pos.at(i);
    j = pos.at(i);
    cnt.at(j - 1)++;
  }
  
  for (i = 0; i < N; i++) {
    cout << cnt.at(i) << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main{
	
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		outline: while(sc.hasNextLine()) {
			int[][] in = new int[8][8];
			for(int i = 0; i < 8; i++) {
				String line = sc.nextLine();
				if(line.isEmpty()) continue outline;
				for(int j = 0; j < 8; j++) {
					in[i][j] = Integer.parseInt(String.valueOf(line.charAt(j)));
				}
			}
			
			System.out.println(findFigure(in));
		}
		sc.close();
	}	
	
	
	static Figure findFigure(int[][] surface) {
		int width = 0;
		int height = 0;
		int u = 0;
		int l = 0;
		
		//horizontal direction: height
		h1: for(int i = 0; i < surface.length; i++) {
			for(int j = 0; j < surface[i].length; j++) {
				if(surface[i][j] == 1) {
					height = i;
					u = i;
					break h1;
				}
			}
		}
		h2: for(int i = surface.length-1; i >= 0; i--) {
			for(int j = 0; j < surface[i].length; j++) {
				if(surface[i][j] == 1) {
					height = i - height + 1;
					break h2;
				}
			}
		}
		
		//vertical direction: width
		w1: for(int j = 0; j < surface[0].length; j++) {
			for(int i = 0; i < surface.length; i++) {
				if(surface[i][j] == 1) {
					width = j;
					l = j;
					break w1;
				}
			}
		}
		w2: for(int j = surface[0].length - 1; j >= 0; j--) {
			for(int i = 0; i < surface.length; i++) {
				if(surface[i][j] == 1) {
					width = j - width + 1;
					break w2;
				}
			}
		}
		return kindOfFigure(surface[u][l] == 1, width, height);
	}
	
	static Figure kindOfFigure(boolean ul, int width, int height) {
		if(width == 2 && height == 2) return Figure.A;
		else if(width == 1 && height == 4) return Figure.B;
		else if(width == 4 && height == 1) return Figure.C;
		else if(width == 2 && height == 3 && !ul) return Figure.D;
		else if(width == 3 && height == 2 && ul) return Figure.E;
		else if(width == 2 && height == 3 && ul) return Figure.F;
		else if(width == 3 && height == 2 && !ul) return Figure.G;
		else return null;
	}
}

enum Figure{
	A, B, C, D, E, F, G;
}

Measured memory_bytes: 22040
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
int main(){
    string s;
    int n;cin>>n>>s;
    int a=0,b=0;
    rep(i,n){
        if(s[i]=='('){
            a++;
        }
        else{
            if(a==0)b++;
            else a--;
        }
    }
    rep(i,b){
        s='('+s;
    }
    rep(i,a){
        s=s+')';
    }
    cout<<s<<endl;
    }

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <float.h>
#include <stdlib.h>
#include <functional>
#include <limits>
#include <numeric>
#include <type_traits>
#include <queue>
#include <fstream>
#include <bitset>
#include <cmath>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i <= (int)(n); i++)
#define sort1(v) sort(v.begin(),v.end())
#define reverse(v) reverse(v.begin(),v.end())
#define all(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int,int> p;
bool paircom (pair<int,int> p,pair<int,int> q){
return p.second<q.second;
}

void count(vector<int> v,vector<int>& ans){
    sort1(v);
    int n=v.size();
  int k=1;
  int i=1;
  bool bl=true;
    while(true){
    while(bl){
        if(v[i-1]==v[i]){
        k++;    
      }else{
          bl=false;
      }
      i++;
      }
      ans.push_back(k);
      if(i>=(n-1))break;
      k=1;
      bl=true;
    }
    }




int main() {
 int n,m,ans;
 ans=0;
 cin >> n;
 vector<int> a(n);
 for(int i=0;i<n;i++){
     cin >> a[i];
if(i%2==0 && a[i]%2==1)ans++;
 } 
 cout << ans;


}
    

Measured memory_bytes: 3496
#include <bits/stdc++.h>
using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	string s,t;
	cin>>s>>t;
	int z=0;
	int si=s.size();
	for(int i=0;i<si;i++)
    {
        if(s[i]!=t[i])
        {
            z++;
        }
    }
    cout<<z<<endl;
	return 0;
}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	cin >> a;
	cin >> b;
	c = a % 500;
	if(b>=c)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
  return 0;
}

Measured memory_bytes: 256
N,M = map(int, input().split())
As = [1] *( N+1)
mod = 10**9+7
for _ in range(M):
    i = int(input())
    As[i] = 0
for i in range(N-1):
    if As[i+2] > 0:
        As[i+2] = As[i+1] + As[i]
print(As[-1]%mod)

Measured memory_bytes: 460020
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,j;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    int dp[k+1]={0};
    dp[0]=0;
    for(int i=1;i<=k;i++)
    {
        for( j=0;j<n&&i-a[j]>=0;j++)
        {
            if(dp[i-a[j]]==0)
            {
                dp[i]=1;
                break;
                
            }
        }
        if(j==n)
        dp[i]=0;
    }
    if(dp[k]==0)
    cout<<"Second";
    else cout<<"First";
}

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }

const int dirs[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
const int inf = 0x3f3f3f3f;
int dist[55][55];
string g[55];

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int n, m; read(n, m);
	rep(i, 0, n) read(g[i]);

	queue<pair<int, int>> q;
	rep(i, 0, n) rep(j, 0, m) dist[i][j] = inf;
	dist[0][0] = 0;
	q.push({0, 0});

	while (!q.empty()) {
		int i, j;
		tie(i, j) = q.front(); q.pop();
		rep(d, 0, 4) {
			int ni = i + dirs[d][0], nj = j + dirs[d][1];
			if (0 <= ni && ni < n && 0 <= nj && nj < m && g[ni][nj] == '.' && dist[i][j] + 1 < dist[ni][nj]) {
				dist[ni][nj] = dist[i][j] + 1;
				q.push({ni, nj});
			}
		}
	}
	
	if (dist[n - 1][m - 1] == inf) die(-1);

	int cw = 0;
	rep(i, 0, n) rep(j, 0, m) if (g[i][j] == '.') cw++;
	die(cw - dist[n - 1][m - 1] - 1);
}


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

int a,b;
int count=0;

int main(void){
	scanf("%d %d", &a,&b);

	for(int i=a;i<=b;i++){
		if( (i/10000) == i%10 && (i/1000)%10 == (i/10)%10)	count++;	
	}

	printf("%d", count);

	return 0;
}


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int train = min(a, b);
  int bus = min(c, d);
  
  int ans = train + bus;
  cout << ans << endl;
}

Measured memory_bytes: 3624
import sys
n=60000
prime = [1]*(n+1)
(prime[0],prime[1])=(0,0)
for i in [v for v in xrange(2,n+1) if v*v<n+1]:
        for j in xrange(i*i,n+1,i):
            prime[j]=0
 
for inp in sys.stdin:
    i=int(inp)
    j=int(inp)
    while i<n:
        if prime[i+1]==1:
            break
        i+=1

    while j>0:
        if prime[j-1]==1:
            break
        j-=1
    print j-1,i+1

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

int main() {
    int n, k;
    cin >> n >> k;
    map<int, int> a;
    for (int i = 0; i < n; i++) {
        int ai;
        cin >> ai;
        a[ai]++;
    }

    vector<int> m;
    transform(begin(a), end(a), back_inserter(m), [](auto a) { return a.second; });
    sort(begin(m), end(m));
    cout << accumulate(begin(m), begin(m) + max((int) m.size() - k, 0), 0) << endl;
}


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(int, n);
  out((n + 999) / 1000 * 1000 - n);
}


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


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,d,a;
    cin>>n>>d>>a;
    vector<pair<ll,ll>> vec(n);
    for(ll i=0;i<n;++i)
    {
    	ll a,b;
    	cin>>a>>b;
    	vec[i]=make_pair(a,b);

    }

    sort(vec.begin(),vec.end());

    long long ans=0;
    set<pair<ll,ll> >s;
    long long sum=0;
    for(ll i=0;i<n;++i)
    {
    	auto it1=s.lower_bound(make_pair(vec[i].first,-1));
    	auto it2=s.rbegin();
    	ll y=0;
    	if(it1!=s.end()&&s.size()>=1)
    	{
    	    if(it1!=s.begin())
    	    {
    	        it1--;
    	        ll start=it1->second;
    	        ll end=it2->second;
    	        y=end-start;
    	    }
    	    else
    	    {
    	        y=it2->second;
    	    }
    	}
    	
    	ll right=vec[i].first+2*d;
    	long double temp=0.0;
    	if(vec[i].second>=y)
    	temp=(vec[i].second-y)/(long double)a;
    	ll res=ceil(temp);
    	ans+=res;

    	sum+=res*a;
    	s.insert(make_pair(right,sum));
    	

    }

    cout<<ans<<endl;



}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
using pp=pair<int,int>;
using ll=long long;

int main() {
  ll W, H, x, y;
  cin >> W >> H >> x >> y;
  double m=(double)(W*H)/2;
  cout << m << " ";
  if (x*2==W && y*2==H) {
    cout << 1 << endl;
  }
  else {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 3768
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i

a,b,c,d,e,f = list(map(int, input().split()))

waVa = maxValue(a*100,b*100,f)
suVa = maxValue(c,d,min(f-waVa,waVa*e//100))
maxR = 0

anw = waVa
ans = suVa

while 1:
	waVa = maxValue(a*100,b*100,waVa-1)
	suVa = maxValue(c,d,min(f-waVa,waVa*e//100))
	if waVa == 0:
		break
	if maxR<100*suVa/(suVa+waVa):
		maxR = 100*suVa/(suVa+waVa)
		anw = waVa
		ans = suVa

print(anw+ans,ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
const double eps = 1e-10;
  
int main() {
  string s;
  cin >> s;
  rep(i,sz(s)) {
    if(s[i] != s[sz(s)-1-i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
def main():
  h,*s=open(0)
  h,w,k=map(int,h.split())
  s=[list(map(int,t[:w]))for t in s]
  m=9e9
  for i in range(1<<h-1):
    t=[]
    b=v=l=0
    for j in range(h):
      if i>>j&1:
        t+=map(sum,zip(*s[b:j+1])),
        b=j+1
        l+=1
    t+=map(sum,zip(*s[b:])),
    l+=1
    c=[0]*l
    for i in range(w):
      f=g=0
      u=[]
      for j,d in enumerate(t):
        d=d.__next__()
        u+=d,
        if d>k:
          g=1
          break
        c[j]+=d
        f|=c[j]>k
      else:
        if f:
          c=u
          v+=1
      if g:break
    else:
      if v+l-1<m:m=v+l-1
  print(m)
main()

Measured memory_bytes: 3188
S=input()
a=set()
for s in S:
  a.add(s)
a=list(a)
if len(a)==4:
  print('Yes')
elif len(a)==2:
  if (a[0]=='N' or a[0]=='S') and (a[1]=='N' or a[1]=='S'):
    print('Yes')
  elif (a[0]=='E' or a[0]=='W') and (a[1]=='E' or a[1]=='W'):
    print('Yes')
  else:
    print('No')
else:
  print('No')


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

int main() {
    int n, m;
    cin >> n >> m;
    int a[m];
    int max = 0;
    rep(i, m){
        cin >> a[i];
        max += a[i];
    }
    cout << (n - max >= 0? n-max: -1) << endl;

}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
#define forn(i,n) for(int i=0;i<int(n);i++)
#define rforn(i,n) for(int i = int(n) - 1; i >= 0; --i)

using namespace std;
typedef long long ll;

int N;
string A, B;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N;
    cin >> A >> B;
    int i = 0, j = 0;
    for (int pos = 0; pos < N + N; ++pos) {
        if (pos % 2 == 0) {
            cout << A[i++];
        }
        else {
            cout << B[j++];
        }
    }
}



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 int ll;
const ll MOD = 1000000007;

int main() {
  int n, a;
  map<int, int> m;
  cin >> n;
  REP(i, n) {
    cin >> a;
    m[a] = i + 1;
  }

  for (auto i = m.begin(); i != m.end(); ++i) {
    if (i != m.begin()) cout << " ";
    cout << i->second;
  }
  cout << endl;
  return 0;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;


void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if((z->key)<(x->key)){
      x = x->left;
    }else{
      x = x->right;
    }
  }

  z->parent=y;

  if(y==NIL){
    root=z;
  }else if((z->key) < (y->key)){
    y->left=z;
  }else{
    y->right=z;
  }
}

void inorder(Node u){
  if(u==NIL){
    return;
  }
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
  
}
void preorder(Node u){
  if(u==NIL){
    return;
  }
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else{
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}



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


int main()
{
	int a1,a2,a3;
	cin>>a1>>a2>>a3;
	int r1= abs(a1-a2)+abs(a2-a3);
	int r2= abs(a1-a3)+abs(a3-a2);
	int r3 = abs(a2-a1)+abs(a1-a3);
	int r4= abs(a2-a3)+abs(a3-a1);
	int r5 = abs(a3-a2)+abs(a2-a1);
	int r6 = abs(a3-a1)+abs(a1-a2);
	cout<<min(min(min(r1,r2),min(r3,r4)),min(r5,r6))<<endl;
	return 0;
}

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

#define INF 1e9
using namespace std;
using ll = long long;

int main() {

    int a, b; cin >> a >> b;

    string s = to_string(a) + to_string(b);

    for (int i = 1; i <= 1000; ++i) {
        if (i * i == stoi(s)) {
            puts("Yes");
            return 0;
        }
    }

    puts("No");
}

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

using ll = long long;

int main()
{
    int k;
    cin >> k;
    int a, b;
    cin >> a >> b;

    if(a%k == 0 || b%k == 0) {
        cout << "OK" << endl;
    }
    else if(a/k == b/k) {
        cout << "NG" << endl;
    }
    else {
        cout << "OK" << endl;
    }
}


Measured memory_bytes: 3656
import java.util.Scanner;

//Area of Polygon
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double[][] p = new double[20][2];
		int n = 0;
		while(sc.hasNext()){
			String s[] = sc.next().split(",");
			p[n][0]=Double.parseDouble(s[0]);
			p[n][1]=Double.parseDouble(s[1]);
			n++;
		}
		double a = 0;
		for(int i=0;i<n;i++){
			double x1 = p[i][0];
			double y1 = p[i][1];
			double x2 = p[(i+1)%n][0];
			double y2 = p[(i+1)%n][1];
			a += x1*y2-x2*y1;
		}
		System.out.println(Math.abs(a/2));
	}
}

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

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;

#define boost ios::sync_with_stdio(0); cin.tie(0)

#define fi first
#define se second

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

const int N = 1e6 + 5;

/***************************************************************************/

int A[N];

int main() {

	boost;
	int n, k; cin>>n>>k;
	int p = -1;

	for(int i=1; i<=n; i++) {
		cin>>A[i];
		if(A[i] == 1) p = i;
	}

	int ans = ceil((ld) (p-1)/(k-1)) + ceil((ld) (n-p)/(k-1));
	int a = (p-1) % (k-1); int b = (n-p) % (k-1);
	if(a > 0 and b > 0 and a+b <= k-1) ans--;

	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 640
package main

import (
	"bufio"
	"errors"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

// NextLine reads a line text from stdin, and then returns its string.
func NextLine() string {
	sc.Scan()
	return sc.Text()
}

// NextIntsLine reads a line text, that consists of **ONLY INTEGERS DELIMITED BY SPACES**, from stdin.
// And then returns intergers slice.
func NextIntsLine() []int {
	ints := []int{}
	intsStr := NextLine()
	tmp := strings.Split(intsStr, " ")
	for _, s := range tmp {
		integer, _ := strconv.Atoi(s)
		ints = append(ints, integer)
	}
	return ints
}

// NextRunesLine reads a line text, that consists of **ONLY CHARACTERS ARRANGED CONTINUOUSLY**, from stdin.
// Ant then returns runes slice.
func NextRunesLine() []rune {
	return []rune(NextLine())
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// PowInt is integer version of math.Pow
func PowInt(a, e int) int {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}
	fa := float64(a)
	fe := float64(e)
	fanswer := math.Pow(fa, fe)
	return int(fanswer)
}

/*******************************************************************/

var s []rune

func main() {
	s = NextRunesLine()

	if len(s) == 2 {
		fmt.Println(string(s))
	} else {
		for i := 2; i >= 0; i-- {
			fmt.Printf("%c", s[i])
		}
		fmt.Printf("\n")
	}
}


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

int main()
{
    int N;
    int cnt = 0;
    cin >> N;
    int A[N];
    for (int i = 0; i < N; i++)
        cin >> A[i];
    for(int i = 0; i < N; i++)
    {
        int minj = i;
        for(int j = i; j < N; j++)
        {
            if(A[minj] > A[j])
                minj = j;
        }
        if(minj != i)
            cnt++;
        swap(A[i], A[minj]);
    }
    for(int i = 0; i < N; i++)
    {
        if(i > 0)
            cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 3100
program sample
    implicit none
    character(100)::s,t
    integer(8) :: i,j,k,m,n
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:)
  
    read(*,*) n
    allocate(x(n))
    read(*,*)x
    write(*,*)sum(x)-n
    stop
end program sample
  



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





public class Main
{

	static OutputStream outputStream = System.out;
	static PrintWriter out = new PrintWriter(outputStream);	

	static int n,m;
	static long mod=1000000007;

	static long[] fact;

	static long power(long x,long y)
	{
		if(y==0) return 1;
		long cp = power(x,y/2);

		if(y%2==0) return (cp*cp)%mod;
		return ((cp*cp)%mod * x)%mod;
	}

	public static void main(String[] args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

		// long n=Long.parseLong(br.readLine());


		String[] s=br.readLine().split(" ");

		n=Integer.parseInt(s[0]);m=Integer.parseInt(s[1]);
		int k=Integer.parseInt(s[2]);

		long dis=0;

		for(int i=0;i<n;i++)
		{
			for(int j=0;j<m;j++)
			{
				long left = j;

				left*=(left+1);
				left/=2;
				left*=n;

				dis+=(left)%mod;

				left = i;

				left*=(left+1);
				left/=2;
				left*=m;

				dis+=(left)%mod;

			}
		}
      	dis%=mod;

		fact=new long[n*m+10];
		fact[0]=1;

		for(int i=1;i<n*m+10;i++)
		{
			fact[i]=(i*fact[i-1])%mod;
		}

		long ans=fact[n*m-2];

		ans*=power(fact[k-2],mod-2);
		ans%=mod;

		ans*=power(fact[n*m-k],mod-2);
		ans%=mod;

		ans*=dis;
		ans%=mod;

		out.println(ans);

		out.close();

	}
}

Measured memory_bytes: 23636
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n;
   cin>>n;
   long long sum=0;
   for(int i=1;i<=n; i++)
   {
       if(i%3!=0 && i%5!=0)
       {


           sum+=i;
       }
   }
   cout<<sum;
}


Measured memory_bytes: 3640
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
  int n;
  scanf("%d",&n);
  if((n % 2) && (3 <= n && n <= 7))	puts("YES");
  else	puts("NO");
  return 0;
}


Measured memory_bytes: 128
w,h,x,y,r = gets.split.map!(&:to_i)
w_max_limit = w - r
w_min_limit  = r
h_max_limit = h - r
h_min_limit  = r
if x < w_min_limit || x > w_max_limit || y <h_min_limit || y > h_max_limit then
  puts "No"
else
  puts "Yes"
end

Measured memory_bytes: 8616
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;

int check(ll);

int main(){
  int n; cin >> n;
  ll a[n];

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

  cout << ans << endl;

  return 0;
}

int check(ll n){
  int cnt = 0;
  while(n % 2 == 0){
    n /= 2;
    cnt++;
  }
  return cnt;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<climits>
using namespace std;
int main(){
        int n;
        int R[200000];
        cin >> n;
        for(int i=0;i<n;i++)
                cin >> R[i];
        int minv=R[0],maxv=INT_MIN;
        for(int i=1;i<n;i++){
                maxv=max(maxv,R[i]-minv);
                minv=min(minv,R[i]);
        }
        cout<<maxv<<endl;
        return 0;
}


Measured memory_bytes: 3876
#include <iostream>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main()
{
	int n; cin >> n;
	string s; cin >> s;
	int i,j;
	vector<char> st;
	rep( i, n ){
		st.push_back( s[i] );
		if( s[i] == s[i+1]){
			st.pop_back();
		}
	}
	cout << st.size() << endl;
	return 0;
}

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

int main(){
    int a, b;
    cin >> a >> b;
    if (a < b) {
        cout << "a < b" << endl;
        }
    else if (a > b) {
        cout << "a > b" << endl;
        }
    else {
        cout << "a == b" << endl;
        }
    return 0;
}


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;
int f[50];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int n;cin>>n;
	f[0]=f[1]=1;
	REP(i,n-1){
		f[i+2] = f[i + 1] + f[i];
	}
	cout << f[n] << endl;
  return 0;
}

Measured memory_bytes: 3144
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<vector>

#define LAST '{'
#define MOD 1000000007

using namespace std;

int comb,len,syurui=0;
vector<int> table(100, 0);

long solve(int now,int nokori,int used) {
	if (used==comb) {
		return 1;
	}
	if ( nokori<comb-used || table[now] == 0) {
		return 0;
	}
	else {
		return (solve(now + 1, nokori-1, used) + 
				((solve(now + 1, nokori-1, used+1))%MOD)
				*table[now])%MOD;
	}
}

int main()
{
	string S;
	int N;
	int i,tmp;
	long ans;

	cin >> N;
	cin >> S;
	len = S.length();
	for (i = 0; i < len; i++) {
		tmp = S[i]-'a';
		if ( table[tmp]== 0) {
			syurui++;
		}
		table[tmp]++;
	}
	ans = len;

	sort(table.rbegin(),table.rend());

	for (i = 2; i <= 26; i++) {
		comb = i;
		ans = (ans + solve(0, syurui, 0))%MOD;
	}


	cout << ans << endl;

	return 0;
}


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

s = []
dic = {}
ans = 0
for i in range(n):
    si = input()
    si = sorted(si)
    ss = ""
    for a in si:
        ss += a
    if(ss in dic):
        dic[ss] += 1
    else:
        dic[ss] = 1

for e in dic:
    if(dic[e] == 1):
        continue
    ans += dic[e] * (dic[e] - 1) // 2

print(ans)


Measured memory_bytes: 17876
#include <bits/stdc++.h>
using namespace std;
int a[124];
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
		a[s[i]]++;
	for(int i=97;i<=122;i++)
		if(a[i]==0)cout<<char(i),exit(0);
	cout<<"None";
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include "vector"
using namespace std;

int main(int argc, char const *argv[]) {


  int N;
  std::cin >> N;

  // std::vector<int> A(N);
  int a;
  std::cin >> a;
  int minA,maxA;
  minA = a;
  maxA = a;
  for (size_t i = 1; i < N; i++)
  {
    /* code */
    // A[i]
    // std::cin >> A[i];
    int a;
    std::cin >> a;

    if(a < minA) minA = a;
    if(a > maxA) maxA = a;

  }

  std::cout << maxA - minA << '\n';

  return 0;
}

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

using namespace std;

const int N = 400 + 77;
int n , a[N];
long long dp[N][N] , ps[N];
int main(){
   ios::sync_with_stdio(0);cin.tie(0);
   cin >> n;
   for(int i = 1;i <= n;++ i)
      cin >> a[i] , ps[i] = ps[i - 1] + a[i];
   for(int d = 1;d <= n;++ d)
      for(int le = 1;le + d <= n;++ le){
         int ri = le + d;
         dp[le][ri] = 2e18;
         for(int k = le;k < ri;++ k)
            dp[le][ri] = min(dp[le][ri] , dp[le][k] + dp[k + 1][ri] + ps[ri] - ps[le - 1]);
      }
   cout << dp[1][n];
   return 0;
}


Measured memory_bytes: 1792