akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

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

typedef long long ll;

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

 ll n,x;
  cin >> n >> x;
  if(x==1||x==2*n-1) {
    cout << "No" << endl;
    return 0;
  }
  
  cout << "Yes" << endl;
  
  if(n==2) {
    cout << 1 << endl;
    cout << 2 << endl;
    cout << 3 << endl;
    return 0;
  }
  
  vector<ll> v;
    
  rep(i,1,x-2) v.push_back(i); 
  if(x!=2&&x+2<=2*n-1) v.push_back(x+2);
  rep(i,x+3,2*n) v.push_back(i); 
  
   rep(i,0,n-2) cout << v[i] << endl;
  if(x==2) {
    cout << x+1 << endl;
    cout << x << endl;
    cout << x-1 << endl;
    cout << x+2 << endl;
  }
  else {
    cout << x-1 << endl;
    cout << x << endl;
    cout << x+1 << endl;
    cout << x-2 << endl;
  }
   rep(i,n-2,v.size()) cout << v[i] << endl;  
  
  
}


Measured memory_bytes: 3184
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <numeric>


int main() {
	long long n, k;

	std::cin >> n >> k;

	if (n <= 2) {
		if (n == 1 && k == 1) {
			std::cout << 1 << std::endl;
			return 0;
		}
		else if (n == 2 && k == 1) {
			std::cout << 0 << std::endl;
			return 0;
		}
		else if (n == 1) {
			std::cout << k - 2 << std::endl;
			return 0;
		}
		std::cout << 0 << std::endl;
		return 0;
	}

	if (k <= 2) {
		if (k == 2 && n == 1) {
			std::cout << 0 << std::endl;
			return 0;
		}
		else if (k == 1 && n == 1) {
			std::cout << 1 << std::endl;
			return 0;
		}
		else if (k == 1) {
			std::cout << n - 2 << std::endl;
			return 0;
		}
		std::cout << 0 << std::endl;
		return 0;
	}

	std::cout << (n - 2) * (k - 2) << std::endl;

	return 0;
}

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

using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    int Max = max(A, C);
    int Min = min(B, D);

    cout << max(0, Min - Max) << endl;
} 

Measured memory_bytes: 256
module JSC2019

  ! <module>s to import
  use, intrinsic :: iso_fortran_env

  ! require all variables to be explicitly declared
  implicit none

  ! accessibility of <subroutine>s and <function>s in this <module>
  public :: task_A

  ! contained <subroutine>s and <function>s are below
  contains

  subroutine task_A

    ! variables for this <subroutine>
    integer(INT32) :: digit01
    integer(INT32) :: digit10
    integer(INT32) :: num_days_per_month
    integer(INT32) :: num_days_product
    integer(INT32) :: num_months_per_year

    ! support variables for this <subroutine>
    integer(INT32) :: itr_day
    integer(INT32) :: itr_month

    ! STEP.01
    ! read the given data
    read(unit=INPUT_UNIT, fmt=*) num_months_per_year, num_days_per_month

    ! STEP.02
    ! initialize the variables for this <subroutine>
    num_days_product = 0_INT32

    ! STEP.03
    ! count up the number of "product days"
    do itr_month = 1_INT32, num_months_per_year, 1_INT32
    do itr_day   = 1_INT32, num_days_per_month,  1_INT32

      if (itr_day .ge. 20_INT32) then

        digit01 = mod(itr_day, 10_INT32)
        digit10 = (itr_day - digit01) / 10_INT32

        if (digit01 .ge. 2_INT32 .and. digit01 * digit10 .eq. itr_month) then
          num_days_product = num_days_product + 1_INT32
        end if

      end if

    end do
    end do

    ! STEP.04
    ! output the answer of this task
    write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') num_days_product

    ! STEP.END
    return

  end subroutine task_A

end module JSC2019


program main

  ! <module>s to import
  use, non_intrinsic :: JSC2019

  ! require all variables to be explicitly declared
  implicit none

  call task_A

end program main

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

int main(){
  char a[101][101];
  int b[101] = {0}, c[101] = {0};
  int h, w;
  
  cin >> h >> w;
  
  for(int i = 0; i < h; i++ ){
    for(int j = 0; j < w; j++){
      cin >> a[i][j];
      if(a[i][j] == '#'){
        b[i] = 1;
        c[j] = 1;
      }
    }
  }
  
  for(int i = 0; i < h; i++ ){
    if(b[i] == 0) continue;
    for(int j = 0; j < w; j++){
      if(c[j] == 0) continue;
      cout << a[i][j];
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void)
{
  char S[101];
  int i = 0;
  
  scanf("%s", S);
  
  while(S[i] != '\0') {
    S[i] = 'x';
    i++;
  }
  
  printf("%s\n", S);
  
  return 0;
}

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

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		int n=in.nextInt(),CA[][]=new int[4][14];
		for(int i=0;i<n;i++) {
			String s=in.next();int nm=in.nextInt();
			if(s.equals("S"))CA[0][nm]=1;
			else if(s.equals("H"))CA[1][nm]=1;
			else if(s.equals("C"))CA[2][nm]=1;
			else if(s.equals("D"))CA[3][nm]=1;
		}
		
		char simb[]= {'S','H','C','D'};
		for(int i=0;i<4;i++) {
			for(int j=1;j<=13;j++) {
				if(CA[i][j]==0)out.println(simb[i]+" "+j);
			}
		}
		out.flush();
	}

}



Measured memory_bytes: 26376
let rec loop a b =
  print_endline(string_of_int(a)^"x"^string_of_int(b)^"="^string_of_int(a*b));
  if b < 9 then loop a (b+1)
  else if a < 9 then loop (a+1) 1

let () = 
  loop 1 1

Measured memory_bytes: 2116
import sys,collections
input = sys.stdin.readline

N = int(input())
a = list(map(int,input().split()))
count = [0]*9
for ai in a:
    if 1 <= ai < 400:
        count[0] = 1
    elif 400 <= ai < 800:
        count[1] = 1
    elif 800 <= ai < 1200:
        count[2] = 1
    elif 1200 <= ai < 1600:
        count[3] = 1
    elif 1600 <= ai < 2000:
        count[4] = 1
    elif 2000 <= ai < 2400:
        count[5] = 1
    elif 2400 <= ai < 2800:
        count[6] = 1
    elif 2800 <= ai < 3200:
        count[7] = 1
    else:
        count[8] += 1
print(max(1,sum(count[:-1])),sum(count))


Measured memory_bytes: 9464
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
typedef long long ll;
const int mod= 1e+9+7;

int main() {
    vector<vector<int>>c(3,vector<int>(3));
    rep(i,3){
        rep(j,3)cin>>c[i][j];
    }
    vector<int>a(3);
    vector<int>b(3);
    a[0]=0;
    b[0]=c[0][0];
    b[1]=c[0][1];
    b[2]=c[0][2];
    a[1]=c[1][0]-b[0];
    a[2]=c[2][0]-b[0];
    rep(i,3){
        rep(j,3){
            if(c[i][j]!=a[i]+b[j]){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
def main():
    n, x = [int(z) for z in input().split()]
    l = [int(z) for z in input().split()]
    tam = len(l)
    d = 0
    for i in range(tam):
        d += l[i]
        if d > x:
            print(i + 1)
            break
    if d <= x:
        print(n+1)
main()

Measured memory_bytes: 3060
import math

a, b, x = map(int, input().split())

H = x / (a**2)
nokori = b - H

sa = nokori * 2
# (y, x)
ans = math.degrees(math.atan2(sa, a))
if H * 2 >= b:
    print(ans)
else:
    # print(H)
    men = H*a
    # print(men)
    _x = men * 2 / b
    # print(_x)
    ans = math.degrees(math.atan2(b, _x))
    print(ans)
    # print('o')

Measured memory_bytes: 38256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

string s;

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

    int N, K;
    cin >> N >> K >> s;

    priority_queue<int> pq;

    int r = 0;
    int num = 0;
    queue<int> nextl;
    nextl.push(0);
    int ans = 0;
    while (r < N)
    {
        if ((r > 0 && s[r - 1] == '0' && s[r] == '1'))
        {
            nextl.push(r);
            ++num;
        }

        if (num == K && (r > 1 && s[r - 1] == '1' && s[r] == '0'))
        {
            ans = max(ans, r - nextl.front());
            --num;
            nextl.pop();;
        }
        ++r;
    }


    cout << max(ans, r - nextl.front()) << "\n";
    return 0;
}



Measured memory_bytes: 512
package main
import (
    "fmt"
)
    
func main(){
    var N, ans int
    fmt.Scan(&N)
    for i, div, mod:=3, N/3, N/3;div>1;i+=2{
        div, mod = N/i, N%i
        if mod == 0 {
            continue
        }
        i+=mod/div-1
        if mod%div == 0{
            ans += i
        }
        
    }
    fmt.Println(ans)
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int n;
int d[100] = {0};
int f[100] = {0};
bool m[100][100];
int t = 1;

void dfs(int x) {
  for(int i = 0; i < n; i++) {
    if(d[i] == 0) {
      if(m[x][i] == true) {
        d[i] = t;
        t++;
        dfs(i);
        f[i] = t;
        t++;
      } else if(x == i) {
        d[i] = t;
        t++;
        dfs(i);
        f[i] = t;
        t++;
      }
    }
  }
}

int main() {

  rep(i, n) {
    rep(j, n) {
      m[i][j] = false;
    } 
  }
  m[0][0] = true;
  // m[2][2] = true;

  cin >> n;
  for(int i = 0; i < n; i++) {
    int x, temp;
    cin >> x >> temp;
    for(int j = 0; j < temp; j++) {
      int y;
      cin >> y;
      m[x - 1][y - 1] = true;
    }
  }

  t = 1;
  rep(i, n) {
    // dfs(0);
    dfs(i);
    // if(d[i] == 0) dfs(i);
  }

  for(int i = 0; i < n; i++) {
    cout << i + 1 << " " << d[i] << " " << f[i] << endl;
  }

  return 0;
}


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

int main(){
  int x;
  cin >> x;
  if(x==1){cout << 1 << endl;return 0;}
  vector<int> vec;
  for(int i=2;i<32;i++){
    for(int j=2;;j++){
      if(pow(i,j)<=32*32){vec.push_back(pow(i,j));}
      else{break;}
    }
  }
  sort(vec.begin(),vec.end());
  for(int i=0; i<vec.size(); i++){
    if(x<vec.at(i)){cout<<vec.at(i-1)<<endl;return 0;}
  }
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mst(a,b) memset((a),(b),sizeof(a))
#define pi acos(-1)
#define pii pair<int,int>
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
const int MAXN = 1e2 + 10;
const int MAXM = 2e6 + 10;
const ll mod = 1e9 + 7;



int main()
{
#ifdef local
    freopen("data.txt","r",stdin);
//    freopen("data.txt","w",stdout);
#endif
    int a,b,c,x;
    scanf("%d%d%d%d",&a,&b,&c,&x);
    int ans = 0;
    for(int i=0; i<=a; i++) {
        for(int j=0; j<=b; j++) {
            for(int k=0; k<=c; k++) {
                int sum = 500 * i + 100 * j + 50 * k;
                if(sum == x) ans++;
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;
typedef pair<int, int> P;

int R[10];
int d[10][10];
int main()
{
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		R[i] = i;
	}
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		d[a][b] = 1;
		d[b][a] = 1;
	}
	int ans = 0;
	bool plus = true;
	do {
		plus = true;
		if (R[0] != 0) break;
		for (int i = 0; i < N - 1; i++) {
			if (d[R[i]][R[i + 1]] == 0) {
				plus = false;
				break;
			}
		}
		if (plus) ans++;
	} while (next_permutation(R, R + N));
	cout << ans << endl;
}


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

int main() {
  int N,min=0,x=0;
  cin >> N;
  vector<int>P(N);
  for(int i=0;i<N;i++){
      cin >> P[i];
  }
  min=P[0];
  for(int i=0;i<N;i++){
      if(P[i]<=min){
          x++;
          min=P[i];
      }
  }
  cout << x;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iomanip>
#include <iostream>
using namespace std;
/** Problem0167 : Bubble Sort **/
int main()
{
	int d[100], n, ans;
	
	while (cin >> n, n!= 0) {
		ans=0;
		
		for (int i=0; i<n; i++)
			cin >> d[i];
	
		for (int i=0; i<n; i++) {
			for (int j=n-1; i<j; j--) {
				if (d[j-1] > d[j]) {
					swap(d[j-1], d[j]);
					ans++;
				}
			}
		}
	
		cout << ans << endl;
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    ll N;
    cin >> N;
    // vector<ll> P(N);
    map<ll, ll> P_to_idx;
    for(ll i=0; i<N; i++) {
        ll tmp;
        cin >> tmp;
        tmp--;
        P_to_idx[tmp] = i;
    }

    set<int> larger_idx, inv_larger_idx;
    ll ans = 0;
    larger_idx.insert(P_to_idx[N-1]);
    inv_larger_idx.insert(-P_to_idx[N-1]);
    for(ll i=N-2; i>=0; i--) {
        ll idx = P_to_idx[i];
        // cerr << "i = " << i << " idx = " << idx << endl;
        // for(auto x: larger_idx) cerr << x << " "; cerr << endl;
        // for(auto x: inv_larger_idx) cerr << x << " "; cerr << endl;
        larger_idx.insert(P_to_idx[i]);
        inv_larger_idx.insert(-P_to_idx[i]);
        auto itr = larger_idx.lower_bound(idx);
        auto itr_r1 = larger_idx.upper_bound(*itr);
        auto itr_r2 = itr_r1;
        if(itr_r1!=larger_idx.end())
            itr_r2 = larger_idx.upper_bound(*itr_r1);
        auto itr_l1 = inv_larger_idx.upper_bound(-idx);
        auto itr_l2 = itr_l1;
        if(itr_l2 != inv_larger_idx.end()) {
            // cerr << "*itr_l1 = " << *itr_l1 << " get itr l2" << endl;
            itr_l2 = inv_larger_idx.upper_bound(*itr_l1);
        }
        // cerr << "debug" << endl;
        // cerr << "*itr = " << *itr << " *itr_l1 = " << *itr_l1 << " *itr_l2 = " << *itr_l2 << " *itr_r1 = " << *itr_r1 << " *itr_r2 = " << *itr_r2 << endl; 
        ll r1, r2, l1, l2;
        if(itr_r1 == larger_idx.end()) r1 = N;
        else r1 = *itr_r1;
        if(itr_r2 == larger_idx.end()) r2 = N;
        else r2 = *itr_r2;
        if(itr_l1 == inv_larger_idx.end()) l1 = -1;
        else l1 = -*itr_l1;
        if(itr_l2 == inv_larger_idx.end()) l2 = -1;
        else l2 = -*itr_l2;
        // cerr << "*itr = " << *itr << " l1 = " << l1 << " l2 = " << l2 << " r1 = " << r1 << " r2 = " << r2 << endl; 
        
        // if(l1 == l2) l1++;
        // if(r2==r1) r2++; 
        ll diff = (l1 - l2) * (r1 - *itr) + (*itr - l1) * (r2 - r1);
        ans += (i+1)*diff;
        // cerr << "diff = " << diff << endl;
    }

    cout << ans << endl;

    return 0;
}

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

typedef long long int ll;

int main(){
  int N;
  cin >> N;
  string s,t;
  cin >> s >> t;
  for(int i=0; i<N; i++){
    cout<<s[i]<<t[i];
  }
  cout<<endl;
}

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

int main(void){
    int n,k,ans=0;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        ans += min(abs(x-k),x)*2;
        
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
using graph = vector<vector<ll>>;


int main() {
	ll a, b, h;
	long double time,m;
	long double pi= acos(-1);
	cin >> a >> b >> h >> m;
	time = 60 * h + m;
	long double aang = time / 360;
	long double bang = m / 30;
	long double angle = abs(aang - bang);
	angle = min(angle, 2 - angle);
	cout <<fixed << setprecision(20) << powl (pow(a, 2) + pow(b, 2) - 2 * a * b * cos(angle * pi),0.5)<< endl;
	return 0;
}

Measured memory_bytes: 4172
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <queue>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <set>
#include <map>
#include <stack>

using namespace std;

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

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

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

int main(void){
  LL n, w; cin >> n >> w;
  LL weight[n], value[n], dp[n+1][w+1];

  rep(i, n) cin >> weight[i] >> value[i];
  for(int i =0; i <= n; i++) {
    for (int j = 0; j <= w; j++) dp[i][j] = 0;
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= w; j++) {
      if (0 <= j - weight[i]) {
        chmax(dp[i+1][j], dp[i][j-weight[i]] + value[i]);
      }

      chmax(dp[i+1][j], dp[i][j]);
    }
  }

  cout << dp[n][w] << endl;

  return 0;
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<min(a+c,min(a+d,min(b+c,b+d)));
}


Measured memory_bytes: 256
#include "stdio.h"
#include "stdlib.h"
#include "iostream"
#include "math.h"
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include "algorithm"


using namespace std;
#define fori0(G) for(int i=0;i<G;i++)
#define fori1(G) for(int i=1;i<=G;i++)
#define forj0(G) for(int j=0;j<G;j++)
#define forj1(G) for(int j=1;j<=G;j++)
#define fork0(G) for(int k=0;k<G;k++)
#define fork1(G) for(int k=1;k<=G;k++)
int dx[] = { -1,0,1,0 ,0 }, dy[] = { 0,1,0,-1,0 };
#define nxnycon (0<=nx&&nx<h&&0<=ny&&ny<w) 
#define lo long long int

int p[200001],q[200001],n,m=0;

int main() {
	cin >> n;
	fori1(n) {
		cin >> p[i];
		q[p[i]] = q[p[i] - 1] + 1;
		m = max(m,q[p[i]]);
	}

	/*int r=0, l=0,k=1;
	fori0(n) {
		if (p[i] == k) { l++;k++; }
	}
	k = n;
	for (int i = n - 1;i >= 0;i--) {
		if (p[i] == k) { r++;k--; }
	}*/
	cout << n-m;
	//system("pause");
	return 0;

}



Measured memory_bytes: 1792
import sys
input = sys.stdin.readline
N = int(input())
F = []
for _ in range(N):
    F.append([str(x) for x in input().split()])
P = []
for _ in range(N):
    P.append([int(x) for x in input().split()])
ans = -10 ** 10
for i in range(1, 2 ** 10):
    bini = "0b" + format(i, 'b').zfill(10)
    ans_ = 0
    for j in range(N):
        shop = "0b" + "".join(F[j])
        cnt = bin((int(shop, 2) & int(bini, 2))).count("1")
        ans_ += P[j][cnt]
    ans = max(ans, ans_)
print(ans)



Measured memory_bytes: 3064
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = list(map(int, readline().split()))
ans = [0] * n
for aa in a:
    ans[aa - 1] += 1
for i in range(n):
    print(ans[i])


Measured memory_bytes: 27836
#include<iostream>
#include<queue>
#include<vector>
#define INF (int)1e9 + 7
using namespace std;
int n;
vector<pair<int, int> > adj[10000];
void dijkstra();
int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            int v, c; //vertex cost
            cin >> v >> c;
            adj[u].push_back(make_pair(c, v));
        }
    }
    dijkstra();
    return 0;
}
void dijkstra() {
    int dist[n];
    dist[0] = 0;
    for (int i = 1; i < n; i++) {
        dist[i] = INF;
    }
    priority_queue<pair<int, int> > q;
    q.push(make_pair(0, 0));
    while (!q.empty()) {
        int u = q.top().second;
        int co = -q.top().first;
        q.pop();
        for (int i = 0; i < adj[u].size(); i++) {
            int v = adj[u][i].second;
            int co2 = adj[u][i].first;
            if (dist[u] + co2 < dist[v]) {
                dist[v] = co2 + dist[u];
                q.push(make_pair(-dist[v] ,v));
            }
        }
    }
    for (int i = 0; i < n; i++) {
        cout << i << " " << dist[i] << endl;
    }
    
}



Measured memory_bytes: 8016
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vvi vector<vector<int>> 
#define vi vector<int> 
#define vpii vector<pair<int,int>> 
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define ffor(i,n) for(int i = 0; i < n; ++i)

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    mt19937_64 rngl(chrono::steady_clock::now().time_since_epoch().count());
    
    int x;
    cin >> x;
    int ans;
    for(int i = 2;i <= 1e6; ++i){
        bool ok = true;
        for(int j = 2; j*j <= x; ++j){
            if(i != j && i%j == 0){
                ok = false;
                break;
            }
        }
        if(ok && i >= x){
            ans = i;
            break;
        }
    }
    cout << ans;
}

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

int main() {
  ll N,A,B;
  cin>>N>>A>>B;
  ll C = A+B;
  ll ans;
  if(N%C>=A) ans = N/C*A+A;
  else ans = N/C*A+N%C;
  cout<<ans<<endl;
}

Measured memory_bytes: 3668
a,b,k=map(int,input().split())
ans=[]
for i in range(a,min(a+k,b+1)):
  ans.append(i)
for i in range(max(b-k+1,a),b+1):
  ans.append(i)
ans = sorted(list(set(ans)))
for i in ans:
  print(i)

Measured memory_bytes: 9188
import collections
N, M = map(int, input().split())
graph = [[] for _ in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
q = collections.deque()
q.append(0)
dist = [-1]*N
dist[0] = 0
while len(q) != 0:
    v = q.popleft()
    for w in graph[v]:
        if dist[w] > -1:
            continue
        dist[w] = v + 1
        q.append(w)
print('Yes')
for i in range(1,N):
    print(dist[i])


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

int main(){

    int n;
    cin >> n;
    int a[n];
    double ave = 0;
    rep(i,n) {
        cin >> a[i];
        ave += a[i];
    }
    ave /= n;
    double d = 1e5;
    int ans = 0;
    rep(i,n){
        if(d > abs(ave-a[i])){
            ans = i;
            d = abs(ave-a[i]);
        }
    }

    
    cout << ans << endl;

    return 0;
}

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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

  ll x;
  cin >> x;

  ll y = 100, i = 1;
  while (1) {
    y = y + (y * 0.01);
    if (y >= x) break;
    i++;
  }
  cout << i << "\n";
}

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

#define ll long long

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

     vector<ll> v(n);

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


     ll ans = 0;

     for(int i=0;i<n-1;++i){
        if(v[i+1]<v[i]){
            ans+= v[i] - v[i+1];

            v[i+1] +=  (v[i] - v[i+1]);
        }

     }


     cout<<ans<<endl;





    return 0;
}




Measured memory_bytes: 4836
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, Y) for (int(X) = 0; (X) < (Y); ++(X))
#define rrep(X, Y) for (int(X) = (Y)-1; (X) >= 0; --(X))
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl
#define INF 1e12

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

void solve(long long N, long long C, long long K, std::vector<long long> T) {
  sort(all(T));
  ll ans = 0;
  ll start = 0;
  while (start < N) {
    ll t1 = T[start] + K;
    ll t2 = INF;
    if (start + C - 1 < N) {
      t2 = T[start + C - 1];
    }

    ans++;
    if (t2 <= t1) {
      start += C;
    } else {
      auto it = upper_bound(all(T), t1) - T.begin();
      start = it;
    }
  }
  print(ans);
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long C;
  scanf("%lld", &C);
  long long K;
  scanf("%lld", &K);
  std::vector<long long> T(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &T[i]);
  }
  solve(N, C, K, std::move(T));
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
template <typename T> bool chmin(T &x, const T &y) {if (x > y) {x = y; return true;} return false;}
template <typename T> bool chmax(T &x, const T &y) {if (x < y) {x = y; return true;} return false;}

int main() {
    int N;
    ll W;
    cin >> N >> W;
    vector<vector<ll>> S(4);
    ll s = 0;
    rep(i, N) {
        ll w, v;
        cin >> w >> v;
        if (!i) s = w;
        S[w - s].push_back(v);
    }
    
    rep(i, 4) sort(S[i].rbegin(), S[i].rend());
    vector<vector<ll>> sum(4);
    rep(i, 4) {
        sum[i].resize(SZ(S[i]) + 1);
        rep(j, SZ(S[i])) sum[i][j + 1] = sum[i][j] + S[i][j];
    }
    ll ans = 0;
    rep(i, N + 1) rep(j, N + 1) rep(k, N + 1) rep(l, N + 1) {
        if (i > SZ(S[0]) || j > SZ(S[1]) || k > SZ(S[2]) || l > SZ(S[3])) continue;
        if (i * s + j * (s + 1) + k * (s + 2) + l * (s + 3) > W) continue;
        chmax(ans, sum[0][i] + sum[1][j] + sum[2][k] + sum[3][l]);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3584
#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
    int n;
    scanf("%d", &n);
    double ans = 0;
    while(n--)
    {
        double x;
        char s[20];
        scanf("%lf %s", &x, s);
        if(strcmp(s, "JPY") == 0)
        {
            ans += x;
        }
        else
        {
            ans += x * 380000;
        }
    }
    printf("%5f\n", ans);
    return 0;
}


Measured memory_bytes: 128
i = gets.chomp.to_i

a = []
1.step(i) do |i| 
  if i % 3 == 0
    a.push(i)
  else
    k = i 
    while k != 0
      if k % 10 == 3
        a.push(i)
        k = 0 
      else
        k /= 10
      end 
    end 
  end 
end

puts " "+a*" "

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

using namespace std;

namespace Solver {

    int N, M, P;
    vector<int> X;
    inline bool Read() {
        cin >> N >> M >> P;
        if (N == 0) return false;
        X.resize(N);
        for (int i = 0; i < N; i++) cin >> X[i];

        return true;
    }

    inline void Work() {
        double sum = 0;
        for (int i = 0; i < N; i++) sum += X[i];
        if (X[M - 1] == 0) cout << 0 << endl;
        else cout << (int)((100 - P) * sum / X[M - 1]) << endl;
    }

    inline void Solve() {
         while(Read()) Work();
    }
}

int main() {
    Solver::Solve();
}

Measured memory_bytes: 1208
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.Int();
            int K = in.Int();
            int[] A = in.Int(N);
            out.println(1 + (int) Math.ceil((double) (N - K) / (K - 1)));
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

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

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

        public int[] Int(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = Int();
            }
            return a;
        }

    }
}



Measured memory_bytes: 32960
n,c=map(int,input().split())
L=R=Rmax=0
x=[0]*n
v=[0]*n
for i in range(n):
  xx,vv=map(int,input().split())
  x[i]=xx
  v[i]=vv
  L+=vv
ans=L-x[-1]
for i in reversed(range(n)):
  L-=v[i]
  R+=v[i]
  Rmax=max(Rmax,R-(c-x[i]))
  ans=max(ans,L-(x[i-1]*2 if i>0 else 0)+Rmax)
Lmax=0
for i in range(n):
  L+=v[i]
  R-=v[i]
  Lmax=max(Lmax,L-x[i])
  ans=max(ans,R-((c-x[i+1])*2 if i<n-1 else 0)+Lmax)
print(ans)

Measured memory_bytes: 12916
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }
    

    Scanner cin;
    
    

    void calc()
    {
        cin = new Scanner();
        long A = cin.nextLong();
        long B = cin.nextLong();
        int ans = 0;
        while(A <= B)
        {
            A *= 2;
            ans++;
        }
        Console.WriteLine(ans);
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 13140
#include <stdio.h>

int main(void)
{
	int a, b, c, i, count;
	scanf("%d%d%d",&a ,&b ,&c);
	count = 0;
	for (i = a; i <= b; i++ ){
		if (c % i == 0)
			count++;
	}
	printf("%d\n", count);
	
	return 0;
}


Measured memory_bytes: 2100
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

char mp[555][555];
char aka[555][555];
char ao[555][555];
int w, h;

int main()
{

	cin >> h >> w;
	REP(i, h)REP(j, w)cin >> mp[i][j];

	REP(i, h)
	{
		REP(j, w)
		{
			if (j == w - 1)
			{
				cout << '.';
			}
			else if (i % 2 == 0 || mp[i][j] == '#' || j == 0)
			{
				cout << '#';
			}
			else
			{
				cout << '.';
			}
		}
		cout << endl;
	}cout << endl;

	REP(i, h)
	{
		REP(j, w)
		{
			if (j == 0)
			{
				cout << '.';
			}
			else if (i % 2 == 1 || mp[i][j] == '#' || j == w - 1)
			{
				cout << '#';
			}
			else
			{
				cout << '.';
			}
		}
		cout << endl;
	}

	return 0;
}


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

int main(){
  int N, K;
  cin >> N >> K;
  int Ans=0;
  for(int i=0; i<=pow(10, 9); i++){
    if(pow(K, i)<=N){
      Ans++;
    }
    else{
      break;
    }
  }
    cout << Ans << endl;
}

Measured memory_bytes: 256
import random as ran
n = int(input())
A = [[int(x) for x in input().split()] for l in range(n)]


# for i in range(n):
#     if (A[i][0] + A[i][5] != 7):
#         del A[i]

oup = 0
oun = 0
ori = 0
ole = 0
ofr = 0
oba = 0

up = 0
un = 0
ri = 0
le = 0
fr = 0
ba = 0
tmp = 0
tmp2 = 0

count = 0
order = ["S","N","E","W"]

def diceorigin(num):
    global oup
    global oun
    global ori
    global ole
    global ofr
    global oba

    oup = A[num][0]
    oun = A[num][5]
    ori = A[num][2]
    ole = A[num][3]
    ofr = A[num][1]
    oba = A[num][4]

def dice(num):
    global up
    global un
    global ri
    global le
    global fr
    global ba
    global tmp2
    global tmp

    up = A[num][0]
    un = A[num][5]
    ri = A[num][2]
    le = A[num][3]
    fr = A[num][1]
    ba = A[num][4]
    tmp2 = 0
    tmp = 0

for x in range(0,len(A)):
    diceorigin(x)

    for y in range(x+1,len(A)):
        dice(y)


        for i in range(100)  :
            x = ran.choice(order)
            if (x == "S"):
                tmp = fr
                tmp2 = un
                fr = up
                up = ba
                un = tmp
                ba = tmp2

            elif (x == "N"):
                tmp = un
                tmp2 = up
                up = fr
                un = ba
                fr = tmp
                ba = tmp2

            elif (x == "E"):
                tmp = up
                tmp2 = un
                up = le
                un = ri
                ri = tmp
                le = tmp2

            elif (x == "W"):
                tmp = un
                tmp2 = up
                up = ri
                un = le
                ri = tmp
                le = tmp2

            if (up == oup and un == oun and ri == ori and le == ole and fr == ofr and ba == oba):
                print("No")
                exit()


            # print(up,un,ri,le,fr,ba,oup,oun,ori,ole,ofr,oba)
print("Yes")



Measured memory_bytes: 8252
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define int long long

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

template<typename T>T& max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T& min(T&a,T&b){if(a<b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

signed main()
{
    int W, H; cin >> W >> H;

    vpii E;

    int p, q;
    rep(i, W) cin >> p, E.PB(pii(p, 0));
    rep(i, H) cin >> q, E.PB(pii(q, 1));

    sort(all(E));

    int ans = 0;

    rep(i, E.size()) {
        pii e = E[i];

        if (e.scd == 0) {
            ans += e.fst * (H + 1);
            W--;
        } else {
            ans += e.fst * (W + 1);
            H--;
        }

        if (H < 0 || W < 0) break;
    }

    cout << ans << endl;
}


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

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力
            //string s = Console.ReadLine();

            // 整数の入力
            int N = int.Parse(Console.ReadLine());

            // 文字列配列の入力
            //string[] inputStrArray = Console.ReadLine().Split(' ');

            // 整数配列の入力
            var inputintArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            int cnt = 0;

            for(int i=0; i < N; i = i + 2)
            {
                if (inputintArray[i] % 2 == 1)
                {
                    cnt++;
                }
            }


            Console.WriteLine(cnt);

            Console.Out.Flush();
        }
    }
}


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

using namespace std;

double eps = 1e-9;

double eq(double a,double b)
{
    return abs(a-b)<eps;
}

int main()
{
    int x1,y1,r1;
    int x2,y2,r2;

    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>x1>>y1>>r1;
    cin>>x2>>y2>>r2;

    if(r1>r2) swap(r1,r2);

    double d = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));

    int ans = 2;

    if(d>r1+r2+eps) ans = 4;
    if(eq(r1+r2,d)) ans = 3;
    if(eq(r2-r1,d)) ans = 1;
    if(d+r1<r2-eps) ans = 0;

    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n, m;
  cin >> n >> m;
  
  vl reach(n);
  ll a, b;
  rep(_, m) {
    cin >> a >> b;
    a--; b--;
    if(a>b) swap(a, b);
    if(a==0) reach[b]++;
    if(b==n-1) reach[a]++;
  }
  cout << (count(all(reach), 2) ? "" : "IM") << "POSSIBLE" << newl;
  return 0;
}

Measured memory_bytes: 4764
#include<iostream>
using namespace std;
int main(){
	int X;
	cin >> X;
	if (X % 7 == 0){
		cout <<"thu" << endl;
	}
	if (X % 7 ==1){
		cout <<"fri" << endl;
	}
	if (X % 7 == 2){
		cout << "sat" << endl;
	}
	if (X % 7 == 3){
		cout << "sun" << endl;
	}
	if (X % 7 == 4){
		cout << "mon" << endl;
	}
	if (X % 7 == 5){
		cout << "tue" << endl;
	}
	if (X % 7 == 6){
		cout << "wed" << endl;
	}
	return 0;
}




Measured memory_bytes: 3112
#include<bits/stdc++.h>
#define LL long long
#define db double

using namespace std;
const int N=600+10;
int rd()
{
	int x=0,w=1;char ch=0;
	while(ch<'0'||ch>'9'){if(ch=='-') w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+(ch^48);ch=getchar();}
	return x*w;
}
int n,l1,l2,co[N][N],c2[N][N],st[N][2],tp;
bool vs[N][N];
struct node{int x,y;};
vector<node> ls[4];
queue<node> q;
void wk(int d,int u)
{
	tp=0;
	for(int j=0;j*j<=d;++j)
	{
		int k=sqrt(d-j*j);
		if(k*k+j*j==d) st[++tp][0]=j,st[tp][1]=k;
	}
	memset(vs,0,sizeof(vs));
	for(int i=0;i<n+n;++i)
		for(int j=0;j<n+n;++j)
			if(!vs[i][j])
			{
				vs[i][j]=1,q.push((node){i,j});
				while(!q.empty())
				{
					int x=q.front().x,y=q.front().y;
					q.pop();
					for(int k=1;k<=tp;++k)
						for(int dx=-1;dx<=1;dx+=2)
							for(int dy=-1;dy<=1;dy+=2)
							{
								int xx=x+dx*st[k][0],yy=y+dy*st[k][1];
								if(xx>=0&&xx<n+n&&yy>=0&&yy<n+n&&!vs[xx][yy])
									co[xx][yy]=co[x][y]^1,vs[xx][yy]=1,q.push((node){xx,yy});
							}
				}
			}
}

int main()
{
	n=rd(),l1=rd(),l2=rd();
	wk(l1,0);
	memcpy(c2,co,sizeof(co)),memset(co,0,sizeof(co));
	wk(l2,1);
	for(int i=0;i<n+n;++i)
		for(int j=0;j<n+n;++j)
			ls[co[i][j]<<1|c2[i][j]].push_back((node){i,j});
	int zs=0;
	for(int i=1;i<=3;++i)
		if(ls[zs].size()<ls[i].size()) zs=i;
	for(int i=0;i<n*n;++i) printf("%d %d\n",ls[zs][i].x,ls[zs][i].y);
	return 0;
}


Measured memory_bytes: 8040
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long

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

	int N, M;
	vector<int> X;
	vector<int> dis;
	cin >> N >> M;
	for (int i = 0; i < M; i++)
	{
		int tmp;
		cin >> tmp;
		X.push_back(tmp);
	}

	sort(X.begin(), X.end());
	
	//Nが大きいとき
	if (N >= M) {
		cout << 0 << endl;
		return 0;
	}

	for (int i = 1; i < M; i++)
	{
		dis.push_back(X[i] - X[i - 1]);
	}

	int sum = 0;

	for (int i = 0; i < M-1; i++)
	{
		sum += dis[i];
	}

	sort(dis.begin(), dis.end(), greater<int>());
	int c = 0;
	for (int i = 0; i < N-1; i++)
	{
		c += dis[i];
	}

	cout << sum - c << endl;

	return 0;
}


Measured memory_bytes: 2548
def main():
    a_n, b_n, m = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    ans = 10**8
    for _ in range(m):
        x, y, c = map(int, input().split())
        x -= 1
        y -= 1
        buf = a[x] + b[y] - c
        if buf < ans:
            ans = buf
    a.sort()
    b.sort()
    if a[0] + b[0] < ans:
        ans = a[0] + b[0]
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 18648
from math import cos, sin, pi

treasure_x, treasure_y = 0, 0
angle = pi / 2

while True:
    d, a = map(int, input().split(','))

    if d == 0 and a == 0:
        break

    treasure_x += d * cos(angle)
    treasure_y += d * sin(angle)

    angle -= a * pi / 180

print(int(treasure_x))
print(int(treasure_y))

Measured memory_bytes: 5716
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int h,w,n; cin>>h>>w>>n;
	int ret=INT_MAX;
	for (int x=0; x<=h; x++)
		for (int y=0; y<=w; y++)
			if (h*w-(h-x)*(w-y)>=n)
				ret=min(ret,x+y);
	cout<<ret<<endl;
	return 0;
}


Measured memory_bytes: 256
'use strict';
    (function(stdin) {
      //declare function

      //declare variable
      var inputs = stdin.toString().trim().split(' ');
      var a = parseInt(inputs[0]);
      var b = parseInt(inputs[1]);
      var result = '';
      //main
      if (a < b) {
        result = 'a < b';
      } else if (a > b) {
        result = 'a > b';
      } else if (a === b) {
        result = 'a == b';
      }
      //display
      console.log(result);
    })(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 15520
n = int(input())
h = list(map(int,input().split()))
maxc=0
rec=n-1
for i in range(n-1,0,-1):
    if(i >rec):
        continue
        
    j = i
    cnt =0
    while((h[j]<=h[j-1])):
        if(j ==0):
            break
        cnt +=1
        j -=1
    rec= j
    if maxc < cnt:
        maxc = cnt
print(maxc)


Measured memory_bytes: 14224
import java.awt.Point;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		Set<Point> juels = new HashSet<Point>();
		Point robot = new Point();
		while (n != 0) {
			juels.clear();
			robot.setLocation(10, 10);
			for (int i = 0; i < n; i++) {
				juels.add(new Point(in.nextInt(), in.nextInt()));
			}
			int m = in.nextInt();
			for (int i = 0; i < m; i++) {
				String v = in.next();
				int size = in.nextInt();
				if (!juels.isEmpty()) {
					for (int j = 0; j < size; j++) {
						if ("N".equals(v)) {
							robot.y++;
						} else if ("S".equals(v)) {
							robot.y--;
						} else if ("E".equals(v)) {
							robot.x++;
						} else if ("W".equals(v)) {
							robot.x--;
						}
						juels.remove(robot);
					}
				}
			}
			if (juels.isEmpty()) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
			n = in.nextInt();
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}

vector<ll> enum_div(ll n){//nの約数を列挙
    vector<ll> res;
    for (ll i = 1LL; i*i <= n; ++i) {
        if (n % i == 0) {
            res.push_back(i);
            ll j = n / i;
            if (j != i) res.push_back(j);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

int main(){
  ll n; cin >> n;
  
  vector<ll> div = enum_div(n);
  
  if(div.size()%2){
    ll a = div[div.size()/2];
    cout << a*2-2 << endl;
  }else{
    ll a = div[div.size()/2-1];
    ll b = div[div.size()/2];
    cout << a+b-2 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 384