akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
// const long long INF = 1LL<<60;
int INF = 1000000100;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

int main() {
  int N,M,L;cin>>N>>M>>L;
  vector<vector<int>> dist1(N,vector<int>(N,INF));
  rep(i,M) {
    int a,b,c;cin>>a>>b>>c;
    a--;b--;
    dist1[a][b] = dist1[b][a] = c;
  }
  // vector<vector<int>> dist1(N,vector<int>(N,N*100));
  rep(i,N) dist1[i][i] = 0;
  rep(k,N)rep(i,N)rep(j,N) dist1[i][j] = min(dist1[i][j],dist1[i][k]+dist1[k][j]);
  vector<vector<int>> dist2(N,vector<int>(N,INF));
  rep(i,N)rep(j,N) {
    if(dist1[i][j] <= L && i!=j) dist2[i][j] = 1;
    else if(i==j) dist2[i][j] = 0;
  }
  rep(k,N)rep(i,N)rep(j,N) dist2[i][j] = min(dist2[i][j],dist2[i][k]+dist2[k][j]);
  int Q;cin>>Q;
  rep(i,Q) {
    int s,t;cin>>s>>t;
    s--;t--;
    if(dist2[s][t] == INF) cout<<-1<<endl;
    else cout<<dist2[s][t]-1<<endl;
  }
}


Measured memory_bytes: 4332
#include<stdio.h>

int B(int,int);

int a[2000],n;

main(void){
  
  int m[200],q,i;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&m[i]);
  }

  for(i=0;i<q;i++){
    if(B(0,m[i])==0) printf("no\n");
    else printf("yes\n");
  }
  return 0;
}

int B(int p,int m)
{
  if(m==0) return 1;
  else if(p==n) return 0;
  else if(B(p+1,m-a[p])==1||B(p+1,m)==1){
    return 1;
  }
  return 0;
}

Measured memory_bytes: 580
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    int a, b;
    cin >> a >> b ;
    cout << a+b/2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

struct triple { ll first, second, third; };
bool used[100000];

int main() {
    int N, A, B;
    triple diff_a[100000], diff_b[100000];
    cin >> N;
    REP(i, N) {
        cin >> A >> B;
        diff_a[i] = {A + B, A, i};
        diff_b[i] = {A + B, B, i};
    }

    sort(diff_a, diff_a + N, [](const triple& a, const triple& b) {
        if (a.first == b.first) {
            return a.second > b.second;
        }
        else {
            return a.first > b.first;
        }
    });
    sort(diff_b, diff_b + N, [](const triple& a, const triple& b) {
        if (a.first == b.first) {
            return a.second > b.second;
        }
        else {
            return a.first > b.first;
        }
    });

    ll ans = 0;
    int a = 0, b = 0;
    while (true) {
        while (a < N && used[diff_a[a].third]) a++;
        if (a == N) break;
        used[diff_a[a].third] = true;
        ans += diff_a[a].second;

        while (b < N && used[diff_b[b].third]) b++;
        if (b == N) break;
        used[diff_b[b].third] = true;
        ans -= diff_b[b].second;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//int→string
//string→int
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//sqrt
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


//#define EPS (1e-10)
//
//struct Point{
//    Point(double _x = 0, double _y = 0){
//        x = _x;
//        y = _y;
//    }
//    double x;
//    double y;
//
//    Point operator + (Point p){
//        return Point(x + p.x, y+ p.y);
//    }
//
//    Point operator - (Point p){
//        return Point(x - p.x, y - p.y);
//    }
//
//    Point operator * (double a){
//        return Point(a * x, a * y);
//    }
//
//    Point operator / (double a){
//        return Point(x / a, y / a);
//    }
//
//    double abs(){
//        return sqrt(norm());
//    }
//
//    double norm(){
//        return x * x + y * y;
//    }
//
//    bool operator < (const Point &p) const{
//        return x!=p.x ? x < p.x : y < p.y;
//    }
//
//    bool operator == (const Point &p) const{
//        return fabs(x - p.x) && fabs(y - p.y) < EPS;
//    }
//
//};
//
//typedef Point Vector;
//
//double dot(Vector a, Vector b){
//    return a.x * b.x + a.y * b.y;
//}

int main() {

    int N; scanf("%d", &N);
    int L; scanf("%d", &L);
    VS S(N);
    REP(i, N){
        cin >> S[i];
    }
    SORT(S);

    EACH(i, S){
        cout << (*i);
    }

    return 0;

}

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

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

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

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

const int MAXN=205,MAXV=100005,MOD=1000000007;

int s[MAXN],dp[MAXV],fac[MAXN],inv[MAXN],up[MAXV];

void preprocess(int n)
{
	fac[0]=1;
	for (int i=1;i<=n;i++)
		fac[i]=(LL)fac[i-1]*i%MOD;
	inv[0]=inv[1]=1;
	for (int i=2;i<=n;i++)
		inv[i]=(LL)(MOD-MOD/i)*inv[MOD%i]%MOD;
	for (int i=2;i<=n;i++)
		inv[i]=(LL)inv[i-1]*inv[i]%MOD;
}

int A(int n,int m)
{
	return (LL)fac[n]*inv[n-m]%MOD;
}

int main()
{
	#ifdef local
		freopen("read.txt","r",stdin);
	#endif
	preprocess(200);
	int n,x;
	scanf("%d%d",&n,&x);
	for (int i=0;i<n;i++)
		scanf("%d",&s[i]);
	sort(s,s+n);
	for (int i=0;i<=x;i++)
	{
		for (int &j=up[i];j<n&&s[j]<=i;j++);
		up[i]--;
	}
	dp[x]=A(n,n-1-up[x]);
	for (int i=x;i>=1;i--)
	{
		for (int j=up[i];j>=0;j--)
		{
			int v=i%s[j];
			dp[v]=(dp[v]+(LL)dp[i]*A(up[i],up[i]-1-up[v]))%MOD;
		}
	}
	int ans=0;
	for (int i=1;i<s[0];i++)
		ans=(ans+(LL)i*dp[i])%MOD;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 896
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long n;
		long m = 0, a = 0, r = 0, c = 0, h = 0, count = 0;
		long d[];
		d = new long[5];
		int p[] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 2 };
		int q[] = { 1, 1, 1, 2, 2, 3, 2, 2, 3, 3 };
		int s[] = { 2, 3, 4, 3, 4, 4, 3, 4, 4, 4 };
		String tmp;

		n = sc.nextLong();

		for (int i = 0; i < n; ++i) {
			tmp = sc.next();
			if (tmp.charAt(0) == 'M')
				++m;
			if (tmp.charAt(0) == 'A')
				++a;
			if (tmp.charAt(0) == 'R')
				++r;
			if (tmp.charAt(0) == 'C')
				++c;
			if (tmp.charAt(0) == 'H')
				++h;
		}

		d[0] = m;
		d[1] = a;
		d[2] = r;
		d[3] = c;
		d[4] = h;
		for (int i = 0; i < 10; ++i) {
			count += d[p[i]] * d[q[i]] * d[s[i]];
		}
		System.out.println(count);

		sc.close();
	}

}


Measured memory_bytes: 48824
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()

    ret = INF
    for cost in range(min(A) - 1, max(A) + 1):
        tmp = 0
        for n in range(N):
            tmp += (A[n] - cost) ** 2
        ret = min(ret, tmp)
    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9848
//Lining Up

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    nvarep(n,a);
    sort(range(a));
    if(n%2){
        rep(i,0,n){
            if(a[i]!=(int)((i+1)/2)*2){
                cout<<0<<nnn;
                return 0;
            }
        }
    }else{
        rep(i,0,n){
            if(a[i]!=(int)((i+2)/2)*2-1){
                cout<<0<<nnn;
                return 0;
            }
        }
    }
    int ans = 1;
    rep(i,0,n/2)ans=(ans*2)%1000000007;
    cout<<ans<<nnn;
    return 0;
}

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

int main() {
	// your code goes here
	int n;
	cin>>n;
	if(n>=400&&n<=599)
	cout<<8;
	else if(n>=600&&n<=799)
	cout<<7;
	else if(n>=800&&n<=999)
	cout<<6;
	else if(n>=1000&&n<=1199)
	cout<<5;
	else if(n>=1200&&n<=1399)
	cout<<4;
	else if(n>=1400&&n<=1599)
	cout<<3;
	else if(n>=1600&&n<=1799)
	cout<<2;
	else if(n>=1800&&n<=1999)
	cout<<1;
	return 0;
}

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


int main(){
    int N; cin >> N;
    vector<int> v(N);
    rep(i,N){
        int a; cin >> a;
        v[i] = a;
    }

    ll res = (1LL<<60);
    for(int a=-100;a<=100;a++){
        ll sum = 0;
        rep(i,N){
            sum+=(v[i]-a)*(v[i]-a);
        }
        res = min(res,sum);
    }

    cout << res << endl;
}

Measured memory_bytes: 3616
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cinttypes>
#include <cstdint>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <forward_list>
#include <initializer_list>
#include <random>
#include <regex>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using ll = long long;

using Field = vector<vector<ll>>;
using Graph = vector<vector<ll>>;
using VI = vector<int>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VC = vector<char>;
using PI = pair<int, int>;

#define FOR(i, s, n) for (int i = s; i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()

const long long INF = 1LL<<60;
const int mod = 1000000007;

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

string K;
int D;
vector<vector<vector<ll>>> dp;

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cin >> K >> D;

    int N = K.length();

    dp.assign(N + 1, vector<vector<ll>>(2, vector<ll>(D + 1)));
    dp[0][0][0] = 1;

    for (int i = 0; i < N; i++) {
        for (int smaller = 0; smaller < 2; smaller++) {
            for (int d = 0; d < D; d++) {
                int c = K[i] - '0';
                for (int next = 0; next < 10; next++) {

                    if (smaller) {
                        dp[i + 1][smaller][(d + next) % D] += dp[i][smaller][d];
                        dp[i + 1][smaller][(d + next) % D] %= mod;
                    }

                    if (!smaller) {
                        if (next == c) {
                            dp[i + 1][0][(d + next) % D] += dp[i][smaller][d];
                            dp[i + 1][0][(d + next) % D] %= mod;
                        } else if (next < c) {
                            dp[i + 1][1][(d + next) % D] += dp[i][smaller][d];
                            dp[i + 1][1][(d + next) % D] %= mod;
                        }

                    }

                }
            }
        }
    }

    cout << (dp[N][0][0] + dp[N][1][0] - 1 + mod) % mod << endl;

    
    return 0;
}

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

using namespace std;

#define ll long long
struct Node{
    ll xi , yi , hp;
}inf[200];

ll hh(ll x , ll cx ,ll y ,ll cy ,ll H){
    return max(H - abs(x - cx) - abs(y - cy), 0ll);
}

int main()
{
    int N;
    scanf("%d",&N);
    for(int i = 0; i<N; i++){
        cin >> inf[i].xi >> inf[i].yi >> inf[i].hp;
    }
    ll ansH , ansx , ansy;
    ll tmpH;
    for(int i = 0; i<=100; i++){
        for(int j = 0; j<=100; j++){
            for(ll k = max(1ll, inf[0].hp-200); k<=max(1ll,inf[0].hp+200); k++){
                int co = 0;
                tmpH=k;
                for(int k = 0; k<N; k++){
                    if(hh(inf[k].xi , i , inf[k].yi , j , tmpH) == inf[k].hp)co++;
                    else break;
                }
                if(co == N){
                    ansx = i; ansy = j; ansH = tmpH;
                    break;
                }
            }
        }
    }
    cout << ansx << " " << ansy << " " << ansH << endl;
}


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


int main(){

    int N;
    int M;
    int C;
    
    cin >> N;
    cin >> M;
    cin >> C;

    int value;
    int B[M];

    for( int index = 0 ; index < M ; index++ ){
        cin >> B[index];
    }

    int A;
    int count;
    count = 0;
    for( int ai = 0 ; ai < N ; ai++ ){
        value = C;
        for( int ii = 0 ; ii < M ; ii++ ){
            cin >> A;
            value = value + B[ii] * A;
        }
        if(value > 0)    count = count + 1;
    }
    cout << count;    
}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

  string s;
  cin >> s;

  if (c == 0) {
    int64_t k2 = count(s.begin(), s.end(), 'o');
    if (k == k2) {
      for (auto i : irange(0L, n)) {
        if (s[i] == 'o') {
          cout << i + 1 << "\n";
        }
      }
    }

    return 0;
  }

  vector<int64_t> l(n), r(n);
  int64_t m = 0;
  for (auto i : irange(0L, n)) {
    l[i] = (i > 0 ? l[i - 1] : 0L);
    if (s[i] == 'o' && i >= m) {
      ++l[i];
      m = i + c + 1;
    }
    // cerr << "l[" << i << "] = " << l[i] << endl;
  }
  m = n - 1;
  for (auto i : irange(0L, n) | reversed) {
    r[i] = (i + 1 < n ? r[i + 1] : 0L);
    if (s[i] == 'o' && i <= m) {
      ++r[i];
      m = i - c - 1;
    }
    // cerr << "r[" << i << "] = " << r[i] << endl;
  }

  vector<int64_t> ans;
  int64_t j = 0;
  for (auto i : irange(-c + 1, n)) {
    int64_t t = (i > 0 ? l[i - 1] : 0L) + (i + c < n ? r[i + c] : 0L);
    if (t >= k) {
      //   cerr << i << ":ok:[" << j << "," << j + c << ")" << endl;
      j = i + c;
    }

    if (i == j) {
      ans.push_back(i);
      ++j;
    }
  }

  for (auto a : ans) {
    cout << a + 1 << endl;
  }
}

Measured memory_bytes: 3844
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std ;
#define int long long
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define mod 1000000007

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

int n ;
int arr[500005] ;
string str ;
void solve()
{
    cin >> n ;
    long double r = 2.00000000000000000000*(long double)(n)*3.141592653589793238 ;
    cout << fixed << setprecision(20) << r << "\n" ;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int tt = 1;
	//cin >> tt ;
	while(tt--)
	{
	     solve() ;
	}
}


Measured memory_bytes: 3804
macro_rules! scan {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
}

fn pow2(m: i64) -> i64 {
    if m == 0 {
        return 1;
    }
    2 * pow2(m - 1)
}

fn main() {
    let (n, m) = scan!(i64, i64);
    println!("{}", ((n - m) * 100 + m * 1900) * pow2(m))
}


Measured memory_bytes: 4352
void main() {
	auto ip = readAs!(int[]), N = ip[0], M = ip[1];
	alias Pair = Tuple!(int, "year", int, "index", int, "bangou", int, "ken");
	Pair[][int] pairs;
	auto kens = redBlackTree!int;
	foreach(i; 0..M) {
		auto ip2 = readAs!(int[]), P = ip2[0], Y = ip2[1];
		pairs[P] ~= Pair(Y, i, -1, P);
		kens.insert(P);
	}
	Pair[][] res;
	//pairs.writeln;
	foreach(p; kens.array) {
		auto arr = pairs[p].sort!"a.year < b.year"();
		foreach(i; 0..arr.length) {
			arr[i] = Pair(arr[i].year, arr[i].index, (i+1).to!int, arr[i].ken);
		}
		res ~= arr.array;
	}
	
	foreach(i; res.join.sort!"a.index < b.index") {
		writefln("%.6d%.6d", i.ken, i.bangou);
	}
}

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

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: 29180
#include<cstdio>
#include<algorithm>
using namespace std;

const int N = 1000000;
int dp[2][N+1],n;

int main(){
  for(int i=0;i<=N;i++)dp[0][i] = dp[1][i] = N;
  dp[0][0] = dp[1][0] = 0;

  int val = 1;
  for(int i=1;val<=N;i++){
    for(int j=0;j+val<=N;j++){
      int nxt = j+val;
      dp[0][nxt] = min(dp[0][nxt],dp[0][j] + 1);
      if(val&1)dp[1][nxt] = min(dp[1][nxt],dp[1][j] + 1);
    }
    val = i*(i+1)*(i+2)/6;
  }

  while(scanf("%d",&n),n)printf("%d %d\n",dp[0][n],dp[1][n]);
}

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
  
  int k,x;
  cin>>k>>x;
  if(x>500*k) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;

    return 0;
}

Measured memory_bytes: 256
n, l = map(int, input().split())

if l >= 0:
    print(l * (n - 1) + (n - 1) * n // 2)
elif l + n - 1 < 0:
    print(l * (n - 1) + (n - 1) * n // 2 - (n - 1))
else:
    print(l * n + (n - 1) * n // 2)

Measured memory_bytes: 38256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <list>
#include <set>
#include <utility>
#include <map>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <fstream>
using namespace std;
#define pi acos(-1)
#define N 1000000007
#define ll long long
#define ull unsigned long long
#define mem(a) memset(a,0,sizeof(a))

int main()
{
    int n;
    cin >> n;
    int flag = 0;
    int a = n%10;
    int b = n%100/10;
    int c = n/100;
    if(a==7||b==7||c==7) flag = 1;
    if(flag==1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


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

//関数

//main関数
int main() {
    //入力
    string S,T;
    cin>>S>>T;
    //計算
    long N=S.size();
    for(int i=1;i<N;i++){
        if((S.at(i-1)==S.at(i))!=(T.at(i-1)==T.at(i))){
            cout<<"No"<<endl;
            return 0;
        }
    }
    
    vector<long> alpS(26,-1);
    for(int i=0;i<N;i++){
        if(alpS.at(S.at(i)-'a')!=-1 && alpS.at(S.at(i)-'a')!=T.at(i)){
            cout<<"No"<<endl;
            return 0;
        }
        alpS.at(S.at(i)-'a')=T.at(i);
    }
    vector<long> alpT(26,-1);
    for(int i=0;i<N;i++){
        if(alpT.at(T.at(i)-'a')!=-1 && alpT.at(T.at(i)-'a')!=S.at(i)){
            cout<<"No"<<endl;
            return 0;
        }
        alpT.at(T.at(i)-'a')=S.at(i);
    }
    //出力
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 776
import java.util.Scanner;

/**
 * 
 */

/**
 * @author kawakami
 *
 */
class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		StringBuilder sb = new StringBuilder();
		Scanner as = new Scanner(System.in);
		
		int n = 0;
		int minv = 0;
		int maxv = 0;
		
		int R[];
		
		n = Integer.parseInt(as.next());
		
		R = new int[n];
		
		for(int i=0;i<n;i++){
			
			R[i] = Integer.parseInt(as.next());
			
		}
		
		minv = R[0];
		maxv = R[1] - R[0];
		
		for(int i=1;i<n;i++){
			
			if(maxv < (R[i] - minv)){
				
				maxv = (R[i] - minv);
				
			}
			if(minv > R[i]){
				
				minv = R[i];
				
			}
			
		}
		
		sb.append(maxv);
		System.out.println(sb.toString());

	}

}

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

int main(){
    int N;cin>>N;
    vector<int>A(N);
    rep(i,N){
        cin>>A.at(i);
    }
    vector<int>ans(N,0);
    int sum=0;
    for(int i=N-1;i>=0;i--){
        if(N/(i+1)<2){
            if(A.at(i)==0){
                ans.at(i)=0;
            }
            else{
                ans.at(i)=1;
                sum=sum+1;
            }
        }
        else{
            int count=0;
            for(int j=2;j<=N/(i+1);j++){
                count=count+ans.at(j*(i+1)-1);
            }
            count=count%2;
            if(A.at(i)==0){
                ans.at(i)=count;
            }
            else{
                ans.at(i)=(count+1)%2;
            }
            sum=sum+ans.at(i);
        } 
    }
    cout<<sum<<endl;
    rep(i,N){
        if(ans.at(i)==1){
            cout<<i+1<<" ";
        }
    }
}


Measured memory_bytes: 2432
#include<iostream>
#include<algorithm>
#include <cassert>
#include<string>
#include<vector>
#include <utility>
#include <math.h>
#include<cmath>
#include<map>
#include <limits>
# include <iomanip>
#define INF 1000000009;

using namespace std;
int gcd(int a, int b) {
	while (a % b != 0) {
		int c = 0;
		c = a % b;
		a = b;
		b = c;
	}
	return  b;
}
int kaizyo(int a) {
	long long ans = 1;
	for (int i = a; i > 0; i--) {
		ans *= i;
		ans = ans % 1000000007;
		//cout << ans << endl;
	}
	ans = ans % 1000000007;
	return ans;
}

signed main() {
	long long N, K,sum=0;
	cin >> N >> K;
	vector<pair<int, int>>ace;
	for (int i = 0; i < N; i++) {
		int a = 0, b = 0;
		cin >> a >> b;
		ace.push_back(make_pair(a,b));
	}
	sort(ace.begin(), ace.end());
	for (int i = 0; i < N; i++) {
		sum += ace[i].second;
		if (sum >= K) {
			cout << ace[i].first<<endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
	int n; cin >> n;
	vector<int> a(n), l(n);
	for (int i = 0; i < n; ++i) cin >> a[i];
	l[0] = a[0];
	int length = 1;
	for (int i = 1; i < n; ++i) {
		if (l[length - 1] >= a[i]) l[length++] = a[i];
		else *lower_bound(l.begin(), l.begin() + length, a[i], greater_equal<int>()) = a[i];
	}
	cout << length << endl;

	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;
ll n, ai, bi, ci;
vector<ll> l(8);

ll dfs(ll cur, ll a, ll b, ll c) {
  if (cur == n) {
    if (min({a, b, c}) == 0) return INF;
    return abs(ai - a) + abs(bi - b) + abs(ci - c);
  }

  ll r0 = dfs(cur + 1, a, b, c);
  ll r1 = dfs(cur + 1, a + l[cur], b, c) + (a > 0 ? 10 : 0);
  ll r2 = dfs(cur + 1, a, b + l[cur], c) + (b > 0 ? 10 : 0);
  ll r3 = dfs(cur + 1, a, b, c + l[cur]) + (c > 0 ? 10 : 0);
 return min({r0, r1, r2, r3});
}

int main() {
  cin >> n >> ai >> bi >> ci;

  rep(i, n) cin >> l[i];

  cout << dfs(0, 0, 0, 0) << endl;

  return 0;
}


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

int main(){
    uint64_t x,y;
    cin>>x>>y;

    uint64_t num=0;
    while(x<=y){
        num++;
        x*=2;
    }

    cout<<num<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int k; cin >> k;
    int cnt = 0;
    while(a >= b){
        b *= 2; cnt++;
    }
    while(b >= c){
        c *= 2; cnt++;
    }
    if(cnt <= k) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3636
#include <stdio.h>

int main(void) {
  int H,W;
  int h,w;

  while (1) {
    scanf("%d %d", &H, &W);
    if (H == 0 && W == 0) break;

    for (h = 0; h < H; h++) {
      for (w = 0; w < W; w++) {
        if (
            (h != 0 && h != H - 1) &&
            (w != 0 && w != W - 1)
           ) {
          printf(".");
        }
        else {
          printf("#");
        }
      }
      printf("\n");
    }
    printf("\n");
  }
  return (0);
}



Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;

int main()
{
	ios::sync_with_stdio(false);

	string s;
	cin >> s;
	int len = s.length(), k = 1;
	string s1 = "", s2 = "";
	s1 += s[0];
	for(int i = 1; i < len; i++) {
		s2 += s[i];
		if(i == len - 1 && s1 == s2) break;
		else if(i == len - 1) k++;
		else if(s1 == s2) {
			i++;
			k++;
			s2+=s[i];
//			cout << "s2 = " << s2 << " ";
			s1 = s2;
			s2 = "";
		}
		else {
			k++;
//			cout << "s2 = " << s2 << " ";
			s1 = s2;
			s2 = "";	
		}
	}
	cout << k << endl;
} 

Measured memory_bytes: 720
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace kp
{
    public class Program
    {
        //static long[,] cmb;
        static int MAX_INT = 1000000007;
        static void Main(string[] args)
        {
            //int N = Int32.Parse(Console.ReadLine());
            int[] input = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();
            int N = input[0];
            int M = input[1];

            // M行読み込む
            List<List<int>> switchState = new List<List<int>>();
            for(int i=0; i<M; i++)
            {
                input = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();
                List<int> s = new List<int>();
                for(int j=0; j<input[0]; j++)
                {
                    s.Add(input[j + 1]);
                }
                switchState.Add(s);
            }
            // 電球が点灯する状態を読み込む
            input = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();

            // 2^N通りのスイッチの状態で、電球が全てつくかチェックする
            int end = (int)Math.Pow((double)2, (double)(N));
            int ret = 0;
            for(int i=0; i<end; i++)
            {
                string bi = Convert.ToString(i, 2).PadLeft(N, '0');

                // 全ての電球が点灯するかチェックする
                bool allLit = true;
                for(int j=0; j<M; j++)
                {
                    List<int> s = switchState[j];
                    int litnum = 0;
                    for(int k=0; k<s.Count; k++)
                    {
                        if (bi[s[k] - 1] == '1')
                            litnum++;
                    }
                    if(litnum%2 != input[j])
                    {
                        allLit = false;
                        break;
                    }
                }
                if (allLit)
                    ret++;
            }
            Console.WriteLine(ret + "");
        }
    }
}


Measured memory_bytes: 13396
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque, defaultdict
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations,product#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
from functools import reduce,lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("## ",*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def binr(x): return bin(x)[2:]
def bitcount(x): #xは64bit整数
    x= x - ((x >> 1) & 0x5555555555555555)
    x= (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x= (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f 
    x+= (x >> 8); x+= (x >> 16); x+= (x >> 32) 
    return x & 0x7f

def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reverse=True)  #二個目の要素で降順並び替え

    N = int(input())
    #N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    ans=0
    tc=Counter()
    for _ in range(N):
        s=input()
        c=Counter(s)
        l=tuple(c[num2alp(i)] for i in range(26))

        tc[l]+=1
    for val in tc.values():
        ans+=val*(val-1)//2
    print(ans)





if __name__ == "__main__":
    main()

Measured memory_bytes: 141104
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N,K,sum=1;
	cin>>N>>K;
	for(int i= 0;i<N;i++){
		if(sum*2>sum+K){
		sum +=K;
		}else{
		sum *=2;
		}
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 256
fn main() {
    let nk = read_vec::<usize>();
    let n = nk[0];
    let k = nk[1];
    let v = read_vec::<usize>();
    let mut s = vec![0; n+1];

    for i in 0..n {
        s[i+1] = s[i] + v[i] + 1;
    }

    let mut ma = 0;
    for i in 0..n+1-k {
        if s[i+k] - s[i] > ma {
            ma = s[i+k] - s[i];
        }
    }

    println!("{}", ma as f64 / 2.0);
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 8444
#include <bits/stdc++.h>
#define int long long
#define double long double
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define fcout cout << fixed << setprecision(10)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


int N, M;
int s[10], c[10];


bool jdg(string x){
    rep(i, 0, M) if(x[s[i]-1] != c[i]+'0') return false;
    return true;
}


signed main(){
    cin >> N >> M;
    rep(i, 0, M) cin >> s[i] >> c[i];

    int ans = -1;
    rep(i, 0, POW(10, N)){
        string x = to_string(i);
        if(SZ(x) != N) continue;
        if(jdg(x)){ ans = i; break; }
    }

    cout << ans << endl;

    return 0;
}

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

#define x first
#define y second

using namespace std;

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

ll b=LLONG_MAX;
ll n,s;

int main() {
	cin >> n >> s;
	for (ll base=2;base<=1000000;base++) {
		ll digsum=0;
		ll tnum=n;
		while (tnum) {
			digsum+=tnum%base;
			tnum/=base;
		}
		if (digsum==s && base<b) b=base;
	}
	//cout << b << endl;
	for (ll q=1;q<=1000000;q++) {
		ll nr=s-q;
		ll t=n-nr;
		if (t%q==0 && nr>=0) {
			ll nb=t/q;
			if (nb<b && nr<nb && nb>1 && n/nb+n%nb==s && n/nb/nb==0) b=nb;
		}
	}
//cout << b << endl;
	if (n==s && b>n+1) b=n+1;

	if (b==LLONG_MAX) b=-1;
	cout << b << endl;
}

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

int main(){
    int H;
    scanf("%d\n",&H);
    
    int a[H];
    int i;
    for(i=0;i<H;i++)scanf("%d \n",&a[i]);
    
    for(i=1;i<=H;i++){
        printf("node %d: key = %d, ",i,a[i-1]);
        if(i!=1)printf("parent key = %d, ",a[(int)ceil(i/2)-1]);
        if(2*i<=H)printf("left key = %d, ",a[i*2-1]);
        if(2*i+1<=H)printf("right key = %d, ",a[i*2]);
        printf("\n");
    }
    
    return 0;
}


Measured memory_bytes: 2128
n = int(input())
a= input().split()
level = pow(10, 18)
product = 1

if "0" in a:
  print(0)
else:
  for num in range(n):
    product *= int(a[num])
    if product > level:
      print("-1")
      break
  if product <= level:
    print(product)

Measured memory_bytes: 19320
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce, lru_cache  # @lru_cache(None)
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return (int(x) for x in input().split())
def LI(): return list(Is())
def TI(): return tuple(Is())
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(S())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

s = S()
n = len(s)
t = n
for i in range(n-1):
    if s[i] != s[i+1]:
        t = min(t, max(i+1, n-i-1))
print(t)


Measured memory_bytes: 65132
N = int(input())
t = N
d = 1
s = ''

while t-26**d > 0:
    t -= 26**d
    d += 1
t -= 1

while t > 0:
    r = t % 26
    t //= 26
    s += chr(r+ord('a'))

s += 'a' * max(0, d-len(s))
print(s[::-1])

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

int main(){
  int N, M, A, B;
  cin >> N >> M;
  vector <int> X(N);
  for (int i = 0; i < M; i++){
    cin >> A >> B;
    X.at(A - 1)++;
    X.at(B - 1)++;
  }
  
  for (int i = 0; i < N; i++){
    cout << X.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(void)
{
	int a[3],n,x,y,i;
	y=0;
	for(i=0;i<3;i++){
		cin>>a[i];
		if(y<a[i]) y=a[i];
	//	cout<<"y"<<y<<endl;
	}
	//cout<<"1"<<endl;
	x=0;
	for(i=0;i<3;i++){
		x=x+a[i];
	}
	x=x-y;
	//cout<<"x"<<x<<endl;
	//cout<<"2"<<endl;
	cin>>n;
	//cout<<"3"<<endl;
	for(i=0;i<n;i++){
		y=y*2;
	}
	//cout<<"y"<<y<<endl;
	x=x+y;
	cout<<x<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    double R = in<double>();
    cout << R*2*acos(-1) << "\n";
}

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

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

	int S = 1; for (int i = 0; i < D; i++) S *= 100; //べき乗10^d
	if (N <= 99) {
		cout << S * N << endl;
	}
	else {
		cout << S * 101 << endl;
	}
	return 0;
}


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

int main() {
  int64_t k;
  cin >> k;
  
  queue<int64_t> q;
  for (int64_t i = 1; i <= 9; i++) {
    q.emplace(i);
  }
  
  for (int64_t i = 0; i < k - 1; i++) {
    int64_t x = q.front();
    q.pop();
    
    for (int64_t d = max<int64_t>(0, x % 10 - 1); d <= min<int64_t>(9, x % 10 + 1); d++) {
      q.emplace(10 * x + d);
    }
  }
  
  cout << q.front() << endl;
  
  return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <math.h>

int main(void)
{
	int i,n;
	char str[16];
	
	while(1)
	{
		scanf("%d",&n);
		if(n==0)
		{
			break;
		}
		
		sprintf(str,"%o",n);
		
		for(i=0;str[i]!='\0';i++)
		{
			if(str[i]>='4')
			{
				str[i]++;
			}
			if(str[i]>='6')
			{
				str[i]++;
			}
		}
		
		printf("%s\n",str);
	}
	return 0;
}


//46が使えないので8進数
//01234567ではなく01235789の8進数なので桁ごとに補正をかける

Measured memory_bytes: 620
import sys
from bisect import bisect_left

def solve():
    n = int(input())
    A = [int(input()) for i in range(n)]

    inf = 10**9 + 1
    dp = [inf] * n

    for a in A:
        j = bisect_left(dp, a)
        dp[j] = a

    for i, v in enumerate(dp):
        if v == inf:
            print(i)
            return

    print(n)

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

if __name__ == '__main__':
    solve()

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

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define RREP(i,a) for(int i = a;i >= 0;i--)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))
#define xyrange(x, minX, maxX, y, minY, maxY) (range(x, minX, maxX) && range(y, minY, maxY))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;
typedef vector<PII> VPII;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
const int INF = 0x3f3f3f3f;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    s1[0] = toupper(s1[0]);
    s2[0] = toupper(s2[0]);
    s3[0] = toupper(s3[0]);
    cout << s1[0] << s2[0] << s3[0] << endl;
    return 0;
}

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

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define ph push
#define f first
#define s second
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define btinpct(x) __builtin_popcountll((x))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return (rng() % (y+1-x)) + x; } //inclusivesss
string to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){if(a>b)swap(a,b);if(a==0)return b;return gcd(b%a,a);}

#define ll long long int 
#define ld long double
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
typedef pair <ll, ll> pi; typedef pair <ll, pi> spi; typedef pair <pi, pi> dpi;

#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
// #define cerr if(0)cout
#define MAXN (200006)

int main()
{
	FAST
	ll n, k;
	cin>>n>>k;
	vector<ll> A(n+1, 0);
	FOR(i,1,n) cin>>A[i]; // 1 .. N-K+1
	ll ans = n-k+1; ll sorts=0;
	ll p=0;
	FOR(i,1,n) {
		if(A[i] >= A[i-1]) ++ p; // A[0] = 0(I'm 1 indexed)
		else p=1;
		if(p == k) ++ sorts;
	}
	ans -= max((ll)0, sorts-1);
	ll e=2;
	deque<ll> dq_mx, dq_mi;
	dq_mx.pb(A[1]), dq_mi.pb(A[1]);
	FOR(i,2,n-(k-1)) {
		if(dq_mx.size() && dq_mx[0] == A[i-1]) dq_mx.pop_front();
		if(dq_mi.size() && dq_mi[0] == A[i-1]) dq_mi.pop_front();
		while(e <= i+(k-1)-1) {
			while(dq_mx.size() && dq_mx.back() < A[e]) dq_mx.pop_back();
			dq_mx.pb(A[e]);
			while(dq_mi.size() && dq_mi.back() > A[e]) dq_mi.pop_back();
			dq_mi.pb(A[e]);
			 ++ e;
		}
		if(dq_mx.size() && dq_mi.size()) {
			assert(dq_mx[0] >= dq_mi[0]);
			if(A[i-1] < dq_mi[0] && dq_mx[0] < A[i+k-1]) -- ans;
		}
	}
	cout<<ans<<'\n';
}
/*
5 3
0 2 1 4 3
*/ 


Measured memory_bytes: 3456
gets.to_i
T = gets.chomp.split(" ").map(&:to_i)
M = Array.new(gets.to_i).map{
  gets.chomp.split(" ").map(&:to_i)
}

wk = T.inject(:+)
M.map!{|q, x|
  wk - T[q-1] + x
}

puts M * "\n"


Measured memory_bytes: 1788
from collections import defaultdict


def factorize(n):
    facts = defaultdict(int)
    while n % 2 == 0:
        n //= 2
        facts[2] += 1
    m = 3
    while m * m <= n:
        while n % m == 0:
            facts[m] += 1
            n //= m
        m += 2
    if 1 < n:
        facts[n] += 1
    return facts


MOD = 10 ** 9 + 7  # should be a prime number
MAX = 10 ** 5 + 100
FACTS = [1] * (MAX + 1)
for i in range(1, MAX + 1):
    FACTS[i] = FACTS[i - 1] * i % MOD
FACTINVS = [1] * (MAX + 1)
INVS = [1] * (MAX + 1)
for i in range(2, MAX + 1):
    q, r = divmod(MOD, i)
    INVS[i] = -INVS[r] * q % MOD
    FACTINVS[i] = FACTINVS[i - 1] * INVS[i] % MOD


def nCr(n, r):
    return FACTS[n] * FACTINVS[r] * FACTINVS[n - r]


N, M = map(int, input().split())
factors = factorize(M)
ans = 1
for p, e in factors.items():
    ans = ans * nCr(N - 1 + e, e) % MOD
print(ans)

Measured memory_bytes: 21120
s = int(input())
A = [s]
m = 100000
i = 0
while i <= m:

    if A[i] % 2 == 0:
        s = s/2
    else:
        s = 3*s+1
    
    i += 1
    s = int(s)
    if s in A:
        print(i+1)
        exit()
    else:
        A.append(s)

Measured memory_bytes: 3064