akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

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;
    }
}

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

    ll N, M;
    cin >> N >> M;
    mat A(N, vec(M));
    Rep (i, N) Rep (j, M) {
        cin >> A[i][j];
        A[i][j]--;
    }

    vector<bool> sports(M, true);
    ll ans = 310;
    Rep (i, M) {
        vec cnt(M, 0);
        Rep (j, N) {
            Rep (k, M) {
                if (sports[A[j][k]]) {
                    cnt[A[j][k]]++;
                    break;
                }
            }
        }

        ll sub = 0;
        ll popular = -1;
        Rep (j, M) {
            if (sub < cnt[j]) popular = j;
            chmax(sub, cnt[j]);
        }
        chmin(ans, sub);
        sports[popular] = false;
    }

    cout << ans << endl;
}

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

int main() {
	int N;
	cin >> N;
	vector<long long>A(N);
	vector<long long>C(N);
	for (int n = 0;n<N;++n) {
		long long  m = 0;
		cin >> m;
		m--;
		A[n] = m;
		C[m]++;
	}
	long long ans = 0;
	for (int n = 0;n<N;++n) {
		ans += C[n] * (C[n] - 1) / 2;
	}
	for (int n = 0;n<N;++n) {
		cout <<ans-(C[A[n]]-1)<<endl;
	}
	return 0;
}

Measured memory_bytes: 6380
#include <stdio.h>
#include <math.h>
#define Q(x)(x)*(x)
int N,i,M;double X[30],Y[30],Z[30],cx,cy,cz,d,m;
double D(int i){return sqrt(Q(X[i]-cx)+Q(Y[i]-cy)+Q(Z[i]-cz));}
int L(){for(m=i=0;i<N;i++)if(D(i)>m)m=D(i),M=i;return M;}
main(){int t;for(;scanf("%d",&N),N;printf("%f\n",D(L()))){
	for(i=0;i<N;i++)scanf("%lf%lf%lf",X+i,Y+i,Z+i);
	for(cx=cy=cz=d=0.5;d>1e-8;d/=2)for(t=0;t<100;t++)i=L(),cx+=(X[i]-cx)*d,cy+=(Y[i]-cy)*d,cz+=(Z[i]-cz)*d;
}}

Measured memory_bytes: 1092
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <random>

using namespace std;

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; 
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()
#define pw(n) (1ll << (n))

#define equal equalll
#define less lesss
const int N = 5e5 + 10;
const long long INF = 1e9 + 19;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int M = 1000;


int n;
int ent[N];
ll a,b;

int main() {
    scanf("%d %lld %lld", &n, &a, &b);
    for (int i = 0; i < n; i++) scanf("%d", &ent[i]);
    ll ans = 0;
    for (int i = 1; i < n; i++) {
        ll pos = ent[i-1];
        ll quero = ent[i];
        if((quero - pos) * a > b) {
            ans += b;
        } else {
            ans += (quero - pos) * a;
        }
    }
    cout << ans << endl;
}




















































Measured memory_bytes: 640
#include <iostream>
#include <cstdint>
#include <algorithm>
#include <vector>

const uint64_t NO_ROUTE = static_cast<uint64_t>(1) << 48;

int main()
{
  uint64_t N, M, R;
  std::cin >> N >> M >> R;
  
  std::vector<uint64_t> r(R);
  for (uint64_t i = 0; i < R; ++i) {
    std::cin >> r[i];
    --r[i];
  }
  std::sort(r.begin(), r.end());
  
  std::vector< std::vector<uint64_t> > d(N);
  for (uint64_t n = 0; n < N; ++n) {
    d[n] = std::vector<uint64_t>(N, NO_ROUTE);
    d[n][n] = 0;
  }
  
  for (uint64_t m = 0; m < M; ++m) {
    uint64_t a, b, c;
    std::cin >> a >> b >> c;
    
    --a;
    --b;
    
    d[a][b] = c;
    d[b][a] = c;
  }
  
  for (uint64_t k = 0; k < N; ++k) {
    for (uint64_t i = 0; i < N; ++i) {
      for (uint64_t j = 0; j < N; ++j) {
        if (d[i][j] > d[i][k] + d[k][j]) {
          d[i][j] = d[i][k] + d[k][j];
        }
      }
    }
  }
  
  uint64_t min = static_cast<uint64_t>(-1);
  do {
    uint64_t sum = 0;
    for (uint64_t i = 1; i < R; ++i) {
      sum += d[ r[i - 1] ][ r[i] ];
    }
    
    min = std::min(sum, min);
  } while (std::next_permutation(r.begin(), r.end()));
  std::cout << min << std::endl;
  
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
const ll maxSum = 50*50+1;
int main() {
    ll N ;
    cin >> N ;
    ll tnow  = 0 ;
    ll anow = 0 , bnow = 0 ;
    ll t , a , b ;
    ll tmp , dif ;
    bool flag = true ;
    for(ll i = 0 ; i < N ; i++){
        cin >> t >> a >> b ;
        tmp = t - tnow ;
        dif = abs(a - anow) + abs(b - bnow) ;
        if(tmp < dif || (tmp - dif) % 2 != 0 ){
             flag = false ;
        }
        tnow = t ;
        anow  = a ;
        bnow  = b ;
    }
    if(flag == false){
        cout <<"No" << endl;
    }else{
        cout << "Yes" << endl;
    }
 
    return 0;
}

Measured memory_bytes: 3636
from collections import deque
h,w=map(int,input().split())
field=[["*" for i in range(w+2)]]+[["*"]+list(input())+["*"] for i in range(h)]+[["*" for i in range(w+2)]]
cost=[[500 for i in range(w+2)] for j in range(h+2)]
cost[1][1]=0
ans=0
for i in range(1,h+1):
    for j in range(1,w+1):
        color=field[i][j]
        if color=="." and field[i][j+1]=="#":
            cost[i][j+1]=min(cost[i][j]+1,cost[i][j+1])
        else:cost[i][j+1]=min(cost[i][j],cost[i][j+1])
        if color=="." and field[i+1][j]=="#":
            cost[i+1][j]=min(cost[i][j]+1,cost[i+1][j])
        else:cost[i+1][j]=min(cost[i][j],cost[i+1][j])
print(cost[h][w] if field[1][1]=="." else cost[h][w]+1)


Measured memory_bytes: 43888
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <map>
#include <math.h>
#include <algorithm> // std::sort, std::min
#include <iomanip> // std::setprecision
#include <cmath> // std::ceil
#include <numeric> // std::gcd
#include <limits> // std::numeric_limits<long int>::max()

using namespace std;
typedef long long ll;
#define INF 1999999999
#define MODA 1000000007 

template<typename T>
T powint (const T& x, const T& y) {
  T ret = 1;
  for(int i=0; i<y; ++i) ret *= x;
  return ret;
}

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

  sort(A.begin(), A.end());
  ll tmp=A[0];
  for(int i=1; i<N; ++i) {
    if(A[i]==tmp) {
      cout <<"NO"<< endl;
      return 0;
    }
    tmp = A[i];
  }
  cout <<"YES"<< endl;
  return 0;
}

Measured memory_bytes: 1792
import java.util.*;

class Main {
	public static void main(String[] args){
		final Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		final String lb = System.getProperty("line.separator");
		while(true){
			char[] num = sc.nextLine().toCharArray();
			int sum = 0;
			if(num[0] == '0') break;
			for(int i = 0; i < num.length; i++){
				sum += Integer.parseInt(String.valueOf(num[i]));
			}
			sb.append(sum).append(lb);	
		}
		System.out.print(sb.toString());
	}
}

Measured memory_bytes: 17608
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
  long long A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  long long a[3];
  a[0]= X*A + Y*B ;
  if (X>=Y) {
    a[1]=2*Y*C + (X-Y) * A;
    a[2]=2*X*C;
  } else {
    a[1]=2*X*C + (Y-X) * B;
    a[2]=2*Y*C;
  }
  sort(a, a+3);
  cout << a[0] << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define MOD 1000000007;

int main(){
  string s;cin>>s;
  bool ok=true;
  if(s[3]!=s[2])ok=false;
  if(s[5]!=s[4])ok=false;
  if(ok){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
}



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

const int N = 100;

int main()
{
    int M[N][N];
    int n, u, k, v;

    cin >> n;

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            M[i][j] = 0;
        }
    }

    for (int i = 0; i < n; ++i) {
        cin >> u >> k;
        u--;

        for (int j = 0; j < k; ++j) {
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (j != 0) {
                cout << " ";
            }
            cout << M[i][j];
        }
        cout << endl;
    }

    return 0;
}



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

using namespace std;

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

    int n , k;
    cin >> n >> k;

    vector<double> p(18);

    p[0] = 1;
    for (int i = 1 ;i < p.size() ;i++)
        p[i] = p[i - 1] / 2;

    double ans = 0;
    for (int i = 1 ;i <= n ;i++) {
        int cur = i , t = 0;
        while (cur < k)
            t++ , cur *= 2;

        ans += (1.0 / n) * p[t];
    }

    cout << fixed << setprecision(12) << ans;
}


Measured memory_bytes: 3760
N,H = map(int,input().split())
a=[]
b=[]
for i in range(N):
    x,y=map(int,input().split())
    a.append(x)
    b.append(y)

maxA = max(a)
b.sort()
b.reverse()

ans=0
index=0
for throwedKatana in b:
    if throwedKatana < maxA:
        break
    H -= throwedKatana
    ans += 1
    if H <= 0:
        break
if H > 0:
    ans += H//maxA
    if H%maxA != 0:
        ans += 1
print(ans)

Measured memory_bytes: 11348
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

int chmin(long long *x, long long y) { if (*x > y) { *x = y; return 1; } return 0; }
int chmax(long long *x, long long y) { if (*x < y) { *x = y; return 1; } return 0; }
const long long INF = LONG_MAX >> 5;

int main() {
    int N;
    long long W;
    long long weight[110], value[110];
    long long **dp;

    scanf("%d%lld", &N, &W);

    for (int i = 0; i < N; i++)
        scanf("%lld%lld", &weight[i], &value[i]);

    dp = (long long **)calloc(110, sizeof(long long *));
    for (int i = 0; i < 110; i++) {
        dp[i] = (long long*)calloc(100100, sizeof(long long));
        for (int j = 0; j < 100100; j++)
            dp[i][j] = INF;
    }

    dp[0][0] = 0;

    for (int i = 0; i < N; i++) {
        for (int sum_v = 0; sum_v < 100100; sum_v++) {
            if (sum_v - value[i] >= 0)
                chmin(&dp[i + 1][sum_v], dp[i][sum_v - value[i]] + weight[i]);
            chmin(&dp[i + 1][sum_v], dp[i][sum_v]);
        }
    }

    long long res = 0;
    for (int sum_v = 0; sum_v < 100100; sum_v++) {
        if (dp[N][sum_v] <= W)
            res = sum_v;
    }
    printf("%lld\n", res);
    return 0;
}


Measured memory_bytes: 86400
import numpy as np

N, M = [int(i) for i in input().split()]
P = []
S = []
for _ in range(M):
    p, s = [x for x in input().split()]
    P.append(int(p)-1)
    S.append(str(s))

AC_list = [0]*N
WA_list = [0]*N
for i in range(M):
    if S[i] == "AC":
        AC_list[P[i]] = 1
    if S[i] == "WA" and AC_list[P[i]] == 0:
        WA_list[P[i]] += 1

correct = sum(AC_list)
penalty = sum(np.array(WA_list)*np.array(AC_list))
print(correct, penalty)


Measured memory_bytes: 26320
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import math
import fractions
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

k = I()

result = 0

gcdList = {}

frc = 0
for i in range(1, k+1):
    for j in range(1, k+1):
        t = (i,j)
        if t in gcdList:
            frc = gcdList[t]
        else:
            frc = fractions.gcd(i,j)
            gcdList[t] = frc
            
        for l in range(1, k+1):
            t2 = (gcdList[(i,j)],l)
            
            if t2 in gcdList:
                frc = gcdList[t2]
            else:
                frc = fractions.gcd(gcdList[(i,j)],l)
                gcdList[t2] = frc
            
            result += frc

print(result)


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

using namespace std;

long long N, X;

long long rec(long long n, long long x, bool init) {
    long long y = init ? n-x : n;
    if (x > y) swap(x, y);
    long long ret = init ? x+y : 0;
    long long p = y / x, q = y % x;
    if (q == 0) return ret+(p-1)*2LL*x+x;
    return ret+p*2LL*x+rec(x, q, false);
}

long long solve() {
    return rec(N, X, true);
}

int main() {
    scanf("%lld%lld", &N, &X);
    long long ans = solve();
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main(void){
int n;
  scanf("%d",&n);
  char s[n];
  scanf("%s",&s);
  int count=0;
  for(int i=0;i<n-2;i++){
	if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')count++;
  }
  printf("%d",count);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <boost/integer/common_factor_rt.hpp>
using namespace std;
using ll=long long;

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  vector<int> x={a,b,c};
  sort(x.begin(),x.end());
  int sa=x[2]-x[1]+x[2]-x[0];
  if(sa%2==0)
  cout << sa/2 << endl;
  else
  cout << sa/2+2 << endl;
}

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


const int MAX = 1000000;
const int MOD = 1000000007;

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

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

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


ll X, Y;

int main(){
	cin >> X >> Y;
	
	ll n = (X+Y)/3;
	ll a = X - n;
	ll b = Y - n;
	
	ll result = 0;
	if ( 2*a+b != X || 2*b+a != Y || a < 0 || b < 0 ){
		result = 0;
	}
	else {
	    COMinit();
		result = COM(n,a);
	}
	
	cout << result  << endl;
	
	return 0;
}



Measured memory_bytes: 23680
#define DEBUG 0

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

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------
#define MOD 1000000007

int A[200000],B[200000];
int fact[8001];
int dp[4002][4002];
int inv(LLI n) {
    LLI r = 1;
    int e = MOD-2;
    while (e > 0) {
        if (e & 1) r *= n,r %= MOD;
        e >>= 1;
        n *= n,n %= MOD;
    }
    return r;
}
int main() {
    int i;
    int N;
    scanf("%d",&N);
    for (i = 0; i < N; i++) scanf("%d %d",&A[i],&B[i]),dp[2001-A[i]][2001-B[i]]++;

    int j;
    for (i = 1; i < 4002; i++) {
        for (j = 1; j < 4002; j++) dp[i][j] += dp[i-1][j]+dp[i][j-1],dp[i][j] %= MOD;
    }
    fact[0] = 1;
    for (i = 1; i <= 8000; i++) fact[i] = ((LLI) fact[i-1]*i) % MOD;
    int ans = 0;
    for (i = 0; i < N; i++) {
        ans += dp[A[i]+2001][B[i]+2001],ans %= MOD;
        ans -= ((LLI) fact[2*A[i]+2*B[i]]*inv(((LLI) fact[2*A[i]]*fact[2*B[i]]) % MOD)) % MOD,ans %= MOD;
    }
    if (ans < 0) ans += MOD;
    printf("%lld\n",((LLI) ans*inv(2)) % MOD);

    return 0;
}



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


 
int main(){
	int a,b,k;
	cin>>k;
	cin>>a>>b;
	bool ans=false;
	rep(i,2000){
		int l=k*(i+1);
		
		if(l<=b&&l>=a){
			ans=true;
			break;
		}
	}
	if(ans){
		cout<<"OK"<<endl;
	}else{
		cout<<"NG"<<endl;
	}
	
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  int n, k; cin >> n >> k;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];

  vector<int> imos(n+1, 0);
  for(int i = 0; i < n; i++){
    imos[i+1] = (imos[i] + a[i] - 1) % k;
  }

  int ans = 0;
  map<int, int> mp;
  for(int i = 0; i <= n; i++){
    if(i - k >= 0) mp[imos[i - k]]--;
    ans += mp[imos[i]];
    mp[imos[i]]++;
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
int n,x=0;

cin>>n;
char s[n];
cin>>s;
int max=x;
for(int i=0;i<n;i++)
{
	if(s[i]=='I')
	{
		++x;
		if(x>max)
		max=x;
	}
	if(s[i]=='D')
	{
		--x;
		
	}
	
}
cout<<max;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <map>
#include <cmath>
#include <vector>

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

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

int main() {
    // vector<vector<int>> bingo(3, vector<int>(3, 1));
    // vector<vector<int>> appear(3, vector<int>(3, 1));
    int bingo[3][3];
    bool appear[3][3];
    rep(i, 3) {
        rep(j, 3) {
            cin >> bingo[i][j];
        }
    }
    int n; 
    cin >> n;

    if (n < 3)
    {
        /* code */
        cout << "No" << endl;
        return 0;
    }
    

    int b[10];
    rep(i, n) {
        cin >> b[i];
    }

    rep(j, n) {
        rep(k, n) {
            appear[j][k] = false;
            rep(l, n) {
                if (b[l] == bingo[j][k])
                {
                    /* code */
                    appear[j][k] = true;
                }
            }
        }
    }
    string ans = "No";
    rep(i, 3) {
            if (appear[i][0] && appear[i][1] && appear[i][2])
            {
                ans = "Yes";
                cout << ans << endl;
                return 0;
            }
    }
    rep(j, 3) {
            if (appear[0][j] && appear[1][j] && appear[2][j])
            {
                ans = "Yes";
                cout << ans << endl;
                return 0;
            }
    }
    if (appear[0][0] && appear[1][1] && appear[2][2]) { 
        ans = "Yes";
        cout << ans << endl;
        return 0;
    }
    if (appear[2][0] && appear[1][1] && appear[0][2]) {
        ans = "Yes";
        cout << ans << endl;
        return 0;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

struct IntPtr
{
  int Key;
  IntPtr *Next;
  IntPtr *Prev;
};

IntPtr *First, *Last;
IntPtr *IntList;
int Index;

void DeleteFirst()
{
  if(First->Next == NULL)
  {
    Index = 0;
    First = Last = NULL;
    return;
  }
  First = First->Next;
  First->Prev = NULL;
}

void DeleteLast()
{
  if(Last->Prev == NULL)
  {
    Index = 0;
    First = Last = NULL;
    return;
  }
  Last = Last->Prev;
  Last->Next = NULL;
}

void Delete(int Key)
{

  for(IntPtr *intPtr = First; intPtr != NULL; intPtr = intPtr->Next)
  {
  
    if(intPtr->Key == Key)
    {
      if(intPtr->Prev != NULL && intPtr->Next != NULL)
      {
	intPtr->Next->Prev = intPtr->Prev;
	intPtr->Prev->Next = intPtr->Next;
      }
      else if(intPtr->Prev == NULL)
	DeleteFirst();
      else if(intPtr->Next == NULL)
	DeleteLast();

      return;
    }
  }

  return;  

}

void Insert(int Key)
{
  IntPtr *Ptr = &IntList[Index];
  Ptr->Key = Key;
  Ptr->Next = Ptr->Prev = NULL;

  if (First == NULL)
    First = Ptr;
  else
  {
    First->Prev = Ptr;
    Ptr->Next = First;
    First = Ptr;
  }
  if(Last == NULL)
    Last = Ptr;
  
  ++Index;
  
  return;  
}

int main()
{

  int N, Key; cin >> N;
  string Command;

  IntList = new IntPtr[N];
  Index = 0;
  for(int i = 0; i < N; ++i)
  {
    cin >> Command;

    if(Command == "insert")
    {
      cin >> Key; 
      Insert(Key);
    }
    else if(Command == "delete")
    {
      cin >> Key; 
      Delete(Key);
    }
    else if(Command == "deleteFirst")
      DeleteFirst();
    else if(Command == "deleteLast")
      DeleteLast();    
  }

  for(IntPtr *intPtr = First; intPtr != NULL; intPtr = intPtr->Next)
    cout << (intPtr == First ? "" : " ") << intPtr->Key;
  cout << endl;
  delete [] IntList;

  return 0;
}


Measured memory_bytes: 28684
#include<iostream>
#include<vector>
using namespace std;
using ll = long long;

int main() {
  int N,i;
  bool isZero=false, isOver=false;
  cin>>N;
  vector<ll> A(N);
  ll ans = 1, MAX=1e18;
  for (i=0;i<N;i++) {
    cin>>A[i];
    if (!isZero) {
      if (A[i]==0) isZero = true;
      else if (!isOver && A[i] <= MAX/ans) ans*=A[i];
      else isOver = true;
    }
  }
  cout<<(isZero ? 0 : (isOver ? -1 : ans))<<endl;
  return 0;
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

struct P {
  int color, x, y;
};

const int MAX_N = 105;
P p[2 * MAX_N];

int solve(int N) {
  sort(p, p+N, [](const P&a, const P&b){
    if (a.x != b.x) return a.x < b.x;
    if (a.color != b.color) return a.color < b.color;
    return a.y < b.y;
  });

  int ans = 0;
  multiset<int> st;
  REP(i, N) {
    if (p[i].color == 0) {
      st.insert(p[i].y);
    }
    if (p[i].color == 1) {
      auto it = st.upper_bound(p[i].y);
      if (it != st.begin()) {
        --it;
        if ((*it) <= p[i].y) {
          st.erase(it);
          ans++;
        }
      }
    }
  }
  return ans;
}

int main2() {
  int N = nextInt();
  REP(i, N) {
    int a = nextInt();
    int b = nextInt();
    p[i] = (P){0, a, b};
  }
  REP(i, N) {
    int c = nextInt();
    int d = nextInt();
    p[N+i] = (P){1, c, d};
  }
  int ans = solve(2*N);
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
long long f(long long a, long long b){
    long long res = a;
    b -= a;
    a = 1;
    return res + (b-a) / 2;
}
int main(void){
    long long n, a, b;
    cin >> n >> a >> b;
    if(a%2 == b%2){
        cout << (b-a) / 2 << endl;
    }else{
        cout << min(f(a, b), f(n-b+1, n-a+1)) << endl;
    }
}


Measured memory_bytes: 256
N = int(input())

max = [1, 0]

for i in range(1, N+1):
    j = i
    count = 0
    while j % 2 == 0: 
        j = j / 2
        count += 1
    if count > max[1]:
        max[0] = i
        max[1] = count
        
print(max[0])

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <numeric>

typedef long long ll;
const ll INF = 1e18;

// Greatest Common Divisor
ll gcd(ll a, ll b)
{
  while (b != 0) {
    a = a % b;
    std::swap(a, b);
  }
  return a;
}

int main(int argc, char* argv[])
{
  ll N, K;
  std::cin >> N >> K;

  ll ans = 0;
  
  ll x = N / K;
  ans += x * x * x;

  if (K % 2 == 0) {
    ll y = (N + K / 2) / K;
    ans += y * y * y;
  }
  
  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<bitset>
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rep1n(i, n) for(int i=1;i<=(int)(n);i++)
#define all(t) t.begin(), t.end()
#define rall(t) t.rbegin(), t.rend()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout<<(cond? "Yes":"No")<<endl;
#define YES(cond) cout<<(cond? "YES":"NO")<<endl;
int main() {

	int n;
	cin >> n;
	cout << 800 * n - 200 * (n / 15);
	
	return 0;
}





Measured memory_bytes: 256
import math
def back_oturigation(fee, coin_values, coin_nums):
    """
    1. ?????????????????????????????????£??????????????????
    2. 1????????????????????????????????????????????????????????????
       ????????????§?????????????????????-> ??°?????????????????????¶???????????????????
    3. 2?????????????????????°?????????????????????????????????????????????
    """
    # 1.
    oturi = coin_values[0] * coin_nums[0] \
            + coin_values[1] * coin_nums[1] \
            + coin_values[2] * coin_nums[2] \
            + coin_values[3] * coin_nums[3] \
            - fee

    use_coins = [0] * len(coin_values)
    no_use_coins = [0] * len(coin_values)
 
    # 2.
    for i in range(len(coin_values) - 1, -1, -1):
        no_use_coins[i] = int(oturi / coin_values[i])
        oturi = oturi - (coin_values[i] * no_use_coins[i])
 
    # 3.
    for i in range(0, len(use_coins), 1):
        use_coins[i] = coin_nums[i] - no_use_coins[i]
        if use_coins[i] > 0:
            print(str(coin_values[i]) + ' ' + str(use_coins[i]))
 
if __name__ == "__main__":
    first = True
    while (True):
        total_fee = int(input(''))
        if total_fee == 0:
            break
        if first:
            first = False
        else:
            print('')
        coins = input('')
        coins = coins.split(' ')  # 10, 50, 100, 500?????????§????????????
        coins = [int(coin) for coin in coins]
        coin_values = [10, 50, 100, 500]
        back_oturigation(total_fee, coin_values, coins)

Measured memory_bytes: 7908
import itertools
n,m,x = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(n)]
ans = 1000000000000
for i in range(2 ** n):
    skill = [0]*m
    cost = 0
    for j in range(n):
        if ((i>>j)&1):
            cost += c[j][0]
            for k in range(m):
                skill[k] += c[j][k+1]
 
                
    if (min(skill)>=x):
        if (ans > cost):
            ans = cost
if (ans != 1000000000000):
    print(ans)
else:
    print(-1)

Measured memory_bytes: 9208
#include <bits/stdc++.h>
#include <algorithm>  
#include <unordered_set>

#define ll long long

using namespace std;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll N;
	cin >> N;

	int d = N % 10;

	switch (d) {
	case 2:
	case 4:
	case 5:
	case 7:
	case 9:
		cout << "hon" << endl;
		break;
	case 0:
	case 1:
	case 6:
	case 8:
		cout << "pon" << endl;
		break;
	case 3:
		cout << "bon" << endl;
		break;
	}

	

	return 0;
}

Measured memory_bytes: 3660
#include<stdio.h>

int main(void)
{
	int a, b, kekka1,kekka2;

	scanf("%d%d", &a,&b);

	kekka1 = a*b;
	kekka2 = 2 * (a + b);

	printf("%d %d\n", kekka1,kekka2);

	return 0;


}

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

int N;
int dp[100100];

signed main() {
    cin >> N;
    rep(i, 100100) dp[i] = 10000000000;
    dp[0] = 0;
    for (int i=1; i<=N; i++) {
        dp[i] = min(dp[i], dp[i-1]+1);
        int a = 6;
        while (i>=a) {
            dp[i] = min(dp[i], dp[i-a]+1);
            a *= 6;
        }
        int b = 9;
        while (i>=b) {
            dp[i] = min(dp[i], dp[i-b]+1);
            b *= 9;
        }
    }
    cout << dp[N] << endl;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int H = sc.nextInt();
   int W = sc.nextInt();
   int N = sc.nextInt();
   int[] a = new int[N];
   for(int i=0;i<N;i++)
   {
     a[i] = sc.nextInt();
   }
   int[][] ans = new int[H][W];
   int atag=0;
   for(int i = 0;i<H;i++)
   {
     if(i%2==0) 
     {
       for(int k =0;k<W;k++)
       {
         if(a[atag]==0)
         {
           atag++;
           a[atag]--;
           ans[i][k]=atag+1;
         }
         else
         {
           ans[i][k]=atag+1;
           a[atag]--;
         }
       }
     }
     else
     {
       for(int k =W-1;k>=0;k--)
       {
         if(a[atag]==0)
         {
           atag++;
           a[atag]--;
           ans[i][k]=atag+1;
         }
         else
         {
           ans[i][k]=atag+1;
           a[atag]--;
         }
       }     
     }
   }

   for(int i=0;i<H;i++)
   {
     for(int k =0;k<W;k++)
     {
       System.out.print(ans[i][k]+" ");
     }
     System.out.println();
   }
 }
}

Measured memory_bytes: 33032
from bisect import bisect_left as bl
N = int(input())
R = [list(map(int, input().split())) + [0] for _ in range(N)]
B = [list(map(int, input().split())) + [1] for _ in range(N)]
P = sorted(R + B, key = lambda x: (x[0], -x[1]))
res = 0
inf = 10 ** 3
Q = []
for i in range(N * 2):
  if P[i][2] == 0:
    Q.append(P[i][1])
    Q.sort()
  elif len(Q):
    j = min(bl(Q, P[i][1]), len(Q) - 1)
    if Q[j] < P[i][1]:
      res += 1
      Q.pop(j)
    elif Q[j - 1] < P[i][1]:
      res += 1
      Q.pop(j - 1)
print(res)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
		String strR = bufferedReader.readLine();
		String strG = bufferedReader.readLine();
		int r = Integer.parseInt(strR);
		int g = Integer.parseInt(strG);

		int answer = g * 2 - r;
		System.out.println(answer);
	}

}


Measured memory_bytes: 21204
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))

    deadline = sum(A) / (4 * M)

    Aa  = sorted(A, reverse=True)[:M]
    
    ans = 'Yes'
    for a in Aa:
        if a < deadline:
            ans = 'No'
    
    print(ans)



if __name__ == '__main__':
    main()

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

using namespace std;

#define x first
#define y second

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

template<typename T,typename F>T bsl(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){h=m-1;r=m;}else{l=m+1;}}return r;}

vector<vector<pll>> E;

vector<pll> solve(int u, ll T) {
    if (E[u].empty()) {
        return {{0LL,0LL}};
    } else {
        auto A = solve(E[u][0].x, T);
        auto B = solve(E[u][1].x, T);
        for (auto &a: A) { a.x += E[u][0].y; a.y += E[u][0].y; }
        for (auto &b: B) { b.x += E[u][1].y; b.y += E[u][1].y; }
        vector<pll> Ans;
        for (int t = 0; t < 2; ++t) {
            int i = 0, j = B.size()-1;
            for (pll a: A) {
                while (i < B.size() && B[i].y + a.x > T) ++i;
                while (j >= 0 && B[j].x + a.x > T) --j;
                if (i != B.size()) Ans.emplace_back(min(a.y,B[i].x),max(a.y,B[i].x));
                if (j >= 0) Ans.emplace_back(min(a.y,B[j].y),max(a.y,B[j].y));
            }
            
            for (pll&a:A) swap(a.x, a.y);
            reverse(A.begin(),A.end());
        }

        sort(Ans.begin(),Ans.end());
        vector<pll> F;
        for (pll ans: Ans) if (F.empty() || F.back().y > ans.y) F.push_back(ans);
        return F;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    int N; cin >> N;
    E.resize(N);
    for (int i = 1; i < N; ++i) {
        int p, c; cin >> p >> c;
        --p;
        E[p].push_back({i,c});
    }

    cout << bsl(0LL, 18000000000LL, [](ll v) {
        auto s = solve(0, v);
        return !s.empty();
    }) << endl;
}


Measured memory_bytes: 22784
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#define N 100000
using namespace std;

int av[N+1],bv[N+1];

int main() {
    int n,i,j,aj,bj,a_max,b_max,ac,bc,a_count,b_count;

    cin>>n;

    for(i=0;i<n/2;i++){
        cin>>j;
        av[j]++;
        cin>>j;
        bv[j]++;
    }
    aj=0;
    bj=0;
    a_max=0;
    b_max=0;
    a_count=0;
    b_count=0;
    for(i=0;i<N+1;i++){
        if(a_max<av[i]){
            a_max=av[i];
            aj=i;
            a_count=0;
        }
        else if(a_max==av[i]){
            a_count++;
        }
        if(b_max<bv[i]){
            b_max=bv[i];
            bj=i;
            b_count=0;
        }
        else if(b_max==bv[i]){
            b_count++;
        }
    }

    if(aj==bj){
        if(abs(a_count-b_count)!=0){
            cout<<n-a_max-b_max;
        }
        else{
            for(i=0;i<N+1;i++){
                if(av[i]==a_max){
                    if(bv[i]!=b_max)
                        break;
                }
            }
            if(i==N+1){
                av[aj]=0;
                bv[bj]=0;
                ac=*max_element(av,&av[N+1]);
                bc=*max_element(bv,&bv[N+1]);

                if((n-a_max-bc)>(n-ac-b_max)){
                    cout<<n-ac-b_max;
                }
                else{
                    cout<<n-a_max-bc;
                }
            }
            else{
                 cout<<n-a_max-b_max;
            }
        }
    }
    else{
        cout<<n-a_max-b_max;
    }

	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

int main() {
  int r;
  cin >> r;
  if (r < 1200) cout << "ABC" << endl;
  else if (r < 2800) cout << "ARC" << endl;
  else cout << "AGC" << endl;
}



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

#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,a,n) for(ll i=a;i<n;i++)

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

const int INF = 100000000;
const ll LINF = 1e18+5;

int main() {
    ll N;
    string S;
    cin >> N;
    cin >> S;
    string abc = "ABC";
    ll ans = 0;
    rep(i,N-2) {
        if(S.compare(i,3,abc)==0)ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define rdll(x) scanf("%lld",&x);
int n,w,h;
vector<P>vec;
vector<int>za;
bool in[400005];
bool cmp(P a,P b){
	return a.sc < b.sc;
}
vector<P>zwa;
int main(){
    cin>>n>>w>>h;
    	for(int i=0;i<w;i++){
    		//(i,0)
    		zwa.pb(mp(i,0));
    	}
    	for(int i=0;i<h;i++){
    		//(w,i)
    		zwa.pb(mp(w,i));
    	}
    	for(int i=w;i>0;i--){
    		//(i,h)
    		zwa.pb(mp(i,h));
    	}
    	for(int i=h;i>0;i--){
    		//(0,i)
    		zwa.pb(mp(0,i));
    	}
    rep(i,n){
    	int x,y; string st;
    	cin>>x>>y>>st;
    	int lb1,ub1;
    	if(st == "N" || st == "E"){
    		lb1 = x+y;
    		ub1 = w+h;
    	}
    	else{
    		lb1 = 0;
    		ub1 = x+y;
    	}
    	int lb2,ub2;
    	if(st == "S" || st == "E"){
    		lb2 = x-y;
    		ub2 = w;
    	}
    	else{
    		lb2 = -h;
    		ub2 = x-y;
    	}
    	//x+y; [lb1,ub1] x-y; [lb2,ub2]
    	vector<int>vecc;
    	for(int i=0;i<w;i++){
    		//(i,0)
    		if(i == x+y) vecc.pb(i);
    		if(i == x-y) vecc.pb(i);
    	}
    	for(int i=0;i<h;i++){
    		//(w,i)
    		if(w+i == x+y) vecc.pb(w+i);
    		if(w-i == x-y) vecc.pb(w+i);
    	}
    	for(int i=w;i>0;i--){
    		//(i,h)
    		if(i+h == x+y) vecc.pb(w+h+w-i);
    		if(i-h == x-y) vecc.pb(w+h+w-i);
    	}
    	for(int i=h;i>0;i--){
    		//(0,i)
    		if(i == x+y) vecc.pb(w+h+w+h-i);
    		if(-i == x-y) vecc.pb(w+h+w+h-i);
    	}
    	assert(vecc.size() == 4);
    	SORT(vecc);
    	int u = 0;
    	rep(i,4){
    		int L = vecc[i], R = vecc[(i+1)%4];
    		int w = (L+1)%zwa.size();
    		int X = zwa[w].fi, Y = zwa[w].sc;
    		if(lb1<=X+Y&&X+Y<=ub1&&lb2<=X-Y&&X-Y<=ub2){
	    		vec.pb(mp(L,R));
	    		za.pb(L); za.pb(R);
	    		u++;
	    	}
	}
	assert(u==1);
    }
    SORT(za); ERASE(za);
    rep(i,vec.size()){
    	vec[i].fi = lower_bound(za.begin(),za.end(),vec[i].fi)-za.begin();
    	vec[i].sc = lower_bound(za.begin(),za.end(),vec[i].sc)-za.begin();
    	if(vec[i].fi > vec[i].sc) vec[i].sc+=za.size();
    }
    int ans = INF;
    for(int i=0;i<za.size();i++){
        vector<P>nw;
        int cur = 0, ret = 1;
        rep(j,vec.size()){
            int a=vec[j].fi,b=vec[j].sc;
            {
                if(a<=i && i<=b);
                else if(a<=i+za.size() && i+za.size()<=b);
                else nw.pb(vec[j]);
            }
        }
        sort(nw.begin(),nw.end(),cmp);
        while(cur != nw.size()){
        	int las = nw[cur].sc; ret++;
        	while(cur != nw.size() && las >= nw[cur].fi) cur++;
    	}
    	ans = min(ans,ret);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 7024
#include <bits/stdc++.h>
#include <vector>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  vector<int> cnt(n);
  rep(i, m){
    int c,d;
    cin >> c >> d;
    cnt[c-1]++;
    cnt[d-1]++;
  }
  rep(i,n) cout << cnt[i] << endl;
  return 0;
}

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

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			int tmp = n;
			int cnt = 0;
			int scale = 0;

			for (int i = 0; i < 6; i++)
			{
				tmp /= 10;
				if (tmp == 0)
				{
					scale = i + 1;
					break;
				}

			}

			switch (scale)
			{
				case 1:
					cnt = n;
					break;
				case 2:
					cnt = 9;
					break;
				case 3:
					cnt = n - 99 + 9;
					break;
				case 4:
					cnt = 900 + 9;
					break;
				case 5:
					cnt = n - 9999 + 900 + 9;
					break;
				case 6:
					cnt = 90000 + 900 + 9;
					break;
				default:
					break;
			}
			
			Console.WriteLine(cnt);
		}
	}
}


Measured memory_bytes: 11092
using System;

namespace d
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int k = int.Parse(input[1]);

            if (k == 0)
            {
                Console.WriteLine(Math.Pow(n, 2));
                return;
            }

            long count = 0;
            for (int b = k + 1; b <= n; b++)
            {
                int m = 0;
                int countByA = 0;
                while (m * b <= n)
                {
                    if ((m + 1) * b <= n)
                    {
                        countByA += b - k;
                        m++;
                        continue;
                    }

                    countByA += Math.Max(0, n - (m * b + k) + 1);
                    m++;
                }

                count += countByA;
            }

            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 11092
S = input()

text = ""
ans = 0
for idx, moji in enumerate(S):
    
    if moji == "A" or moji == "C" or moji == "G" or moji == "T":
        text += moji
        for j in range(idx+1,len(S)):
            if S[j] == "A" or S[j] == "C" or S[j] == "G" or S[j] == "T":
                text += S[j]
                #print(0, text)
            else:
                #print(-1, text)
                if len(text) > ans:
                    ans = len(text)
                text = ""
                break
        if len(text) > ans:
            ans = len(text)
        text = ""
    else:
        text = ""

print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
ll modpow(ll a, ll b, ll m) {
    if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll h = modpow(a, b / 2, m);
        return h * h % m;
    } else {
        return a * modpow(a, b - 1, m) % m;
    }
}
ll comb(ll a, ll b, ll m) {
    if (b > a - b) {
        return comb(a, a - b, m);
    }
    ll c = 1, d = 1;
    REP(i, b) {
        c *= (a - i);
        d *= (b - i);
        c %= m;
        d %= m;
    }
    return c * modpow(d, m - 2, m) % m;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> a(N + 1);
    vector<bool> b(N + 1, false);
    FOR(i, 1, N + 1, 1) {
        cin >> a[i];
        if (i > N / 2) {
            b[i] = a[i] == 1;
        }
    }
    RFOR(i, N / 2, 1, 1) {
        int cnt = 0;
        FOR(j, 1, N / i + 1, 1) {
            if (b[i * j]) {
                cnt++;
            }
        }
        if (cnt % 2 != a[i]) {
            b[i] = true;
        }
    }
    int res = 0;
    FOR(i, 1, N + 1, 1) {
        if (b[i]) {
            res++;
        }
    }
    cout << res << endl;
    FOR(i, 1, N + 1, 1) {
        if (b[i]) {
            cout << i << " ";
        }
    }
    cout << endl;
    return 0;
}


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

namespace ABC063A
{
    class Program
    {
        static void Main(string[] args)
        {
            int A, B;
            string[] vals = Console.ReadLine().Split(' ');
            A = int.Parse(vals[0]);
            B = int.Parse(vals[1]);

            int ans = A + B;
            if(ans >= 10)
            {
                Console.WriteLine("error");
            }
            else
            {
                Console.WriteLine(ans);
            }

        }
    }
}


Measured memory_bytes: 13140
// C++ 14
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <math.h>

#define ll long long
#define Int ll
#define loop(x, start, end) for(Int x = start; x < end; x++)
#define loopdown(x, start, end) for(int x = start; x > end; x--)
#define rep(n) for(Int x = 0; x < n; x++)
#define span(a,x,y) a.begin()+x,a.begin()+y
#define span_all(a) a.begin(),a.end()
#define len(x) (x.size())
#define last(x) (x[x.size()-1])

using namespace std;

struct Point {
  Int x, y;
  Point(Int x, Int y): x(x), y(y) {}
  Point(): x(0), y(0) {}

  bool operator< (const Point &p1) {
    return x < p1.x && y < p1.y;
  }
};
ostream & operator << (ostream & out, Point const & v) {
  out << "Point(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Point & v) {
  Int x, y;
  in >> x; in >> y; v.x = x; v.y = y;
  return in;
}

// Geometry

#define EPS 0.0000000001

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (Vector2 v) { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (Vector2 v) { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (double k) { return Vector2(x * k, y * k); }
  Vector2 operator / (double k) { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 v) { return x * v.x + y * v.y; }
  double cross (Vector2 v) { return x * v.y - y * v.x; }
  
  bool operator < (const Vector2 &v) const {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) const {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

Int N, A, B;

void input() {
  cin >> N >> A >> B;
}

void solve() {
  if (A > B) swap(A, B);
  Int diff = abs(A - B);
  if (diff % 2 == 0) {
    cout << diff / 2 << endl;
    return;
  }

  Int d = min(A - 1, N - B) + 1;
  if (A - 1 < N - B) {
    A = 1;
    B -= d;
  } else {
    B = N;
    A += d;
  }
  diff = abs(A - B);
  cout << d + (diff/2) << endl;
}

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


Measured memory_bytes: 256