akhauriyash/Code-Regression huggingface dataset:
fun main(args: Array<String>) {
    val (x, y) = readLine()!!.split(" ").map{ it.toInt() }
    var a = -1
    for(i in 0 until 1009){
        if((i * 0.08).toInt() == x && (i * 0.1).toInt() == y){
            a = i
            break;
        }
    }
    println (a)
}


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

int count_hor(char *s, int len) {
    int count = 0;
    for (int i=0; i<len; i++) {
        if (s[i] != '.') count++;
    }
    return count;
}

int main() {
    int h = 0, w = 0;
    scanf("%d %d\n", &h, &w);
    char s[h][w+2];
    int h_now = h, w_now = w;
    for (int i=0; i<h; i++) {
        fgets(s[i], w+2, stdin);
    }
    for (int i=0; i<h_now; i++) {
        if (!count_hor(s[i], w_now)) {
            for (int j=i; j<h_now-1; j++) {
                strcpy(s[j], s[j+1]);
            }
            h_now--;
            i--;
        }
    }
    for (int i=0; i<w_now; i++) {
        int count = 0;
        for (int j=0; j<h_now; j++) {
            if (s[j][i] != '.') count++;
        }
        if (!count) {
            for (int j=0; j<h_now; j++) {
                for (int k=i; k<w_now+2; k++) {
                    s[j][k] = s[j][k+1];
                }
            }
            w_now--;
            i--;
        }
    }
    for (int i=0; i<h_now; i++) {
        printf("%s", s[i]);
    }
    return 0;
}


Measured memory_bytes: 128
N = int(input())
N_length = len(str(N))

if N_length == 1:
    print(N)
if N_length == 2:
    print(9)
elif N_length == 3:
    print(9 + (N - 99))
elif N_length == 4:
    print(9 + (999 - 99))
elif N_length == 5:
    print(9 + (999 - 99) + (N - 9999))
elif N_length == 6:
    print(9 + (999 - 99) + (99999 - 9999))


Measured memory_bytes: 3060
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(18);
}
void solve(){
  ll n,m,k,point;
  double ans=0;
  cin >> n >> m >> k;
  if(n==0&&m==0) return;
  vector<double> val(n*m+1,0);
  val[n] = 1;
  for(int i=0;i<n;i++){
    for(int j=n*m;j>=0;j--){
      if(j-m>=0){
        val[j] -= val[j-m];
      }
    }
    for(int j=0;j<=n*m;j++){
      val[j] /= m;
    }
  }
  for(int i=0;i<n;i++){
    for(ll j=1;j<=n*m;j++){
      val[j] += val[j-1];
    }
  }
  for(int i=1;i<=n*m;i++){
    point = max(1ll,i-k);
    ans += val[i]*point;
  }
  cout << ans << endl;
  solve();
}
signed main(){
  init_io();
  solve();
}



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

int main(void){
  int N;
  int T, A;
  cin >> N >> T >> A;
  
  vector<int> difference(N);
  
  for (int i = 0; i < N; i++) {
    int h;
    cin >> h;
    difference.at(i) = abs(1000 * T - h * 6 - A * 1000);
  }
  
  int ans = 0;
  
  for (int i = 0; i < N; i++) {
    if (difference.at(ans) > difference.at(i)) {
      ans = i;
    }
  }
  
  cout << ans + 1 << endl;
}

Measured memory_bytes: 256
import java.util.*;

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

        int n = scner.nextInt();
        int[] S = new int[n];
        for (int i=0; i<n; i++) {
            S[i] = scner.nextInt();
        }

        int q = scner.nextInt();
        int[] T = new int[q];
        for (int i=0; i<q; i++) {
            T[i] = scner.nextInt();
        }
        int num = seSearch(q, n, S, T);
        System.out.println(num);
       }

    public static int seSearch(int c, int d, int[] a, int[] b) {
     int solve = 0;
     for (int i=0; i<c; i++){
        for (int j=0; j<d; j++){
        if (a[j] == b[i]){
            solve++;
            break;
        }
        }
    }

    return solve;

    }

}


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

int main(){
  int A,B; cin >> A >> B;
  if(B == 1){
    cout << '0' << endl;
  }
  else if(A>=B){
    cout << '1' << endl;
  }
  else{
    for(int i=2;;i++){
      if((i-1)*A-i+3 <= B && B <= i*A-i+1){
        cout << i << endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 256
n = input()
p = [10,10**2,10**3,10**4,10**5]
ans = 0
for i in range(len(p)):
    if int(n) == p[i]:
        ans = 10
        break
else:
    for i in range(len(n)):
        ans += int(n[i])
print(ans)

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main(){
	//cin.tie(0); ios_base::sync_with_stdio(false);
	string s;
	cin >>s;
	int n=sz(s);
	string mt1=s, mt2=s;
	rep(i, n){
		if(i%2){mt1[i]='0';mt2[i]='1';}
		else {mt1[i]='1';mt2[i]='0';}
	}
	int a1=0, a2=0;
	rep(i,n){
		if(mt1[i] !=s[i]) a1++;
		if(mt2[i] !=s[i]) a2++;
	}
	cout << min(a1, a2) <<"\n";
	return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cstdio>

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

using namespace std;

struct edge{ int u,v,w; };

const int INF=1<<30;

int main(){
	int n,m,p; scanf("%d%d%d",&n,&m,&p);
	edge E[5000];
	rep(i,m){
		scanf("%d%d%d",&E[i].u,&E[i].v,&E[i].w);
		E[i].u--; E[i].v--; E[i].w-=p;
	}

	int d[2500];
	rep(u,n) d[u]=(u==0?0:INF);
	bool neg[2500]={};
	rep(t,4*n) rep(i,m) {
		int u=E[i].u,v=E[i].v,w=-E[i].w;
		if(d[v]>d[u]+w){
			d[v]=d[u]+w;
			if(t>=n-1) neg[v]=true;
		}
	}

	bool vis1[2500]={}; // set of vertices reachable from 0
	vis1[0]=true;
	rep(t,n) rep(i,m) {
		int u=E[i].u,v=E[i].v;
		if(u!=v && vis1[u]) vis1[v]=true;
	}

	// set of vertices reachable from n-1 in the reversed graph
	bool vis2[2500]={};
	vis2[n-1]=true;
	rep(t,n) rep(i,m) {
		int u=E[i].u,v=E[i].v;
		if(u!=v && vis2[v]) vis2[u]=true;
	}

	rep(u,n) if(neg[u] && vis1[u] && vis2[u]) { puts("-1"); return 0; }

	printf("%d\n",max(-d[n-1],0));

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <functional>

using namespace std;
using ll = long long;

#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;

int main() {
	int a, b;
	scanf("%d%d%d", &a, &b);
	printf("%d",(a+b)%24);
	return 0;
}


Measured memory_bytes: 256
import numpy as np
array=np.array([[0,1]])
cnt=1
N=int(input())
import sys

if 0<=N<=1:
    print(N)
    sys.exit()

while(1):
    array=np.append(array,np.array([[((-2)**cnt)+np.min(array),((-2)**cnt)+np.max(array)]]),axis=0)
    if array[-1][0]<=N<=array[-1][1]:
        break
    else:
        cnt+=1
for i in range(len(array)-1,0,-1):
    if array[i][0]<=N<=array[i][1]:
        print(1,end="")
        N=N-(-2)**(i)
    else:
        print(0,end="")
print(N)

Measured memory_bytes: 12396
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  maxn = 1e6 + 5;

string s;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>s;
	if(s=="AAA" || s=="BBB"){
		cout<<"No";
	}else
	    cout<<"Yes";
	return 0;
}

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

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    int x[n];
    int y[n];
    for(int i = 0; i < n; i++){
        int X;
        scanf("%d", &X);
        x[i] = X;
        y[i] = X;
    }

    sort(y, y + n);

    int l = y[(n-1)/2];
    int g = y[(n+1)/2];
    for(int i = 0; i < n; i++){
        if (l >= x[i]) printf("%d\n", g);
        else printf("%d\n", l);
    }
    
}

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

#define vv vector< vector< int > >
#define ll long long
#define ALL(a) (a).begin(), (a).end()

vector<bool> seen(200000, false);
vector<int> cnt(200000, 0);
vector<int> tree[200000];

void dfs(int v){
    seen[v] = true;
    for(auto next_v : tree[v]){
        if(seen[next_v]) continue;
        cnt[next_v] += cnt[v];
        dfs(next_v);
    }   
}

int main(){
    int N, Q;
    cin >> N >> Q;
    for(int i = 0; i < N-1; ++i){
        int a, b;
        cin >> a >> b;
        a--; b--;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    for(int i = 0; i < Q; i++){
        int p, x;
        cin >> p >> x;
        p--;
        cnt[p] += x;
    }    
    dfs(0);
    for(int i = 0; i < N; ++i) cout << cnt[i] << ' ';
    cout << endl;

    return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define EPS (1e-8)

int getNum(string str, int pos) {
	return (str[pos] - '0') * 10 + str[pos + 1] - '0';
}

int main() {
	int n;
	cin >> n;
	while (n--) {
		string str;
		cin >> str;
		int h = getNum(str, 0), m = getNum(str, 3);
		
		double angle1 = m * 6.0, angle2 = h * 30.0 + m / 2.0;
		double div = min(abs(angle1 - angle2), 360.0 - abs(angle1 - angle2));
		
		if (div >= 0 && div < 30.0)
			puts("alert");
		else if (div >= 90.0 && div <= 180.0)
			puts("safe");
		else
			puts("warning");
	}
	return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    string S; cin >> S;
    ll ans = 0;
    ll N = S.size();
    rep(i, N / 2){
        if (S[i] != S[N - 1 - i]){ans++;}
    }
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; 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 maxs(x,y) (x=std::max(x,y))
#define mins(x,y) (x=std::min(x,y))

int main() {
  double A, B;
  cin >> A >> B;
  constexpr double a_partial = 0.08;
  constexpr double b_partial = 0.10;

  bool is_minus = false;

  int left = 0;
  for (;left < 100000;++left) {
    double c = floor(left*a_partial);
    double d = floor(left*b_partial);
    if (c > A || d > B) {
      is_minus = true;
      break;
    } else if (c == A && d == B) {
      break;
    }

  }

  if (is_minus == true) {
    cout << "-1\n";
  } else {
    cout << left << '\n';
  }
}


Measured memory_bytes: 384
#ABC 133 Remainder Minimization 2019
l, r = [ int(_) for _ in input().split() ]

ls = [2018]

for i in range(l,r):
    for j in range(i+1,r+1):
        y = (i*j) % 2019
        if y < min(x for x in ls):
            ls.append(y)
        if y == 0:
            break
    if y == 0:
        break
    
print(min([ x for x in ls]))

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, m, y, k, z, N;
ll s, t, d;


// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> N;
	x = y = k = 0;

	for(ll i=0;i<N;i++) {
		cin >> z >> n >> m;
		t  = z - k;
		d = abs(n-x) + abs(m-y);

		if(d > t) {
			cout<<"No";
			return;
		}
		//cout<<t<<" "<<d<<"\n";
		if((t-d)%2==1) {
			cout<<"No";
			return;
		}

		k = z;
		x = n;
		y = m;
	}

	cout<<"Yes";
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a[]={0,2,0,1,0,1,0,0,1,0,1,0};
  int x,y;
  cin>>x>>y;
  if(a[x-1]==a[y-1]){cout<<"Yes";}
  else{cout<<"No";}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		if (M % N == 0) {
			System.out.println(M / N);
		}else {
			int max = M / N;
			for (int a = max; a > 0; a--) {
				if (M % a == 0) {
				System.out.println(a);
				break;
				}
			}
		}
		sc.close();
	}

}


Measured memory_bytes: 24020
n,y = map(int, input().split())

for i in range(n+1):
    yukichi=10000*i
    for j in range(n+1-i):
        ichiyou=5000*j
        if y-(yukichi+ichiyou)>=0:
            if (y-(yukichi+ichiyou))//1000==(n-i-j):
                print(i,j,n-i-j)
                exit()

print(-1,-1,-1)

Measured memory_bytes: 9100
#include <iostream>
using namespace std;
int visited[100]={0};
int V[100][100]={0};
int start[100]={0};
int finish[100]={0};
int t=1;

void dfs(int i,int n){
  start[i]=t++;
  visited[i]++;
  for(int j=0;j<n;j++){
    if(V[i][j]==1 and visited[j]==0){
      dfs(j,n);
    }
  } 
  finish[i]=t++;
}



int main () {
    int n,k;
    int p1, p2;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            V[i][j] = 0;
        }
  }
  for(int i=0;i<n;i++){
    cin>>p1>>k;
    for(int j=0;j<k;j++){
      cin>>p2;
      V[p1-1][p2-1]=1;
    }
  }
  for(int i=0;i<n;i++){
    if(visited[i]==0){
      dfs(i,n);
    }
  }
  for(int i=0;i<n;i++){
      cout << i + 1 << " ";
      cout<<start[i] << " " << finish[i] << "\n";
  }


  return 0;
}


Measured memory_bytes: 3132
#include<iostream>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cstdlib>
using namespace std;
#define fr first
#define sc second
typedef pair<int,int> P;
P s,g;
typedef pair< P , P > Q;
int h,w,sx,sy,gx,gy,c,dx[]={0,1,0,-1},dy[]={1,0,-1,0},num[105][105];
bool used[2500][105][105];
char wara[100];
int bfs();
int main(){
  while(cin >> w >> h && w || h){
    memset(num,0,sizeof(num));
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        cin >> wara;
        if(strcmp(wara,"S") == 0 ) s = P(i,j);
        else if(strcmp(wara,"G") == 0) g = P(i,j);
        else if(strcmp(wara,".") != 0){
          c = max(c,atoi(wara));
          num[i][j] = atoi(wara);
        }
      }
    }
    num[g.fr][g.sc] = c + 1;
    cout << bfs() << endl;
    c = 0;
  }
}
int bfs(){
  memset(used,false,sizeof(used));
  queue<Q> que;
  que.push(Q(s,P(1,0)));
  used[1][s.fr][s.sc] = true;
  while(!que.empty()){
    Q q = que.front();
    que.pop();
    if(q.sc.fr == c+1 && q.fr == g) return q.sc.sc;
    if(num[q.fr.fr][q.fr.sc] == q.sc.fr && !used[q.sc.fr+1][q.fr.fr][q.fr.sc]){
      used[q.sc.fr+1][q.fr.fr][q.fr.sc] = true;
      q.sc.fr++;
    }
    for(int i=0;i<4;i++){
      int nx = q.fr.fr + dx[i],ny = q.fr.sc + dy[i];bool flg = true;
      if(nx>=0 && nx<h && ny>=0 && ny<w && !used[q.sc.fr][nx][ny]){
        used[q.sc.fr][nx][ny] = true;
        que.push(Q(P(nx,ny),P(q.sc.fr+(flg?0:1),q.sc.sc+1)));
      }
    }
  }
  return -1;
}

Measured memory_bytes: 28220
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;


int main()
{
    int n;
    cin>>n;
    vector<int>a(n);
    vector<int>ans(n);
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++){
        ans[a[i]-1]=i+1;
    }
    for(int i=0;i<n;i++)cout<<ans[i]<<" ";
    return 0;
}


Measured memory_bytes: 3984
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;


int main() {
    cin>>N>>M;
    vec a(N), b(N), c(M), d(M);
    rep(i,N) cin>>a[i]>>b[i];
    rep(i,M) cin>>c[i]>>d[i];
    rep(i,N){
        ll dist = MOD, num = 0;
        rep(j,M){
            if(dist > abs(a[i] - c[j]) + abs(b[i] - d[j])){
                dist = abs(a[i] - c[j]) + abs(b[i] - d[j]);
                num = j + 1;
            }
        }
        cout<<num<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
#include<vector>
#include<string>
#define ll long long
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vi vector<ll>
#define el printf("\n")
#define N 100001
using namespace std;
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.first < b.first);
}


int main()
{   IOS;
cout.precision(30);
   ll n,x;
   cin >> n >> x;
   vi L;
   ll sum=0,res=0;

   for(int i=0;i<n;i++)
   {
       ll u;
       cin >> u;
       sum+=u;
       if(sum<=x)
        res++;
   }
    cout << res+1;
    return 0;
}


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

int main()
{

    string S;
    cin >> S;
    
    int flag = 1;
    int count = 0;
    
    for(auto s: S){
        count++;
        
        if(count%2 == 1){
            if((s == 'R') || (s == 'U') || (s == 'D')){
                flag = flag * 1;
            }
            else{
                flag = 0;
            }
        }
        else{
            if((s == 'L') || (s == 'U') || (s == 'D')){
                flag = flag * 1;
            }
            else{
                flag = 0;
            }
        }
    }
    
    if (flag == 1) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

namespace atcoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var S = Console.ReadLine();
            Console.WriteLine(new string('x', S.Length));
        }
    }
}


Measured memory_bytes: 17244
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	static List<Long> nums = new ArrayList<Long>();

	static void dfs(int d, long val){
		nums.add(val);
		if(d >= 10) return;
		for(int i = -1; i <= 1; i++){
			int add = (int)(val % 10) + i;
			if(add >= 0 && add <= 9){
				dfs(d+1, val*10+add);
			}
		}
	}

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int K = sc.nextInt();
    	sc.close();
    	for(int i = 1; i < 10; i++){
    		dfs(1, i);
    	}
    	Collections.sort(nums);
    	System.out.println(nums.get(K-1));
    }
}

Measured memory_bytes: 32592
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <memory.h>
#include <cmath>
#include <array>

using namespace std;

void re(int& x);

template<class T> void re(std::vector<T>& a);

void pr(const char *x);

void ps();
template<class T, class... Ts> void ps(const T& t, const Ts&... ts);

#ifdef FFDBG

#else
#define dbg(x...) dsfdsfsdfasd
#endif

typedef vector<int> vi;

int n;

void solve()
{
    re(n);
    vi a(n); re(a);

    vi h(n, -1);

    h[0] = 0;
    for (int i = 2; i != 0; i = (i+2)%n) {
        h[i] = (h[(i+n-2)%n] ^ a[(i+n-1)%n]);
    }

    if ((h[0] ^ h[n-2]) != a[n-1]) {
        ps("No");
        return;
    }

    if (h[1] == -1) {
        h[1] = 0;
        for (int i = 3; i != 1; i = (i+2)%n) {
            h[i] = (h[(i+n-2)%n] ^ a[(i+n-1)%n]);
        }    

        if ((h[1] ^ h[n-1]) != a[0]) {
            ps("No");
            return;
        }   
    }
    
    ps("Yes");
}

int main() {

    solve();
}

void re(int& x) { scanf("%d", &x); }

template<class T> void re(std::vector<T>& a) { for (int i = 0; i < a.size(); i++) re(a[i]); }

void pr(const char *x) { printf("%s", x); }

void ps() { pr("\n"); }
template<class T, class... Ts> void ps(const T& t, const Ts&... ts) { 
    pr(t); if (sizeof...(ts)) pr(" "); ps(ts...); 
}



Measured memory_bytes: 1024
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on
immutable long MOD = 1000000007;
void main()
{
    auto input = stdin.byLine.map!split.joiner;

    long S;
    S = input.front.to!long;
    input.popFront;

    solve(S);
}

void solve(long S)
{
    f(S).writeln();
}

long f(long x)
{
    if (x < 3)
        return 0;
    // dprint(x);
    long ret;
    foreach (y; 3 .. x - 3 + 1)
    {
        ret += memoize!(f)(y);
        ret %= MOD;
    }
    return ret + 1;
}


Measured memory_bytes: 3792
from itertools import permutations
from heapq import *

N,M,R=map(int,input().split())
r=list(map(int,input().split()))
INF=float("inf")
G=[[INF]*N for i in range(N)]
for i in range(M):
    A,B,C=map(int,input().split())
    A,B=A-1,B-1
    G[A][B]=C
    G[B][A]=C
def distance(a,b):
    stack=[(G[a][i],i) for i in range(N) if G[a][i]!=INF]
    heapify(stack)
    reached=[0]*N
    reached[0]=1
    dis=[INF]*N
    dis[0]=0
    while(stack):
        c,i=heappop(stack)
        if reached[i]==1:
            continue
        if dis[i]<=c:
            continue
        dis[i]=c
        if i==b:
            return c
        reached[i]=1
        for j in range(N):
            if G[i][j]!=INF and reached[j]==0:
                heappush(stack,(G[i][j]+dis[i],j))
D=[[0]*N for i in range(N)]
for i in r:
    for j in r:
        if i>=j:
            continue
        D[i-1][j-1]=distance(i-1,j-1)
        D[j-1][i-1]=D[i-1][j-1]
ans=10**9
for r_ in permutations(r):
    res=0
    for i in range(R-1):
        res+=D[r_[i]-1][r_[i+1]-1]
    ans=min(ans,res)
print(ans)


Measured memory_bytes: 69336
def count_char_occurrence(seq):
    # count how many times characters occur and return results as a dictionary
    ret = {}
    for char in seq:
        if char in ret:
            ret[char] += 1
        else:
            ret[char] = 1
    return ret


def accum_char_frequency(seq):
    """
    accumulate frequency of each number in a inputted sequence
    Example:
        in: [a,a,a,a,b,b,b,b,c]
        out: { 4 times: [a,b] , 1 times: [c] }
    """
    frequencies = count_char_occurrence(seq)

    ret = {}
    for char, count in frequencies.items():
        if count in ret:
            ret[count].append(char)
        else:
            ret[count] = [char]
    return ret


def main():
    _ = input()
    seq = list(map(int, input().split()))

    odd = seq[::2]
    even = seq[1::2]

    if len(set(seq)) == 1:  # when all chars are unique, return the length of even numbered chars
        print(len(even))
        return

    no_freq_odd = accum_char_frequency(odd)
    freq_odd = sorted(no_freq_odd.items(), reverse=True)
    
    no_freq_even = accum_char_frequency(even)
    freq_even = sorted(no_freq_even.items(), reverse=True)

    if len(freq_odd[0][1]) == 1 and len(freq_even[0][1]) == 1 and freq_odd[0][1] == freq_even[0][1]:
        min_change_even = len(seq)
        if len(freq_even) != 1:
            min_change_even = (len(odd) - freq_odd[0][0]) + (len(even) - freq_even[1][0])

        min_change_odd = len(seq)
        if len(freq_odd) != 1:
            min_change_odd = (len(odd) - freq_odd[1][0]) + (len(even) - freq_even[0][0])

        print(min(min_change_even, min_change_odd))
        return
    else:
        min_change = (len(odd) - freq_odd[0][0]) + (len(even) - freq_even[0][0])
        print(min_change)
        return

main()

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

int main(){
    int D;
    std::cin >> D;
    std::vector< int > C(26);
    std::vector< int > cur_bad(26);
    for(int i=0; i<26; i++){
        std::cin >> C[i];
        cur_bad[i] = C[i];
    }
    std::vector< std::vector< int > > S(D, std::vector< int >(26));
    for(int i=0; i<D; i++){
        for(int j=0; j<26; j++){
            std::cin >> S[i][j];
        }
    }
    std::vector< int > T(D);
    
    for(int i=0; i<D; i++){
        int max = 0;
        int max_index = 0;
        for(int j=0; j<26; j++){
            int score = S[i][j] + cur_bad[j];
            if(max < score){
                max = score;
                max_index = j;
            }
        }
        T[i] = max_index + 1;
        cur_bad[max_index] = 0;
        for(int j=0; j<26; j++){
            cur_bad[j] += C[j];
        }
    }
    
    for(int i=0; i<D; i++){
        std::cout << T[i] << std::endl;
    }
    
    return 0;
}



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

using namespace std;


#define MAXN 51
int n, m, bi, bio[MAXN];
pair<int, int> b[MAXN*MAXN];
vector<int> g[MAXN];

int dfs(int u) {
  int ret = 1;
  bio[u] = 1;
  for (auto v : g[u]) {
    if (bio[v]) continue;
    if (b[bi].first==min(u, v) && b[bi].second==max(u, v)) {
      continue;
    }
    ret += dfs(v);
  }
  return ret;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    if (u>v) swap(u, v);
    g[u].push_back(v);
    g[v].push_back(u);
    b[i] = make_pair(u, v);
  }
  int ans = 0;
  for (int i = 0; i < m; ++i) {
    bi = i;
    memset(bio, 0, sizeof(bio));
    ans += dfs(0)!=n;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict

def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    c = defaultdict(int)
    for i in A:
        c[i] += 1
        c[i - 1] += 1
        c[i + 1] += 1
    print(sorted(c.items(), key=lambda x: x[1], reverse=True)[0][1])

if __name__ == '__main__':
    main()

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N;
  cin >> N;
  vector<pair<ll, ll>> job;
  ll a, b;
  REP(i, N) {
    cin >> a >> b;
    job.push_back(make_pair(b, a));
  }
  sort(job.begin(), job.end());

  ll current = 0ll;
  REP(i, N) {
    current += job.at(i).second;

    if (current > job.at(i).first) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 6512
a, b = map(int, input().split())
listS = list(input())

if listS[a] == "-":
    index=0
    while index < len(listS):
        if index==a:
            pass
        else:
            if listS[index] in ["0","1","2","3","4","5","6","7","8","9"]:
                pass
            else:
                print("No")
                break
        index+=1
    if index == len(listS):
        print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		long n = sc.nextLong();
		
		// 計算
		long result = 0;
		ArrayList<NumList> list = new ArrayList<NumList>();
		for(long m = 2; m <= sqrt(n); m++){
		    if(n == 1) break;
		    if(n%m == 0){
		        NumList numList = new NumList(m, 0);
		        while(n%m == 0){
		            n = n/m;
		            numList.num2++;
		        }
		        list.add(numList);
		    }
		}
		if(n != 1) list.add(new NumList(n, 1));
    	for(NumList N : list){
    	    long a = N.num2;
    	    long temp = 0;
    	    for(int i = 1; i <= a; i++){
    	        temp += i;
    	        if(temp <= a) result++;
    	    }
    	}
		
		// 出力
		System.out.println(result);
	}

	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}

class NumList {
	long num1;
	long num2;
	
	NumList(long num1, long num2){
		this.num1 = num1;
		this.num2 = num2;
	}
}



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

main(){
	int n;
	cin >> n;
	int a[n];
	int count=0;;
	for(int i=0;i<n;i++){
		cin>>a[i];
		while(a[i]%2==0){
			a[i]/=2;
			count++;
		}
	}
	cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <chrono>
using namespace std;
#pragma GCC optimize("-O3")
#define mp make_pair
#define st first
#define nd second
#define pii pair<int, int>
#define pb push_back
#define _upgrade ios_base::sync_with_stdio(0), cout.setf(ios::fixed), cout.precision(10) //cin.tie(0); cout.tie(0);
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FWD(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define fwd(i, a, b) for (int i = (a); i < (b); ++i)
#define all(c) (c).begin(), (c).end()
#define what(x) cerr << #x << " is " << x << endl;

vector<string> V;
int n;

void F(int i, int j)
{
    cerr << i << " " << j << endl;
    V[i][j + 2] = 'a';
    V[i + 1][j + 2] = 'a';
    V[i + 2][j] = V[i + 2][j + 1] = 'b';
}

void ostatki()
{
    int licznik = 4;
    for (int i = 1; i <= (n % 3); i++)
    {
        for (int k = 0; k < 3; k++)
            V[n - i][n - (n % 3) - 2 * k - 2] = V[n - i][n - (n % 3) - 2 * k - 1] = 'a' + (licznik++);
    }
    for (int i = 1; i <= (n % 3); i++)
    {
        for (int k = 0; k < 3; k++)
            V[n - (n % 3) - 2 * k - 2][n - i] = V[n - (n % 3) - 2 * k - 1][n - i] = 'a' + (licznik++);
    }
}

void print()
{
    for (auto S : V)
        cout << S << endl;
    exit(0);
}
main()
{
    _upgrade;

    cin >> n;

    if (n == 4)
    {
        cout << "aabc" << endl;
        cout << "ddbc" << endl;
        cout << "efgg" << endl;
        cout << "efhh" << endl;
        exit(0);
    }
    if (n == 5)
    {
        cout << "eaabb" << endl;
        cout << "eff.c" << endl;
        cout << "g..hc" << endl;
        cout << "g..hi" << endl;
        cout << "kkjji" << endl;
        exit(0);
    }

    if ((n % 3) != 0 && n < 6)
    {
        cout << -1 << endl;
        exit(0);
    }
    V.resize(n);
    rep(i, n) rep(j, n) V[i].push_back('.');

    if (n % 3 == 0)
    {
        rep(i, n)
        {
            if (i % 3 == 0)
                V[i][i + 2] = 'a';
            if (i % 3 == 1)
                V[i][i + 1] = 'a';
            if (i % 3 == 2)
                V[i][i - 2] = V[i][i - 1] = 'b';
        }
        print();
    }

    int ile = (n - n % 3) - 6;
    what(ile);
    int i = 0;

    for (i = 0; i <= ile - 9; i += 9)
        rep(k, 3) rep(l, 3) F(i + 3 * k, i + 3 * l);
    int zostalo = n - i;

    what(zostalo);
    if (zostalo < 9)
    {
        F(i, i + 3);
        F(i + 3, i);
    }
    if (zostalo < 12 && zostalo > 9)
    {
        rep(k, 3)
        {
            F(i, i + 3 * k);
            F(i + 3 * k, i);
        }
    }
    if (zostalo > 12)
    {
        rep(k, 2) rep(l, 2) F(i + l * 3, i + 3 * k);

        rep(k, 4)
            F(i + 3 * k, i + 3 * (3 - k));
    }
    if (n % 3 == 1)
    {
        F(n - 4, n - 4);
        F(n - 7, n - 7);
    }
    ostatki();
    print();
}

Measured memory_bytes: 2304
import numpy as np
def main():
    n = int(input())
    b = list(map(int, input().split()))
    
    ans_list = []
    ans_list.append(b[0])
    for i in range(n-2):
        if i == n-1:
            ans_list.append(b[i])
            break
        ans_list.append(np.min([b[i], b[i+1]]))
        
    ans_list.append(b[n-2])
    print(np.sum(ans_list))


    
if __name__ == '__main__':
    main()



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

typedef vector<int> v;
typedef v::iterator vi;

v b;

long msc(vi l, vi r)
{
	long c = 0;
	if (l + 1 < r) {
		vi m = l + (r - l) / 2;
		c = msc(l, m) + msc(m, r);

		vi bi = b.begin(), be = bi + (m - l);
		copy(l, m, bi);

		vi i = l;
		for (; bi != be && m != r; i++)
			if(*bi < *m)
				*i = *bi++;
			else
				*i = *m, c += m++ - i;

		copy(bi, be, i);
	}
	return c;
}

static inline int in()
{
    int c, n = 0;
    while ((c = getchar_unlocked()) >= '0' && c <= '9')
		n = 10 * n + (c - '0');
    return n;
}

int main()
{
	int n = in();

	v a(n);
	b = v(n);

	for (int &x: a)
		x = in();

	printf("%ld\n", msc(a.begin(), a.end()));
}



Measured memory_bytes: 3848
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String N = scan.next();

		if (N.endsWith("3")) System.out.println("bon");
		else if (N.endsWith("0") || N.endsWith("1") || N.endsWith("6") || N.endsWith("8")) System.out.println("pon");
		else System.out.println("hon");
 	}
}

Measured memory_bytes: 35704
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

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

  s[5] = ' ';
  s[13] = ' ';

  cout << s << endl;

  return 0;
}


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

template<typename T> void show_vector(std::vector<T> v) {
	auto size = v.size();
	for (int i = 0; i < size; i++) {
		if (i) {
			std::cout << " ";
		}
		std::cout << v[i];
	}
	std::cout << std::endl;
}

int main(int argc, char const* argv[])
{
	std::vector<int> v;
	int N;
	std::cin >> N;
	for (int i = 0; i < N; i++) {
		int got_num;
		std::cin >> got_num;
		v.push_back(got_num);
	}
	for (int i = 1; i < N; i++) {
		auto to = i;
		auto data = v[i];
		show_vector(v);
		while (v[to-1]>data && to>=1) {
			to--;
		}

		v.erase(v.begin()+i);
		v.insert(v.begin()+to,data);
	}
		show_vector(v);
	return 0;
}

Measured memory_bytes: 3096
import java.io.*;
import java.util.*;
import java.lang.*;
class Graph
{
	public ArrayList adjacency[];
	public Graph(int nodes)
	{
		adjacency = new ArrayList[nodes];
		for(int i=0;i<nodes;i++)
		{
			adjacency[i] = new ArrayList<Integer>();
		}
	}
	@Override
	public String toString()
	{
		String ret = "";
		for (ArrayList temp : adjacency) {
			ret+=(temp.toString()+"\n");
		}
		return ret;
	}
	public void addEdge(int from, int to)
	{
		adjacency[from].add(to);
		adjacency[to].add(from);
	}
}
	
public class Main {
	public static Graph g;
	public static int taka,aoki;
	public static int count[];
	public static boolean vis[];
	public static void mark(int node, int pos)
	{
		count[node] = pos;
		ArrayList list = g.adjacency[node];
		int val;
		for(int i=0;i<list.size();i++)
		{
			val = (int)list.get(i);
			if(count[val]<0)
			{
				mark(val,pos+1);
			}
		}
	}
	public static int calc(int node, int pos,PrintWriter out)
	{
		vis[node]=true;
		if(count[node]==pos || count[node]+1==pos)
			return count[node];
		// if(count[node]<pos)
		// 	return Integer.MIN_VALUE;
		ArrayList list = g.adjacency[node];
		// out.println("node: "+node);
		// out.println("list: "+list);
		// out.println();
		int val;
		int ans = 0;
		if(list.size()==1){
			// out.println("yo");
			ans = count[(int)list.get(0)];
		}
		for(int i=0;i<list.size();i++)
		{
			val = (int)list.get(i);
			if(!vis[val])
				ans=Math.max(ans,calc(val,pos+1,out));
		}
		return ans;
	}
	public static void main(String[] args)throws IOException {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        
		int n = in.nextInt();
		taka = in.nextInt()-1;
		aoki = in.nextInt()-1;
		g = new Graph(n);
		int a,b;
		for(int i=0;i<n-1;i++)
		{
			a=in.nextInt()-1;
			b=in.nextInt()-1;
			g.addEdge(a,b);
		}
		count = new int[n];
		vis = new boolean[n];
		// Arrays.fill(count,-1);
		for(int i=0;i<n;i++)
		{
			count[i]=-1;
			vis[i]=false;
		}
		mark(aoki,0);
		// out.println("marked");
		// for(int i=0;i<n;i++)
		// {
		// 	out.print(i+" ");
		// 	out.println(count[i]);
		// }
		out.println(calc(taka,0,out));
        out.close();
	}
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

    }

}

Measured memory_bytes: 65152
M  =  int ( input().strip() ) ;
arr  = list (  map ( int , input().strip().split(" ") ) ) ;

arr2  = [ 0 for x in range ( M + 1 ) ] ;
for x in arr :
	arr2[x] += 1 ; 
for i in range ( 1 , len( arr2 ) )  :
	print ( arr2[i] ) ;


Measured memory_bytes: 32364
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main(){
    ll a,b,k; cin>>a>>b>>k;
    if(b-a+1<=k*2){
        for(ll i=a; i<=b; i++){
            cout<<i<<endl;
        }
    }
    else{
        rep(i,k) cout<<a+i<<endl;
        rep(i,k) cout<<b-k+1+i<<endl;
    }
    return 0;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N;
  cin>>N;
  vector<int>l(N),r(N);
  for(int i=0;i<N;i++)cin>>l[i]>>r[i];
  vector<int>ans(100001,0);
  for(int i=0;i<N;i++){
    ans[l[i]-1]+=1;
    ans[r[i]]+=-1;
  }
  for(int i=0;i<100000;i++){
    ans[i+1]+=ans[i];
  }
  int a=0;
  for(int i=0;i<100000;i++)if(ans[i]>0)a++;
  cout<<a<<endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;


int main(){
    ll N, K;
    cin >> N >> K;

    ll num1 = N % K;
    ll num2 = abs(num1 - K);

    cout << min(num1, num2) << endl;
    return 0;

}


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

using namespace std;

int main(){
    int n, m, k;
    cin >> n >> m >> k;
    
    vector<int> a(n);
    vector<int> b(m);
    
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < m; i++) cin >> b[i];
    
    vector<long long> sumA(n+1);
    vector<long long> sumB(m+1);
    
    for (int i = 1; i <= n; i++) sumA[i] = sumA[i-1] + a[i-1];
    for (int i = 1; i <= m; i++) sumB[i] = sumB[i-1] + b[i-1];
    
    int ans = 0;
    
    for (int i = 0; i <= n; i++){
        long long temp = k - sumA[i];
        if (sumA[i] > k) continue;
        if (temp < 0 || sumA[i] == k) ans = max(ans,i);
        
        int numberOfB = upper_bound(sumB.begin(),sumB.end(),temp) - sumB.begin()-1;
        
        ans = max (ans, i + numberOfB);
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 8000
n, y = map(int,input().split())

def otoshidama():
    for i in range(0,n+1):
        for j in range(0,n+1-i):
            k = n-i-j
            if 10000*i + 5000*j + 1000*k == y:
                return i,j,k
    return -1,-1,-1

 
a, b, c = otoshidama()
print(a,b,c)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
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;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

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

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

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;
    string S;
    cin >> S;
    ll ans = 0,now = 0;
    rep(i,N){
        if(S[i] == 'I')now++;
        else now--;
        chmax(ans,now);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3584
mod=10**9+7
n=int(input())
A,T,G,C=[0]*(n+1),[0]*(n+1),[0]*(n+1),[0]*(n+1)
A[1],A[2],A[3]=1,4,16
T[1],T[2],T[3]=1,4,16
C[1],C[2],C[3]=1,4,14
G[1],G[2],G[3]=1,4,15
S=[0]*(n+1)
S[1],S[2],S[3]=4,16,61
for i in range(4,n+1):
    A[i],T[i]=S[i-1],S[i-1]
    C[i]=S[i-1]-(A[i-2]+G[i-2]+A[i-3]*3)
    G[i]=S[i-1]-(A[i-2]-G[i-3])
    S[i]=(A[i]+T[i]+C[i]+G[i])%mod
print(S[-1])

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

using namespace std;

#define ll long long

#define mxN (int)1e7 + 1

int n;
ll dp[mxN];

void calc() {
	dp[1] = 1;
	fill(dp + 2, dp + mxN, 2);
	for(int i = 2; i < mxN; i++) {
		for(int j = i + i; j < mxN; j += i) {
			dp[j]++;
		}
	}
}
		  

void solve() {

	calc();
	cin >> n;
	ll total = 0;
	for(int i = 1; i <= n; i++) {
		total += i * dp[i];
	}
	cout << total;
		

	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	solve();

	return 0;
}

Measured memory_bytes: 81772
N, M = [int(x) for x in input().split()]
path = []
for i in range(N):
  path.append([])
for i in range(M):
  t1, t2 = [int(x) for x in input().split()]
  path[t1-1].append((t1,t2))
  path[t2-1].append((t2,t1))
l = [1]
ans = [1] + [0] * (N-1)
while len(l) > 0:
  t = l.pop(0)
  for i in range(len(path[t-1])):
    if ans[path[t-1][i][1]-1] == 0:
      ans[path[t-1][i][1]-1] = t
      l.append(path[t-1][i][1])
print('Yes')
for i in range(1, N):
  print(ans[i])

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

using namespace std;

#define debug(x) '[' << #x << " is: " << x << "] "
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.precision(10);
	cout << fixed;
	#ifndef ONLINE_JUDGE
//		freopen("input.txt","r",stdin);
	#endif
	int n,m;
	cin>>n>>m;
	if(n > m)swap(n,m);
	if(m - n > 1){
		cout << "0\n";
		return 0;
	}
	const int mod = 1e9 + 7;
	vector<ll> fact(m+1);
	fact[0] = 1;
	for(ll i=1;i<=m;i++){
		fact[i] = (fact[i-1] * i)%mod;
	}
	ll ans = 1;
	if(n == m){
		ans = (2 * (fact[n] * fact[m])%mod)%mod;
	}else{
		ans = (fact[n] * fact[m])%mod;
	}
	cout << ans << '\n';
}

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

int main(){
    ll n,a,b, test1= 10,test2 = 3;
    cin >> n >> a >> b;
    ll c = a+b;
    ll count = n/c;
    if(n%c <= a ){
        cout << count*a+ n%c << endl;
        // cout << "count " << count << " n%c "<< n%c <<endl;
        // cout << test1/test2 << endl;
    }else{
        cout << (count+1)*a << endl;
        // cout << "count " << count << " n%c "<< n%c <<endl;
    }
}

Measured memory_bytes: 256