akhauriyash/Code-Regression huggingface dataset:
// https://atcoder.jp/contests/agc003/tasks/agc003_b

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N;
  cin >> N;

  VL as(N);
  rep(i, N) cin >> as[i];

  ll res = 0;

  rep(i, N) {
    res += as[i] / 2;

    if (i + 1 < N && as[i] % 2 && as[i + 1]) {
      res += 1;
      as[i + 1]--;
    }
  }

  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 1024
import java.math.BigDecimal;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	/** 円の通貨の文字列 */
	private static final String JPY = "JPY";
	/** BTCからJPYへ変換するレート */
	private static final BigDecimal RATE = BigDecimal.valueOf(380000L);

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			System.out.println(IntStream.range(0, n).mapToObj(i -> {
				String x = scanner.next(), u = scanner.next();
				return (JPY.equals(u)) ? new BigDecimal(x) : (new BigDecimal(x)).multiply(RATE);
			}).reduce(BigDecimal.ZERO, BigDecimal::add));
		}
	}
}


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

using namespace std;

int main(){
    
    string str;
    
    cin >> str;
    
    int Bsp = 0;
    
    for(int i=0 ; i<str.length(); i++){
      
      if(str[i] == 'B'){
          str[i] = '*';
          
          for(int j=i; j>=0; j--){
              if(str[j] != '*'){
                  str[j] = '*';
                  break;
              }
          }
          
      }
    }
    
    for(int i=0; i<str.length(); i++){
     if(str[i] != '*')
         cout << str[i];
    }
     cout << endl;
    
    return 0;
}

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

using namespace std;

int N, M;

vector<pair<int, int> > Divide(vector<pair<int, int> > all, pair<int, int> part)
{
    vector<pair<int, int> > div;
    int l = 0, r = 0;
    for (int i = 0; i < all.size(); i++)
    {
        l = r;
        r += all[i].second - all[i].first;
        if (part.second <= l || r <= part.first) continue;
        int dl = all[i].first + max(l, part.first) - l;
        int dr = all[i].first + min(r, part.second) - l;
        div.push_back(make_pair(dl, dr));
    }
    return div;
}

int main()
{
    while (cin >> N, N)
    {
        int P, Q, R;
        cin >> M >> P >> Q >> R;
        P--;
        Q--;
        int x[5000], y[5000];
        vector<pair<int, int> > latte;
        latte.push_back(make_pair(0, N));
        for (int i = 0; i < M; i++)
        {
            cin >> x[i] >> y[i];
            x[i]--;
            y[i]--;
            vector<pair<int, int> > A = Divide(latte, make_pair(0, x[i] + 1));
            vector<pair<int, int> > B = Divide(latte, make_pair(x[i] + 1, y[i] + 1));
            vector<pair<int, int> > C = Divide(latte, make_pair(y[i] + 1, N));
            latte = C;
            latte.insert(latte.end(), B.begin(), B.end());
            latte.insert(latte.end(), A.begin(), A.end());
        }
        vector<pair<int, int> > last = Divide(latte, make_pair(P, Q + 1));
        int ans = 0;
        for (int i = 0; i < last.size(); i++)
        {
            ans += max(0, min(R, last[i].second) - last[i].first);
        }
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 1492
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(x)    (x).begin(),(x).end()
typedef long long ll;
const int MOD = (int)1e9 + 7;

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<string> h;
  h.push_back(s);
  char buf = s[s.size()-1];
  bool flag = true;
  rep(i,n-1){
    cin >> s;
    if(buf != s[0]) flag = false;
    for(t:h) if(t == s) flag = false;
    buf = s[s.size()-1];
    h.push_back(s);
  }
  cout << (flag ? "Yes" : "No") << endl;
}



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

#define mem(f, v) memset(f,v,sizeof(f))
#define file(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);

typedef long long ll;
const int maxn = 100010;
const int inf = ~(1u << 31u);
const ll linf = (~(1llu << 63u)) >> 2;

using namespace std;

ll f[2][100010];

int main() {
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    for(int j = 1; j <= 100000; j ++) f[0][j] = linf;
    f[0][0] = 0;
    int p = 1, res = 0;
    for(int i = 1; i <= n; i ++, p ^= 1){
        for(int j = 1; j <= 100000; j ++) f[p][j] = linf;
        ll w, v;
        cin >> w >> v;
        for(int j = 100000; j >= 0; j --){
            f[p][j] = f[p^1][j];
            if(j - v >= 0) f[p][j] = min(f[p][j], f[p^1][j - v] + w);
            if(f[p][j] <= m) res = max(res, j);
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1920
#include <stdio.h>

int judge(char s3, char s4, char s5, char s6);

int main(){
    char S[6];

    scanf("%s", S);

    if( judge(S[2], S[3], S[4], S[5]) )
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}

int judge(char s3, char s4, char s5, char s6){
    if(s3==s4 && s5==s6)
        return 1;
    else
        return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node{
  int key;
  Node *next, *prev;
};

Node *nil;

Node* listSearch(int key){
  Node *cur = nil->next;
  while(cur != nil && cur->key != key){
    cur = cur->next;
  }
  return cur;
}

void init(){
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  Node *cur = nil->next;
  int isf = 0;
  while(1){
    if(cur == nil) break;
    if(isf++ > 0) printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
  }
  printf("\n");
}

void deleteNode(Node *t){
  if(t == nil) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(){
  deleteNode(nil->next);
}

void deleteLast(){
  deleteNode(nil->prev);
}

void deleteKey(int key){
  deleteNode(listSearch(key));
}

void insert(int key){
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;

  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for(i=0; i<n; i++){
    scanf("%s%d", com, &key);
    if(com[0] == 'i'){
      insert(key);
      np++;
      size++;
    }
    else if(com[0] == 'd'){
      if(strlen(com) > 6){
        if(com[6] == 'F') deleteFirst();
        else if(com[6] == 'L') deleteLast();
      }else{
        deleteKey(key); nd++;
      }
      size--;
    }
  }
  
  printList();

  return 0;
}


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

int main() {
    int a;
    string s;
    std::cin >> a >> s;
    if(a<3200){
        std::cout << "red" <<std::endl;
    }
    else{
        std::cout << s << std::endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;

struct BIT {
  vector<ll> data;
  int N;

  BIT(int n) {
    N = n;
    data = vector<ll>(N+1);
  }

  void add(int i, ll x) {
    for (int k = i; k <= N; k += k&-k) data[k] += x;
  }

  void update(int i, ll x) {
    add(i, x-get(i));
  }

  ll sum(int i) {
    ll res = 0;
    for (int k = i; k > 0; k -= k&-k) res += data[k];
    return res;
  }

  ll get(int i) {
    return sum(i) - sum(i-1);
  }
};

struct miyage {
  int l, r, len;
};
bool comp (miyage x, miyage y) {
  return x.len < y.len;
}

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

const int MAX = 3e5+10;

int N, M;
miyage a[MAX];

int main() {

  cin >> N >> M;
  REP (i, N) {
    cin >> a[i].l >> a[i].r;
    a[i].len = a[i].r-a[i].l+1;
  }
  sort(a, a+N, comp);
  BIT bit(MAX);

  int j = 0;
  for (int i = 1; i <= M; i++) {
    while (j < N && a[j].len < i) {
      bit.add(a[j].l, 1);
      bit.add(a[j].r+1, -1);
      j++;
    }
    int ans = 0;
    for (int k = 0; k <= M; k += i) ans += bit.sum(k);
    cout << ans +N-j << endl; 
  }

}

Measured memory_bytes: 6784
# ABC 143 D - Triangles
# https://atcoder.jp/contests/abc143/tasks/abc143_d

n = gets.chomp.to_i
l = gets.chomp.split(/ /).map(&:to_i).sort.reverse

# puts sticks.inspect
# puts ""

count = 0
0.upto(n - 3) do |i|
  a = l[i]
  (i + 1).upto(n - 2) do |j|
    b = l[j]
    c_candidates = l[(j + 1)..(n - 1)]
    t = a - b
    # puts "--------"
    # puts c_candidates.inspect
    # puts "a: #{a}, b: #{b}, a - b: #{t}"
    c_over_index = c_candidates.bsearch_index { |c| c <= t }
    if c_over_index.nil?
      count += (n - 1) - j
    else
      count += c_over_index
    end
  end
end

puts count


Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int i,n,m;
  int sum = 0;

  cin >> n;
  cin >> m;
  vector<int> s(m);
  for (i = 0; i < m; i++) {
    cin >> s.at(i);
    sum = sum + s.at(i);
  }

  if( n - sum < 0) {
    cout << "-1" << endl;
  } else {
    cout << (n - sum) << endl;
  }

}


Measured memory_bytes: 3624
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N, L = ISI()
a = ""
s = sorted([IS() for _ in range(N)])
for i in range(N):
    a += "".join(s[i])
print(a)

Measured memory_bytes: 3316
import sys
alp = "abcdefghijklmnopqrstuvwxyz0123456789"
dic = {}

for i in range(36):
    dic[alp[i]] = i


P = input()
T = input()

if len(P) < len(T):
    sys.exit()

Thash1 = 0
Thash2 = 0
mod1 = 10**9+7
mod2 = 10**9+9

suc1 = pow(36,len(T),mod1)
suc2 = pow(36,len(T),mod2)


for i in T:

    Thash1 *= 36
    Thash2 *= 36

    Thash1 += dic[i]
    Thash2 += dic[i]
    Thash1 %= mod1
    Thash2 %= mod2

Phash1 = 0
Phash2 = 0

for i in range(len(T)):

    Phash1 *= 36
    Phash2 *= 36

    Phash1 += dic[P[i]]
    Phash2 += dic[P[i]]
    Phash1 %= mod1
    Phash2 %= mod2

for i in range(len(P)-len(T)+1):

    if Thash1 == Phash1 and Thash2 == Phash2:
        print (i)

    if i != len(P)-len(T):
        Phash1 *= 36
        Phash2 *= 36

        Phash1 -= suc1 * dic[P[i]]
        Phash2 -= suc2 * dic[P[i]]

        Phash1 += dic[P[i+len(T)]]
        Phash2 += dic[P[i+len(T)]]
        Phash1 %= mod1
        Phash2 %= mod2


Measured memory_bytes: 8372
#include <iostream>

using namespace std;

int main() {
	int n, m, x, sum = 0;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> x;
		sum += x;
	}
	n -= sum;
	cout << ((n < 0) ? -1 : n);
}

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

int main() {
  int N,M,X,Y; cin >> N >> M >> X >> Y;
  int x[202],y[202];
  for ( int i = 0; i < N; i ++ ) cin >> x[i];
  for ( int i = 0; i < M; i ++ ) cin >> y[i];
  sort(x,x+N);
  sort(y,y+M);
  bool f = false;
  for ( int i = X+1; i <= Y; i++ ) {
    if ( i > x[N-1] && i <= y[0] ) f = true;
  }
  if(f) cout << "No War" << endl;
  else cout << "War" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LL long long
#define M 200020
using namespace std;
namespace IO{
	const int BS=(1<<20)+5; int Top=0;
	char Buffer[BS],OT[BS],*OS=OT,*HD,*TL,SS[20]; const char *fin=OT+BS-1;
	char Getchar(){if(HD==TL){TL=(HD=Buffer)+fread(Buffer,1,BS,stdin);} return (HD==TL)?EOF:*HD++;}
	void flush(){fwrite(OT,1,OS-OT,stdout);}
	void Putchar(char c){*OS++ =c;if(OS==fin)flush(),OS=OT;}
	void write(int x){
		if(!x){Putchar('0');return;} if(x<0) x=-x,Putchar('-');
		while(x) SS[++Top]=x%10,x/=10;
		while(Top) Putchar(SS[Top]+'0'),--Top;
	}
	int read(){
		int nm=0,fh=1; char cw=Getchar();
		for(;!isdigit(cw);cw=Getchar()) if(cw=='-') fh=-fh;
		for(;isdigit(cw);cw=Getchar()) nm=nm*10+(cw-'0');
		return nm*fh;
	}
}
using namespace IO;
const double D=11.4159265358979323846264338328;
const double K=-4.2920367320510338076867830836;
int n,m,maxy,sx,sy,ex,ey,tot,c[M],pos[M],now; double ans;
struct pot{
	int X,Y; void gtin(){X=read(),Y=read(),maxy=max(maxy,Y+1);}
	bool ft(){return X>=sx&&X<=ex&&Y>=sy&&Y<=ey;}
	bool operator <(const pot&ot)const{return X<ot.X;}
}p[M],t[M];
int main(){
	sx=read(),sy=read(),ex=read(),ey=read(),maxy=max(sy,ey);
	if(sx>ex) swap(sx,ex),swap(sy,ey); n=read();
	for(int i=1;i<=n;i++) p[i].gtin();
	if(sy>ey){
		for(int i=1;i<=n;i++) p[i].Y=maxy-p[i].Y;
		sy=maxy-sy,ey=maxy-ey;
	} sort(p+1,p+n+1),ans=(ey+ex-sy-sx)*100.0;
	for(int i=1;i<=n;i++) if(p[i].ft()) t[++tot]=p[i];
	memset(c,0x3f,sizeof(c)),c[0]=now=0;
	for(int i=1;i<=tot;i++){
		int l=1,r=now,md,res=0;
		while(l<=r){md=((r+l)>>1);if(c[md]<t[i].Y) res=md,l=md+1;else r=md-1;}
		if(res==now) now++; c[res+1]=min(c[res+1],t[i].Y);
	}
	if(now<=ex-sx&&now<=ey-sy) ans+=now*K;
	else ans+=(now-1)*K+D; printf("%.13lf\n",ans);
	return 0;
}

Measured memory_bytes: 7040
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  ll x, y;
  while (cin >> x >> y) {
    vector<ll> cand;
    // x -> y
    if (x <= y) {
      cand.push_back(y - x);
    }
    // x -> -x -> y
    if (-x <= y) {
      cand.push_back(1 + y - (-x));
    }
    // x -> -y -> y
    if (x <= -y) {
      cand.push_back(1 + (-y) - x);
    }
    // x -> -x -> -y -> y
    if (-x <= -y) {
      cand.push_back(2 + (-y) - (-x));
    }
    cout << *min_element(cand.begin(), cand.end()) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import heapq
N = int(input())
A = [[int(a),1] for a in input().split()]

heapq.heapify(A)
cur1 = heapq.heappop(A)

while A:
  cur2 = heapq.heappop(A)
  if cur2[0] <= cur1[0]*2:
    heapq.heappush(A,[cur1[0]+cur2[0],cur1[1]+cur2[1]])
  else:
    heapq.heappush(A,[cur1[0]+cur2[0],cur2[1]])
  cur1 = heapq.heappop(A)
print(cur1[1])
  
  

Measured memory_bytes: 95732
//author rhythmicankur
                                                                  //god_is_almighty
#pragma GCC optimize("O3")
#pragma GCC target ("sse4")
#include<bits/stdc++.h>
#define f 		first
#define s 		second
#define int     long long
#define ll      int
#define ld 		long double
#define pb 		push_back
#define eb 		emplace_back
#define mk 		make_pair
#define vi 		vector<int>
#define pii 		pair<int,int>
#define pip             pair<int,pii>
#define vpi 		vector<pii>
#define sbcount(x) __builtin_popcountll(x)
#define REP(i,n) for (int i = 1; i <= n; i++)
#define trav(a, x)      for(auto& a : x)
#define all(x)          x.begin(), x.end()
#define fill(a,val)	memset(a,val,sizeof(a))
#define 	PI acos(-1)
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define M1 	998244353
#define M2 	1000000007
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); } 
#define test4(x,y,z,a) 		    cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<"  |  "<<#a<<": "<<a<<endl;
#define test1(x)                cerr<<#x<<": "<<x<<endl
#define test2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define test3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
ll power(ll a,ll b,ll m=M2){ll answer=1;while(b){if(b&1)answer=(answer*a)%m;b/=2;a=(a*a)%m;}return answer;}
using namespace std;
void ctrl(){cout<<"Control"<<endl;}
int make_num(string p){stringstream geek(p); int x = 0; geek >> x;return x;}
string make_str(int x){ostringstream str1; str1 << x; string geek = str1.str(); return geek;}

signed main()
{	ios::sync_with_stdio(0);
	cin.tie(0); 
	cin.exceptions(cin.failbit);
	int n;
    cin>>n;
    int A[n];
    
    int xr=0;
    for(int i=0;i<n;i++)
    {
        cin>>A[i];
        xr=xr^A[i];
    }
    for(int i=0;i<n;i++)
    {
        cout<<(xr^A[i])<<" ";
    }
    

return 0;
}

Measured memory_bytes: 5204
#include<stdio.h>

#define MAX 100

int main(){
  int i,j,n,M[MAX][MAX],l,u,k;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d",&u);
    scanf("%d",&k);
    for(j=0;j<k;j++){
      scanf("%d",&l);
      M[u-1][l-1]=1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      printf("%d",M[i][j]);
      if(j<n-1)printf(" ");
    }
    printf("\n");
  }
  return 0;
}

      
    



Measured memory_bytes: 2748
#include<iostream>

using namespace std;

int main(){
    const int MAX=50;
    int N,M;
    int A[MAX],B[MAX],road[MAX];
    cin>>N>>M;
    for(int i=0;i<M;++i)cin>>A[i]>>B[i];
    for(int i=0;i<N;++i)road[i]=0;
    
        for(int i=0;i<M;++i){
            road[A[i]-1]+=1;
            road[B[i]-1]+=1;
        }
        
            for(int i=0;i<N;++i){
                cout<<road[i]<<"\n"s;
            }
    
}

Measured memory_bytes: 3176
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using LayoutKind = System.Runtime.InteropServices.LayoutKind;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;


static class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(long.Parse).ToArray();

        var max = a.Sum();
        for (long opCount = Max(0, a.Sum(x => x - (n - 1))); opCount <= max; opCount++)
        {
            if(a.Sum(x => (x + opCount) / (n + 1) + ((x + opCount) % (n + 1) == n ? 1 : 0)) == opCount)
            {
                Console.WriteLine(opCount);
                return;
            }
        }
    }
}


Measured memory_bytes: 13396
H, W, N = gets.split.map(&:to_i)
ABs = readlines.map{|l| l.split.map(&:to_i)}

r = [*0 .. 2].product([*0 .. 2])
cnt = Hash.new(0)
ABs.each do |a0, b0|
  r.each do |da, db|
    a, b = a0 - da, b0 - db
    next unless 1 <= a && a <= H - 2 && 1 <= b && b <= W - 2
    cnt[[a, b]] += 1
  end
end
ans = cnt.values.group_by(&:itself).map{|k, v| [k, v.size]}.to_h
ans[0] = (H - 2)*(W - 2) - ans.values.compact.inject(0, :+)
(0 .. 9).each{|n| puts ans[n] || 0}

Measured memory_bytes: 121820
char buf[1<<20];sz;
main()
{
	read(0,buf,1<<20);
	int N=0;
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		N=N*10+k-'0';
	}
	int s=0,f=0;
	for(int i=0;i<N;i++)
	{
		if(!(-N&i))s+=buf[sz]-'1';
		f|=buf[sz]=='2';
		sz++;
	}
	printf("%d\n",s&3>>f);
}


Measured memory_bytes: 1152
/*
 *  * main.cpp
 *   *
 *    */

#include<iostream>
#include<fstream>
#include<algorithm>
#include<stdio.h>
#include<vector>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<cstring>
#include<string>
#include<cassert>
#include<stdlib.h>
#include<time.h>
using namespace std;

int res[100003];
bool visit[100005];
bool cmp(pair<int, vector<int>> a, pair<int, vector<int>> b) {
    return a.second.size() > b.second.size();
}
int main() {

    map<pair<int, int>, int> edgeNo;

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

    vector<vector<int>> edge(N + 1, vector<int>());

    for (int i = 0; i < N - 1; ++i) {
        int a, b;
        scanf("%d %d", &a, &b);
        edge[a].push_back(b);
        edge[b].push_back(a);
        edgeNo[{a, b}] = i + 1;
        edgeNo[{b, a}] = i + 1;
    }
    vector<pair<int, vector<int>>> ed;
    for (int i = 1; i < N + 1; ++i) ed.push_back({i, edge[i]});

    sort(ed.begin(), ed.end(), cmp);
    int K = ed[0].second.size();

    queue<pair<int, int>> q; // first is node, second is color;
    q.push({ed[0].first, 0});

    while (!q.empty()) {

        int curNode = q.front().first;
        int curColor = q.front().second;
        visit[curNode] = true;
        q.pop();
        int color[K + 1];
        for (int i = 0; i < K + 1; ++i) color[i] = 0;
        color[curColor] = 1;

        for (int i = 0; i < edge[curNode].size(); ++i) {
            int toNode = edge[curNode][i];
            if (visit[toNode]) continue;
            int toColor = 0;

            for (int i = 1; i < K + 1; ++i) 
                if (color[i] != 1) {
                    color[i] = 1;
                    toColor = i;
                    break;
                }
            res[edgeNo[{curNode, toNode}]] = toColor;

            q.push({toNode, toColor});



        }
    }

    printf("%d\n", K);
    for (int i = 1; i < N; ++i) printf("%d\n", res[i]);
    return 0;
}


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

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

    int n_A = 0;
    int n_B = 0;
    for(int i=0; i<3; ++i) {
        if (s[i] == 'A') n_A++;
        else if (s[i] == 'B') n_B++;
    }

    if(n_A == 3 || n_B == 3) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import sys
from datetime import *
from time import *

day = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ]

while True:
    try:
        user_input_date = '2004/'+'/'.join(raw_input().split())
        if user_input_date == '2004/0/0':
            break
        else:
            a = datetime.strptime(user_input_date,'%Y/%m/%d')
            print day[a.weekday()]
    except ValueError:
        pass
else:
    sys.exit(1)

Measured memory_bytes: 6996
#include<stdio.h>
int main(void)
{
    int w,h,x,y,r,f;
    scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
    f=0;
    if(x+r>w)f=1;
    if(y+r>h)f=1;
    if(r>x)f=1;
    if(r>y)f=1;
    if(f==0)
    printf("Yes\n");
    else 
    printf("No\n");
    return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#endif


typedef long long ll; 
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
 
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

void solve() {
  int k, n;
  cin >> k >> n;
  vector<int> a(n + 1);
  for (int i = 0 ; i < n ; i++) {
    cin >> a[i];
  }
  a[n] = k + a[0];
  vector<int> d(n);
  ll sum = 0;
  for (int i = 0 ; i < n ; i++) {
    d[i] = a[i + 1] - a[i];
    sum += (ll)d[i];
  }
  sort(all(d));
  cout << sum - d[n - 1];
}
 
int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
  int t = 1;
  // cin >> t;
  while (t--) {
    solve();
  }
 
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  for (int i =0; i < N; i++){
    string S;
    cin >> S;
    if (S == "Y"){
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
  return 0;
}
  

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

using namespace std;

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

	int digit = 1;
	double _tmp = N;
	while (_tmp / 10 >= 1)
	{
		digit += 1;
		_tmp = _tmp / 10;
	}

	int res = 0;
	for (int i = 1; i < digit; i += 2)
	{
		res += 9 * pow(10, i - 1);
	}

	if (digit == 1)
	{
		res = N;
	}
	else if (digit % 2 != 0)
	{
		res += (N - pow(10, digit-1) + 1);
	}

	cout << res << endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
double esp=1e-8;
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define cle(a) while(!a.empty())a.pop()
#define mem(p,c) memset(p,c,sizeof(p))
#define mp(A, B) make_pair(A, B)
#define pb push_back
typedef long long int LL;
const long double PI = acos((long double)-1);
const LL INF=0x3f3f3f3fll;
const int MOD =1e9+7ll;
const int maxn=2100;

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("pentagon.in", "r", stdin);
    //freopen("out.txt", "w", stdout);
    int n;
    scanf("%d",&n);
    int a=0,b=0,c=0;
    for(int x=1;x<=n;x++)
    {
        int t;
        scanf("%d",&t);
        if(t%4==0)a++;
        else if(t%4==2)b++;
        else c++;
    }
    if(b)c++;
    if(a==0&&c==1)
    {
        if(b==1)puts("No");
        else if(b>1)puts("Yes");
        else puts("No");
        return 0;
    }
    if(a>=c-1)puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 256
import sys

def I(): return(int(sys.stdin.readline()))
def LI(): return(list(map(int,sys.stdin.readline().split())))

def main():
    N = I()
    V = sorted(LI())
    
    ans = V[0]
    for i in range(1,N):
        ans = (ans+V[i])/2
    return(ans)
    
      
    
if __name__ == "__main__":
    print(main())


Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 29;
 
int main() {
	string s;
	cin >> s;
	set<char> moko;
	rep(i, s.size()) moko.insert(s[i]);
	if (moko.size() == s.size()) cout << "yes" << endl;
	else cout << "no" << endl;
	return 0;
}

Measured memory_bytes: 256
n,m,v,p=map(int,input().split())
a=sorted(list(map(int, input().split())),reverse=True)[p-1:]
l,r=0,n-p
while l+1<r:
    k=(l+r)//2
    b=a[k]+m
    if b<a[0] or (v-(n-k))*m>(k*b-sum(a[:k])): r=k
    else: l=k
b=a[r]+m
print(p+l if(b<a[0] or (v-(n-r))*m>(r*b-sum(a[:r]))) else p+r)


Measured memory_bytes: 14964
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
using Graph = vector<vector<int>>;
int main() {
  int x;
  cin >> x;
  if (x) cout << "0" << endl;
  else cout << "1" << endl;
  return 0;
}

Measured memory_bytes: 3564
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <complex>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    int a[103];
    int sum = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        sum += a[i];
    }
    sort(a, a + n);

    int item = a[n - m];
    if (item * 4 * m >= sum) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }

}


Measured memory_bytes: 888
#include <bits/stdc++.h>
 
using namespace std;
 
#define MD 1000000007
typedef long long int ll;

ll mul(ll a,ll b){
    return ((a%MD)*(b%MD)) % MD;
}

int main(){
    ll n,m,ans=0;
    cin>>n>>m;
    if(n*2<=m){
        ans=n;
        m-=(n*2);
        ans+=(m/4);
    }else{
        ans=m/2;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
using namespace std ;
int main () {
double c=0;
int x,y=1;
cin>>x;
for(int i=0;i<=x;i++)
{
    y++;
    if (y%2!=0)
        c++;
}
cout << fixed << showpoint;
cout<<setprecision(9)<<c/x<<endl;
return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<queue>
#define maxn 1002
#define maxc 10
using namespace std;
struct point{
    int r,c;
};
char graph[maxn][maxn];
int len[maxn][maxn];
bool mark[maxn][maxn];
point node[maxc];
int dir[4][2]={1,0,-1,0,0,1,0,-1};
int main(void){
    int h,w,cheese,tr,tc,answer=0;
    scanf("%d%d%d",&h,&w,&cheese);
    memset(graph,0,sizeof(graph));
    memset(node,0,sizeof(node));
    for(int i=1;i<=h;i++) for(int j=1;j<=w;j++){
        do scanf("%c",&graph[i][j]);
        while(graph[i][j]==' ' || graph[i][j]=='\n');
        if(graph[i][j]>='0' && graph[i][j]<='9'){
            node[graph[i][j]-'0'].r=i;
            node[graph[i][j]-'0'].c=j;
        }
        else if(graph[i][j]=='S'){
            node[0].r=i;
            node[0].c=j;
        }
    }
    for(int cnt=0;cnt<cheese;cnt++){
        memset(len,0,sizeof(len));
        memset(mark,false,sizeof(mark));
        for(int i=0;i<=h+1;i++){mark[i][0]=true;mark[i][w+1]=true;}
        for(int j=0;j<=w+1;j++){mark[0][j]=true;mark[h+1][j]=true;}
        queue<point> q;
        q.push(node[cnt]);
        len[node[cnt].r][node[cnt].c]=0;
        point ongo,togo;
        while(!q.empty()){
            ongo=q.front();
            q.pop();
            if(mark[ongo.r][ongo.c]) continue;
            mark[ongo.r][ongo.c]=true;
            if(ongo.r==node[cnt+1].r && ongo.c==node[cnt+1].c){
                answer+=len[ongo.r][ongo.c];
                break;
            }
            for(int i=0;i<4;i++){
                togo.r=ongo.r+dir[i][0];togo.c=ongo.c+dir[i][1];
                if(mark[togo.r][togo.c]==false && graph[togo.r][togo.c]!='X'){
                    len[togo.r][togo.c]=len[ongo.r][ongo.c]+1;
                    q.push(togo);
                }
            }
        }
    }
    printf("%d\n",answer);
    return 0;
}


Measured memory_bytes: 8624
/*  ex3_4
    Graku   */
#include <stdio.h>
#include <math.h>

int main(void) {
    int num; //declaration
    scanf("%d", &num);

    int flag = 0; //if exist i, j in {x in N | 1 <= x <= 9} s.t. n == i * j, flag == 1, else flag == 0
    for (int i = 1; i <= 9; ++i) { //1 <= i <= 9
        if (flag) { //if already find (i, j) s.t. (i, j) s.t. n == i * j, break
            break;
        }
        for (int j = i; j <= 9; ++j) { //i <= j <= 9, dont have to check (i, j) s.t. i > j
            if (num == i * j) { //if find (i, j) s.t. n == i * j, flag = 1
                flag = 1;
                break;
            }
        }
    }

    if (flag) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }

    return 0;
}


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

int main() {
  int a, b, c; cin >> a >> b >> c;
  int ans;
  if (a==b){
    if (b==c) ans = 1;
    else ans = 2;
  }
  else{
    if (b==c || a==c) ans = 2;
    else ans = 3;
  }
  cout <<ans <<endl;
}


Measured memory_bytes: 256
//2020年4月17日現在

#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include<iomanip>
#include<limits>
#include<thread>
#include<map>
#include<stack>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<tuple>
#include <cstdio>
#include <iterator>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }

namespace {
    // printElems(&a[0], &a[n]);　みたいな感じで使う。
    void printElems(const int* begin, const int* end)
    {
        for (const int* p = begin; p != end; ++p) {
            std::cout << *p << ' ';
        }
        std::cout << std::endl;
    }
}

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define repr1(i,n) for(int i=n; i>0; i--)
#define FOR(i,j,n) for(int i=j; i < n; i++)
#define souatari(i,j,n) rep1(i,n-1)rep(j,i)
#define souatari1(i,j,n) for(int i=2; i<n+1; i++)rep1(j,i-1)
#define mp make_pair
#define F first
#define S second
#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef array<int,3> arr3;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const ll _llinf = numeric_limits<ll>::lowest();
const int inf = numeric_limits<int>::max();
const int _inf = numeric_limits<int>::lowest();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;
const ll BIG = 10000000000000000;




int a[200005];


int main(){
    int n;
    cin >> n;
    rep(i,n)cin >> a[i];
    map<int,int> m;
    ll ans = 0;
    rep(i,n){
        if(m.find(a[i]-i) != m.end()){
            ans+=m.at(a[i]-i);
        }
        if(m.find(-(a[i]+i)) != m.end()){
            m[-(a[i]+i)]++;
        }
        else{
            m.insert(mp(-(a[i]+i),1));
        }
    }
    prints(ans);



	return 0;
}



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

int main(){
    int N;
    int sum=0;
    int remainder = 0;
    cin >> N;
    int n = N;
    
    while(n > 0){
        remainder = n % 10;
        sum += remainder;
        n /= 10;
    }

    if (N % sum == 0){
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}

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

int main(){
    int K,X;
    cin >> K >> X;
    int total;
  
        total = X - K + 1;
    for(int i = 0;i<K*2-1;i++){
        
        
        cout << total++;
      	cout << " ";

    }

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        for (int i = 0; i < s.length - 1; i++) {
            if(s[i] == s[i + 1]) {
                System.out.println("Bad");
                return;
            }
        }
        System.out.println("Good");
    }
}

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

int main(){
    int N, W;
    cin >> N >> W;
    vector<vector<long long>> dp(N + 1, vector<long long>(W + 1, 0));
    vector<int> w(N + 1);
    vector<int> v(N + 1);
    w[0] = 0;
    v[0] = 0;
    for(int i = 1;i < N + 1;++i){
        cin >> w[i] >> v[i];
    }
    for(int i = 1;i < N + 1;++i){
        for(int j = 1;j < W + 1;++j){
            if(j - w[i] < 0){
                dp[i][j] = dp[i - 1][j];
            }else{
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i]);
            }
        }
    }
    cout << dp[N][W] << endl;
    return 0;
}

Measured memory_bytes: 80256
class UnionFind
  def initialize(n); @data = Array.new(n, -1); end
  def find(a); @data[a] < 0 ? a : @data[a] = find(@data[a]); end
  def same?(a, b); find(a) == find(b); end
  def size(a); -@data[find(a)]; end

  def unite(a, b)
    a = find(a); b = find(b)
    return if a == b
    a, b = b, a if @data[a] > @data[b]
    @data[a] += @data[b]; @data[b] = a
  end
end

# UnionFind.new(N) := 要素数Nで初期化
# Ai := i番目の要素
# find(i) := Aiが属するグループ
# same?(i,j) := Ai,Ajが同じグループに属する
# size(i) := Aiが属するグループの要素の数
# unite(i,j) := Ai,Ajを同じグループに統合する

# uf = UnionFind.new(10)
# pp uf.same(1, 2)

class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @n,@m = gets.split.map(&:to_i)
    @a,@b = Array.new(m){ gets.split.map(&:to_i).map{_1-1} }.transpose
    @u = UnionFind.new(n)
  end

  def init
    m.times do |i|
      u.unite(a[i],b[i])
    end
  end

  def solve
    init
    ans = 0
    n.times do |i|
      cnt = u.size(i)
      ans = cnt if ans < cnt
    end
    ans
  end

  def show(ans)
    puts ans
  end
end

Problem.new.instance_eval do
  show(solve)
end



Measured memory_bytes: 32912
X, N=map(int, input().split())
if N==0:print(X);exit()
p=sorted(list(map(int, input().split())))

m=X;i=0
for i in range(m,min(p)-2,-1):
  if i not in p:break
M=X;j=0
for j in range(M,max(p)+2):
  if j not in p:break
if abs(i-X)==abs(j-X):print(min(i,j))
elif abs(i-X)<abs(j-X):
  print(i)
else:print(j)

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

namespace AtCoder
{
    class ABC043
    {
        static void Main(string[] args) {
            var N = int.Parse(Console.ReadLine());




            Console.WriteLine(N*(N+1)/2);
        }
    }
}


Measured memory_bytes: 2776
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  int b[n-1];
  for(int i=0; i<n-1; i++) cin >> b[i];
  int a[n];
  a[0]=b[0];
  int sum=a[0];
  for(int i=0; i<n-2; i++){
    if(b[i]==b[i+1]) a[i+1]=b[i];
    else a[i+1]=min(b[i], b[i+1]);
    sum+=a[i+1];
  }
  a[n-1]=b[n-2];
  sum+=a[n-1];
  cout << sum;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int An,a,b,c[101]={0};
cin>>a;
for(int i=0;i<a;i++){
  cin>>b;
  for(int j=b;j>=0;j--){
  c[j]++;
  }
}
for(int i=0;i<101;i++){
  if(c[i]>=i)
  An=i;
}
cout<<An<<'\n';
  return 0;
  
}

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

struct point{
	int x,y;
	point(int x = 0,int y = 0):x(x),y(y){
	}
//	bool operator<(const point &p){ return (x < p.x || (x == p.x && y < p.y)); }
};

bool comp(const point &a, const point &p){
     return (a.x < p.x || (a.x == p.x && a.y < p.y));
}

bool comp1(const point &a, const point &p){
     return !(a.y < p.y || (a.y == p.y && a.x < p.x));
}


point a[1000];
point b[1000];
int vis[1000];
int main()
{
	int n;
	cin >> n;
	for(int  i = 1; i <= n; i++){
		int x,y;
		cin >> x >> y;
		a[i] = point(x,y);
	}
	for(int  i = 1; i <= n; i++){
		int x,y;
		cin >> x >> y;
		b[i] = point(x,y);
	}
	sort(a + 1, a + 1 + n, comp1);
	sort(b + 1, b + 1 + n, comp);
	int ans = 0;
	for(int i = 1; i <= n ; i++){
//		cout << a[i].x << " ddddddd " << a[i].y << endl;
	}
	
	for(int i = 1; i <= n ; i++){
//		cout << b[i].x << " dddd    dd " << b[i].y << endl;
	}
	for(int  i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(b[i].x > a[j].x && b[i].y > a[j].y && !vis[j]){
				vis[j] = 1;
//				cout << i << " " << j << endl;
				ans++;
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
	int a, b, d, r;
	double f;
	cin >> a >> b;
	d = (int)a/b;
	r = a%b;
	f = (double)a/b;
	printf("%d %d %f \n", d, r, f);
	return 0;
}


Measured memory_bytes: 3184
//16D8104007J Kanehiro Maho 兼弘真帆 2018年6月20日

#include<stdio.h>

int main(void){
  int n;
  scanf("%d",&n);
  int G[n][n];
  int i,j;
  for(i=0;i<n;i++){ //初期化
    for(j=0;j<n;j++){
      G[i][j]=0;
    }
  }

  int u,k,v;
  for(i=0;i<n;i++){
   scanf("%d",&u);
   scanf("%d",&k);
   for(j=0;j<k;j++){
     scanf("%d",&v);
     G[u-1][v-1]=1;
   }
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      printf("%d",G[i][j]);
      if(j!=n-1){
	putchar(' ');
      }
    }
    putchar('\n');
  }
  return 0;
}


Measured memory_bytes: 2124
N = int(input())
A = list(map(int, input().split()))
rain = [0] * N
rain[0] = sum(A) - 2 * sum(A[i] for i in range(1, N, 2))
for i in range(N-1):
    rain[i+1] = 2 * A[i] - rain[i]
print(' '.join(map(str, rain)))


Measured memory_bytes: 19140
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
 
int main() {
    int n;
    cin >> n;
    int count = 0;
    if(n%2 == 0) {
        count = n/2 - 1;
        cout << count;
    } else {
        count = n/2;
        cout << count;
    }
}

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


void solve(long long N, std::vector<long long> A){

    std::vector<long long> n(N-1, 0);

    for(long long i = 0; i < N-1; i++){
        n[A[i]-1] += 1;
    }

    for(long long i = 0; i < N-1; i++){
        cout << n[i] << endl;
    }
    cout << 0 << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N-2+1);
    for(int i = 0 ; i < N-2+1 ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 6436
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  int count = 0;
  int ans = 0;
  for (int i = 0; i < n; i++) {       //割られる数
    for (int j = 0; j <= i; j++) {     //割る数
      if ((i + 1) % 2 == 1 && (i + 1) % (j + 1) == 0) count++;
    
    }
    if (count == 8) ans++;
      count = 0;
  }
    
//  if (count == 8) ans++;
    cout << ans;
//  cout << count;
  //以下のプログラムは確認済み
  
  /*for (int i = 0; i < 105; i++) {
    if ((104 + 1) % 2 == 1 && (104 + 1) % (i + 1) == 0) count++;
  }
  if (count == 8) ans++;
  cout << count;
  cout << ans*/
}






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

using namespace std; 


int main(){
	
	
	int N;

	
	int ans = 0;
	
	vector<int> V(25) , C(25);
	cin >> N; 
	
	for(int i=0; i< N ; i++){
		cin >> V[i];
	}
	for(int i=0; i< N ; i++){
		cin >> C[i];
	}
	
	
	for(int i=0;i<N;i++){
		if(V[i]-C[i]<=0){
			continue;
		}else{
			ans+=V[i]-C[i];
		}
	}
	
	cout << ans << endl;
	
	
	
	
	
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#define pb push_back
#define en "\n"
#define MOD 1000000007
const double PI  =3.141592653589793238463;
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t=1;
	//cin >> t;
	while (t--) {
		float n;
		cin>>n;
		cout<<2*M_PI*n<<endl;;	
	}
	return 0;
}

Measured memory_bytes: 3256
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
class UnionFind {
private:
  std::vector<int> data_array;
  const int root(int id) {
    if (data_array[id] >= 0)
      return data_array[id] = root(data_array[id]);
    else
      return id;
  }

public:
  UnionFind(size_t size) : data_array(size, -1) {}
  // unionは予約語
  bool union_(int lhs, int rhs) {
    lhs = root(lhs);
    rhs = root(rhs);
    bool is_union = (lhs != rhs);
    if (is_union) {
      if (data_array[lhs] > data_array[rhs]) {
        std::swap(lhs, rhs);
      }
      data_array[lhs] += data_array[rhs];
      data_array[rhs] = lhs;
    }
    return is_union;
  }
  bool find(int lhs, int rhs) { return (root(lhs) == root(rhs)); }
};

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> p(n);
  for (int i = 0; i < n; i++)
    cin >> p[i];
  vector<pair<int, int>> xy(m);
  for (int i = 0; i < m; i++)
    cin >> xy[i].first >> xy[i].second;
  UnionFind u(n);
  for (int i = 0; i < m; i++)
    u.union_(xy[i].first - 1, xy[i].second - 1);
  vector<int> invp(n);
  for (int i = 0; i < n; i++)
    invp[p[i] - 1] = i;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (u.find(p[i] - 1, invp[p[i] - 1]))
      ans++;
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
    // 制約見て！！！デカかったらlong longにすること！
    map<ll, vector<ll>> roads;
    ll n, m;
    cin >> n >> m;
    ll h[n];

    for(ll i = 0; i < n ; i++){
        scanf("%lld", &h[i]);
    }
    ll a[m], b[m];

    for(ll i = 0; i < m; i++) {
        scanf("%lld %lld", &a[i], &b[i]);
        roads[a[i]-1].push_back(b[i]-1);
        roads[b[i]-1].push_back(a[i]-1);
    }

    ll ans = 0;

    for(ll i = 0; i < n; i++ ) {
        if(roads[i].size() == 0) {
            //道なし
            ans++;
        } else {
            vector<ll> rds = roads[i]; 
            for(ll j=0; j<rds.size();j++) { 
                if(h[i]<=h[rds[j]]){
                    break;
                }
                if(j==rds.size()-1){
                    ans++;
                }
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 17368