akhauriyash/Code-Regression huggingface dataset:
//Night's template
//orzakyrt
#include <bits/stdc++.h>
#define R register
#define LL long long
#ifdef __DEBUG__
	#define Debug (fprintf(stderr,"orzyrt\n"),fflush(stderr))
	#define debug(__a...) (fprintf(stderr,__a),fflush(stderr))
	#define setfile(__a) ('orzyrt')
	#define Compile(__a) system("g++ "__a".cpp -lm -o "__a)
#else
	#define Debug ('orzyrt')
	#define debug(__a...) ('orzyrt')
	#define setfile(__a) freopen(__a".in","r",stdin);freopen(__a".out","w",stdout)
	#define Compile(__a) ('orzyrt')
#endif
template<class TT>inline TT Max(R TT a,R TT b){return a<b?b:a;}
template<class TT>inline TT Min(R TT a,R TT b){return a<b?a:b;}
template<class TT>inline TT Abs(R TT a){return a<0?-a:a;}
template<class TT>inline TT cmin(R TT &a,R TT b){(b<a)&&(a=b);}
template<class TT>inline TT cmax(R TT &a,R TT b){(a<b)&&(a=b);}
using namespace std;
template<class TT>inline void read(R TT &x){
	x=0;R bool f=false;R char c=getchar();
	for(;c<48||c>57;c=getchar())f|=(c=='-');
	for(;c>47&&c<58;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	(f)&&(x=-x);
}
//end template

namespace Night{
	const int maxn = 100010;
	int n,m;
	struct node{
		int ti,id;
		inline bool operator < (R const node &x)const{
			return ti<x.ti;
		}
	};
	vector<node>v[maxn];
	int ansid[maxn];
	int bel[maxn];
	int main(){
		read(n);read(m);
		for(R int i=1,p,y;i<=m;++i){
			read(p);read(y);
			v[p].push_back((node){y,i});
			bel[i]=p;
		}
		for(R int i=1;i<=n;++i){
			sort(v[i].begin(),v[i].end());
			for(R int j=0;j<v[i].size();++j){
				ansid[v[i][j].id]=j+1;
			}
		}
		for(R int i=1;i<=m;++i){
			printf("%06d%06d\n",bel[i],ansid[i]);
		}
		return 0;
	}
}
int main(){
	return Night::main();
}


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

int dp[3005][3005], n, m;

string a, b;

int lcs(int x, int y){
    if(dp[x][y]!=-1){
        return dp[x][y];
    }
    if(x==n || y==m){
        return dp[x][y]=0;
    }
    if(a[x]==b[y]){
        return dp[x][y]=1+lcs(x+1, y+1);
    }
    return dp[x][y]=max(lcs(x, y+1), lcs(x+1, y));
}

int main(){
    memset(dp, -1, sizeof(dp));
    cin >> a >> b;
    n=(int)a.size();
    m=(int)b.size();
    lcs(0, 0);
    int i=0, j=0;
    string ans="";
    while(i<n && j<m){
        if(a[i]==b[j]){
            ans+=a[i];
            i++, j++;
        }else if(dp[i+1][j]>dp[i][j+1]){
            i++;
        }else{
            j++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 39172
#include <bits/stdc++.h>
#if 1
#define int long long
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define stoi stoll
#else
#define MAX INT_MAX
#define MIN INT_MIN
#endif
#define ALL(obj) (obj).begin(), (obj).end()
#define fi first
#define se second
const int NIL = -1;
const int MOD = 1000000007;
#define REP(i,n) for (int i=0; i < (n); ++i)
#define FOR(i,a,b) for (int i=(a); i < (b); ++i)
using namespace std;

int pow(int x, int n) {int res=1; while(n){if(n&1)res*=x;x*=x;n>>=1;} return res;}
int get_gcd(int a, int b){while(1){if (a < b) swap(a, b); if (b == 0) return a; a %= b;}}
int get_lcm(int a, int b){return a * b / get_gcd(a, b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//-------------------------テンプレここまで-------------------------//

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

  int N, M;
  cin >> N >> M;
  vector<vector<int>> G(N);
  REP(i, M) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  vector<int> p(N-1);
  REP(i,N-1) p[i] = i + 1;

  int ans = 0;
  do {
    p.push_back(0);

    bool is_good = true;
    for (int i = N-1; i > 0; i--) {
      if (find(ALL(G[p[i]]), p[i-1]) == G[p[i]].end()) {
        is_good = false;
        break;
      }
    }
    if (is_good) ans++;

    p.pop_back();
  } while(next_permutation(ALL(p)));

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
c11,c12,c13=map(int,input().split())
c21,c22,c23=map(int,input().split())
c31,c32,c33=map(int,input().split())

if c21-c11+c12-c22==0 and c31-c11+c12-c32==0 and c21-2*c11+c12+c13-c23==c31-2*c11+c12+c13-c33:
    print('Yes')
else:
    print('No')


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

int main() {
  int N;
  cin >> N;
  map<int, int> mp;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    mp[a]++;
  }

  long long ans = 0;
  map<int, int>::iterator it;
  for (it = mp.begin(); it != mp.end(); it++) {
    if (it->first == it->second) continue;
    else if (it->first > it->second) ans += it->second;
    else ans += it->second - it->first;
  }

  cout << ans << endl;
}

Measured memory_bytes: 4736
fun main(args: Array<String>) {
    val input = readLine()?.split(" ") ?: return
    val r = input[0].toInt()
    val d = input[1].toInt()
    val i = input[2].toInt()

    val x = arrayListOf<Int>()
    x.add(i)
    for (index in 1..10) {
        println((x[index - 1] * r) - d)
        x.add(x[index - 1] * r - d)
    }
}

Measured memory_bytes: 38000
import itertools

N = int(input())
X = [None] * N
Y = [None] * N

for i in range(N):
    A = int(input())
    x_i = [None] * A
    y_i = [None] * A

    for j in range(A):
        x, y = map(int, input().split())
        x_i[j] = x - 1
        y_i[j] = y

    X[i] = x_i
    Y[i] = y_i

res = 0
for n in range(1, N+1):
    for honests in itertools.combinations(range(N), n):
        correct = True
        for honest in honests:
            for x, y in zip(X[honest], Y[honest]):
                if y == 1 and x not in honests or\
                   y == 0 and x in honests:

                    correct = False
                    break

            if not correct:
                break

        if correct:
            res = max(res, n)

print(res)


Measured memory_bytes: 3064
A,B,C=map(int,input().split())
list = [A,B,C]
list.sort(reverse=True)
import copy
#処理の回数カウンタ
cnt=0
if (list[0]-list[2])%2==0:
    #一番小さい数と一番大き数の差が偶数であれば一緒になるように２を足す処理を複数回行う
    cnt += (list[0]-list[2])/2
    list[2]=copy.deepcopy(list[0])
    if (list[0]-list[1])%2==0:
        cnt += (list[0]-list[1])/2
    else:
        cnt += int((list[0]-list[1])/2)+2
else:
    #一番大きい数と一番小さい数の差が偶数でない時
    if (list[0]-list[1])%2==0:
        #一番大き数と真ん中の数の差が偶数
        cnt += (list[0]-list[1])/2
        cnt += int((list[0]-list[2])/2)+2
    else:
        #一番大きい数と真ん中の数の差が奇数＝一番小さい数と真ん中の数の差が偶数
        cnt += (list[1]-list[2])/2
        cnt += (list[0]-list[1])
print(int(cnt))
#print(list)


Measured memory_bytes: 3444
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pii> vii;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;
typedef vector<pii> vpii;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-7
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(n) ((n) * (n))
#define INF 300000005
#define MAXN 10001

int main()
{
	ll x, a, b;
	scanf("%lld %lld %lld", &x, &a, &b);
	if (abs(a - x) < abs(b - x))
	{
		printf("A");
	}
	else
	{
		printf("B");
	}
	return 0;
}

Measured memory_bytes: 256
//stayhome
//staysafe
#include<bits/stdc++.h>
using namespace std;
#define pb push_back

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mxn 2005



int main()
{
    int k,n;
    cin>>k>>n;
    int arr[n];
    int left=0,right=0,cnt=0,indx=-1;
    for(int i=0;i<n;i++)
        cin>>arr[i];

    int longdis=arr[0];
    for(int i=1;i<n;i++)
    {
        longdis=max(longdis,arr[i]-arr[i-1]);
    }

    int p=k-arr[n-1]+arr[0];

    cout<<k-max(p,longdis)<<endl;




}


Measured memory_bytes: 1024
/* When Talent doesn't work, Hard work beats Talent*/

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include"bits/stdc++.h"

using namespace std;

#define Fast_D cout<<fixed<<setprecision(2);
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define nl "\n"
#define sp " "
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define scanstr(s) cin>>ws; getline(cin,s);

const double PI=3.141592653589793;

bool ok[10];

void solve()
{
	int n;
	cin>>n;
	int a[n];
	int sum=0;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
		sum+=a[i];
	}
	int ava=sum/n;
	int ans1=0, ans2=0;
	for(int i : a)
	{
		ans1 += (ava-i)*(ava-i);
	}
	ava= (sum+n-1)/n;
	for(int i : a)
	{
		ans2 += (ava-i)*(ava-i);
	}
	cout << min(ans1,ans2);
}

int32_t main()
{
	FastIO;
	Fast_D;
	int T;
	T=1;
	while(T--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 3620
package main

import (
	"fmt"
)

func main() {
	var str string
	flag := true
	_, err := fmt.Scan(&str)
    if err != nil {
        panic("ERROR")
    }
	for i := 0; i < len(str); i++ {
		if (i+1)%2 == 0 {
			if str[i] == 'R' {
				flag = false
			}
		} else {
			if str[i] == 'L' {
				flag = false
			}
		}
	}
	if flag {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include<iostream>
#include<iomanip>

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
const int INF = 1e9;


int N;
//最長増加部分列
int main() {
    cin >> N;
    vector<int> H(N);
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    int count = 0;
    int i = 0;
    while (i < N) {
        int tmp = H[i];
        int tmp_count = 0;
        while (i+1 < N && H[i+1] <= tmp) {
            i++;
            tmp_count++;
            tmp = H[i];
        }
        chmax(count, tmp_count);
        i++;
    }
    cout << count << "\n";
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    int a[n];
    map<int, int> mp;
    rep(i, 0, n) {
        cin >> a[i];
        mp[i - a[i]]++;
    }
    ll ans = 0;
    map<int, int> now;
    rep(i, 0, n - 1) {
        now[i - a[i]]++;
        ans += mp[i + a[i]] - now[i + a[i]];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 38408
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
#define ld long double
#define PI 3.141592653L
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll INF = (ll)1e18;
const int N = 2e5 + 5;
const ll MOD = 1e9+7;
 
int parent[N];
 
int gcd(int a, int b) { 
    if (a == 0) 
        return b;  
    return gcd(b%a, a);  
} 
   
int lcm(int a, int b) {  
    return (a*b)/gcd(a,b);  
} 
 
ll pow(ll x, ll y, ll p) {
    if(y == 0) return 1;
    ll res = 1;
    x %= p;
    if(x == 0) return 0LL;
    while(y > 0) {
        if(y & 1) res = (res*x) % p;
        y >>= 1;
        x = (x*x) % p;
    }
    return res;
}
 
int find(int x) {
    return x == parent[x] ? x : parent[x] = find(parent[x]);
}
 
void Union(int x, int y) {
    int xPar = find(x), yPar = find(y);
    if(xPar != yPar) parent[xPar] = yPar;
}
 
ll nCr(ll n, ll r) {
    ll res = 1;
    for(ll i=1;i<=r;i++) {
        res = res * (n - r + i) / i;
        // is different from
        // res *= (n -r + i) / i;
    }
    return res;
}
 
int ask(int i, int j) {
    cout << "? " << i + 1 << ' ' << j + 1 << endl;
    int v;
    cin >> v;
    return v;
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    vector<int> dp(n, INT_MAX);
    for(int i=0;i<n;i++) cin >> h[i];
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for(int i=0;i<n;i++) {
        for(int j=i+1;j<=i+k;j++) {
            if(j < n) dp[j] = min(dp[j], abs(h[j] - h[i]) + dp[i]);
        }
    }
    cout << dp[n-1] << endl;
    return;
} 
 
int main()
{
    IOS
    //int t;
    //cin >> t;
    //while(t--) 
    solve();
    return 0; 
}

Measured memory_bytes: 3932
#include <iostream>
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define ma 100000000
#define mod 1000000007
const ll  INF=10000000000000;
using namespace std;
long double p[305][305][305];
long double ev[305][305][305];
int main()
{
    IOS;
    cout.precision(20);
    int cnt[4];memset(cnt,0,sizeof cnt);
    memset(p,0,sizeof p);
    memset(ev , 0 ,sizeof ev);
    int n;cin>>n;
    int x;
    for(int i=0;i<n;i++ ) { cin >> x ; ++cnt[x] ;}
    p[cnt[1]][cnt[2]][cnt[3]]=1;
    //ev[cnt[1]][cnt[2]][cnt[3]]=1;
    for(int c=n;c>=0;--c){
        for(int b=n;b>=0;--b){
            for(int a=n;a>=0;--a){
                if(a+b+c>n) continue;
                if( !a && !b && !c) continue;
                long double p_waste= (double) (n - a -b -c) / n ;
                long double ev_waste = 1 / (1 - p_waste ) ;
                ev[a][b][c] += ev_waste * p[a][b][c];
                if(a){
                    long double p_go = (double) a /(a+b+c);
                    p[a-1][b][c] += p[a][b][c] * p_go;
                    ev[a-1][b][c] += ev[a][b][c] * p_go;
                }
                if(b){
                    long double p_go = (double) b /(a+b+c);
                    p[a+1][b-1][c] += p[a][b][c] * p_go;
                    ev[a+1][b-1][c] += ev[a][b][c] * p_go;
                }
                if(c){
                    long double p_go = (double) c /(a+b+c);
                    p[a][b+1][c-1] += p[a][b][c] * p_go;
                    ev[a][b+1][c-1] += ev[a][b][c] * p_go;
                }
            }
        }
    }
    cout<<ev[0][0][0];
    return 0;
}


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

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    int k;
    string s;
    cin >> k >> s;
    if(s.size()<=k){
        cout << s << endl;
    }else{
        cout << s.substr(0,k) << "..." <<endl;
    }
    

    return 0;
}











Measured memory_bytes: 3596
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    int n = sc.nextInt();
    double ans;
    if (n % 2 == 0) {
      ans = 0.5;
    } else {
      int odd = n / 2 + 1;
      ans = (double) odd / (double) n;
    }
    os.println(String.format("%.10f", ans));
  }
}

Measured memory_bytes: 21844
# coding: utf-8

x = int(input())

if 400 <= x <= 599:
    print(8)
if 600 <= x <= 799:
    print(7)
if 800 <= x <= 999:
    print(6)
if 1000 <= x <= 1199:
    print(5)
if 1200 <= x <= 1399:
    print(4)
if 1400 <= x <= 1599:
    print(3)
if 1600 <= x <= 1799:
    print(2)
if 1800 <= x <= 1999:
    print(1)



Measured memory_bytes: 9184
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    int n; cin>>n; 
    int a[n];
    vector <vector<pii>> xy(n+1);
    for (int i=0;i<n;i++){
        cin >> a[i]; 
        for (int j=0;j<a[i];j++){
            int x,y; cin>>x>>y;
            xy[i].emplace_back(x-1,y);
        }
    }
    int ans=0;
    for (int  bit=0 ; bit < (1<<n) ; bit++){
        bool ok=true;
        for (int i=0;i<n;i++){
            bool cur=true;
            if ( bit & (1<<i) ){ 
                for (int j=0;j<sz(xy[i]);j++){
                    if ( ( ( bit >> xy[i][j].ff ) & 1) != xy[i][j].ss ) ok = false; 
                }
            }
            if (!ok) break;
        }
        if (ok) ans = max(ans,(int)__builtin_popcount(bit));
    }
    cout << ans << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include<map>
#include<vector>
#include<string>
#include <climits>
#include<set>
#include<cmath>
#include<bitset>
using namespace std;
#define ll long long
int main() {
  string s,t;
  cin>>s>>t;
  ll maxi=INT_MAX;
  for(int i=0;i<=(s.size()-t.size());i++)
  {  ll c=0;
     string r=s.substr(i,t.size());
     for(int j=0;j<t.size();j++)
     {
         if(r[j]!=t[j])
         {
             c++;
         }
     }
     if(maxi>c)
     {
         maxi=c;
     }
  }
  cout<<maxi<<endl;
    return 0;
}


Measured memory_bytes: 3200
def main():
    s = input()
    s1, s2 = s[:2], s[2:]
    if int(s1) in range(1, 13):
        if int(s2) in range(1, 13):
            result = "AMBIGUOUS"
        else:
            result = "MMYY"
    else:
        if int(s2) in range(1, 13):
            result = "YYMM"
        else:
            result = "NA"

    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<ctime>
using namespace std;

typedef long long ll;

bool debug = false;
const int NIL = -1;
const int INF = 1000000000;
const int NUM = 100010;
const double eps = 1e-10;
clock_t START, END;

//basic defitition
struct Point {
	double x, y;
	Point(double x = 0, double y = 0) :x(x), y(y) {}
};
typedef Point Vector;
Vector operator + (Vector A, Vector B) { return Vector(A.x + B.x, A.y + B.y); }
Vector operator - (Point A, Point B) { return Vector(A.x - B.x, A.y - B.y); }
Vector operator * (Vector A, double p) { return Vector(A.x * p, A.y * p); }
Vector operator / (Vector A, double p) { return Vector(A.x / p, A.y / p); }
bool operator < (const Point& a, const Point& b) { return a.x < b.x || (a.x == b.x && a.y < b.y); }
int dcmp(double x) { if (fabs(x) < eps)return 0; else return x < 0 ? -1 : 1; }
bool operator == (const Point& a, const Point& b) { return dcmp(a.x - b.x) == 0 && dcmp(a.y - b.y) == 0; }
// basic operator
double Dot(Vector A, Vector B) { return A.x * B.x + A.y * B.y; }
double Length(Vector A) { return sqrt(Dot(A, A)); }
double Angle(Vector A, Vector B) { return acos(Dot(A, B) / Length(A) / Length(B)); }
double Cross(Vector A, Vector B) { return A.x * B.y - A.y * B.x; }
//point and line
Point GetLineIntersection(Point P, Vector v, Point Q, Vector w) {
	Vector u = P - Q;
	double t = Cross(w, u) / Cross(v, w);
	return P + v * t;
}//two lines only have one intersection and Cross(v,w) is not zero
double ConvexPolygonArea(vector<Point>& p, int n) {
	double area = 0;
	for (int i = 1; i < n; i++) {
		area += Cross(p[i] - p[0], p[i + 1] - p[0]);
	}
	return area / 2;
}

int main(void)
{
	if (debug) {
		START = clock();
		freopen("in29.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	};
	int n;
	double x, y, _ans;
	vector<Point> p;
	Point p1, p2, X, Y;
	cin >> n;
	for (int i = 0; i < n; i++) {
		scanf("%lf%lf", &x, &y);
		p.push_back(Point(x, y));
	}
	p.push_back(p[0]);
	_ans = ConvexPolygonArea(p, n);
	printf("%.1lf\n", _ans);
	if (debug) {
		END = clock();
		double endtime = (double)(END - START) / 1000;
		printf("total time = %lf s", endtime);
	}
	return 0;
}


Measured memory_bytes: 3256
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	pair<string,string> fix;
	cin>>s;
	int Q;
	cin>>Q;
	int cnt=0;
	for(int q=0;q<Q;q++)
	{
		int t;
		cin>>t;
		if(t==1){
			cnt++;
			swap(fix.first,fix.second);
		}
		else{
			int f;
			char c;
			cin>>f>>c;
			if(f==1){
				fix.first+=c;
			}
			else{
				fix.second+=c;
			}
		}
	}
	reverse(fix.first.begin(),fix.first.end());
	cnt%=2;
	if(cnt)reverse(s.begin(),s.end());
	cout<<fix.first<<s<<fix.second<<endl;
	return 0;
}

Measured memory_bytes: 1040
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  vector<string> a;
  string hoge="hi";
  a.push_back(hoge);
  for(int i=0;i<4;i++){
    hoge=hoge+"hi";
    a.push_back(hoge);
  }
  for(int i=0;i<5;i++){
    if(a[i]==s){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define pb push_back
#define fi first
#define se second 
#define mp make_pair
int main()
{
    IOS
    int n; cin>>n;
    string str; cin>>str;
    int red = 0;
    for(int i=0;i<n;i++)
    {
        if(str[i] == 'R') red++;
    }
    int blue = n - red;
    if(red > blue)
    {
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int64
	fmt.Scan(&n)

	m := make(map[int64]int)
	for i := int64(2); i*i <= n; i++ {
		if n == 0 {
			break
		}
		for n%i == 0 {
			m[i]++
			n /= i
		}
	}
	if n > 1 {
		m[n]++
	}

	var ans int
	for _, v := range m {
		x := sort.Search(50, func(i int) bool {
			return i*(i+1)/2 > v
		})
		ans += x - 1
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1824
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod = (1e9 + 7);
ll dp[1005][1005];
void add(int i,int j) {
  dp[i][j] = dp[i-1][j] + dp[i][j-1];
  if(dp[i][j] >= mod) {
    dp[i][j] = dp[i][j] - mod;
  }
}

int main() {
  int H,W;
  cin>>H>>W;
  vector<vector<char>> grid(H+1,vector<char>(W+1));

  for(int row = 0;row<H;row++) {
    for(int col = 0 ;col<W;col++) {
      cin>>grid[row+1][col+1];
    }
  }
  //dp[i][j] is number of ways to reach sq i,j 
  // if grid[i][j] = # then dp[i][j] = 0
  //else dp[i][j] = dp[i-1][j] + dp[i][j-1];
  dp[1][1] = 1;
  for(int row = 1; row<= H; row++) {
    for(int col = 1; col<= W; col++) {
      if(row == 1 && col == 1) continue;
      if(grid[row][col] == '#') {
        dp[row][col] = 0;
      } else {
        add(row,col);
      }
    }
  } 

  cout<<dp[H][W]<<endl;

}

Measured memory_bytes: 9088
answer = []

while True:
    H, W = list(map(int, input().split()))

    if H == W == 0:
        break
    else:
        for i in range(H):
            if (i == 0) or (i == (H - 1)):
                answer.append("#" * W)
            else:
                answer.append("#" + ("." * (W - 2)) + "#")

    answer.append("")

[print(answer[i]) for i in range(len(answer))]


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

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

using namespace std;

typedef long long ll;
typedef vector<int> V;
typedef vector<V> M;

const int mod = 1e9 + 7;

int h, w;
ll k;
char s[1000][1001];

int add(int a, int b){
	return ((a + b) % mod + mod) % mod;
}
int mul(int a, int b){
	return (ll(a) * b % mod + mod) % mod;
}

V mul(const M& a, const V& b){
	V c(2, 0);
	rep(i, 2){
		rep(j, 2){
			c[i] = add(mul(a[i][j], b[j]), c[i]);
		}
	}
	return c;
}
M mul(const M& a, const M& b){
	M c(2, V(2, 0));
	rep(i, 2){
		rep(j, 2){
			rep(k, 2){
				c[i][j] = add(mul(a[i][k], b[k][j]), c[i][j]);
			}
		}
	}
	return c;
}
M pow(const M& a, ll k){
	M b = a;
	M c = {{1, 0}, {0, 1}};
	while(k > 0){
		if(k & 1){
			c = mul(c, b);
		}
		b = mul(b, b);
		k >>= 1;
	}
	return c;
}

int main(){
	cin >> h >> w >> k;
	rep(i, h){
		cin >> s[i];
		rep(j, w){
			s[i][j] = s[i][j] == '#';
		}
	}

	int hc = 0;
	rep(i, h){
		if(s[i][0] && s[i][w - 1]){
			++hc;
		}
	}
	int vc = 0;
	rep(i, w){
		if(s[0][i] && s[h - 1][i]){
			++vc;
		}
	}
	
	if(hc && vc){
		cout << 1 << endl;
		return 0;
	}

	int c = 0;
	rep(i, h){
		rep(j, w){
			c += s[i][j];
		}
	}

	M m;
	if(!hc && !vc){
		m = {{c, 0}, {0, 0}};
	}
	else if(hc){
		int p = 0;
		rep(i, h){
			rep(j, w - 1){
				p += s[i][j] && s[i][j + 1];
			}
		}
		m = {{c, -p}, {0, hc}};
	}
	else{
		int p = 0;
		rep(i, h - 1){
			rep(j, w){
				p += s[i][j] && s[i + 1][j];
			}
		}
		m = {{c, -p}, {0, vc}};
	}

	V v = mul(pow(m, k - 1), {1, 1});
	cout << v[0] << endl;
	return 0;
}

Measured memory_bytes: 1280
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

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

typedef pair<int, int> pint;
typedef long long ll;

#define int ll

//get vector of prime numbers which is lower than or equal n
vector<int> get_primes(int n)
{
    vector<bool> is_prime(n + 1, true);
    vector<int> res;
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= n; i++)
    {
        if (is_prime[i])
        {
            res.push_back(i);
            for (int j = 2 * i; j < is_prime.size(); j = j + i)
            {
                is_prime[j] = false;
            }
        }
    }
    return res;
}

vector<pair<int, int>> factorize(int n)
{
    vector<pair<int, int>> res;
    for (int i = 2; i * i <= n; i++)
    {
        int tmp = 0;
        while (n % i == 0)
        {
            tmp++;
            n /= i;
        }
        res.push_back(make_pair(i, tmp));
    }
    if (n != 1)
    {
        res.push_back(make_pair(n, 1));
    }
    return res;
}

int mpow(int x, int n)
{
    int res = 1;
    while (n != 0)
    {
        if (n & 1)
            res = res * x % INF;
        x = x * x % INF;
        n = n >> 1;
    }
    return res;
}

//mod frac
vector<int> mfrac;
void set_mfrac(int n)
{
    if (mfrac.size() == 0)
    {
        mfrac.push_back(1);
    }
    for (int i = mfrac.size(); i <= n; i++)
    {
        mfrac.push_back((i * mfrac[i - 1]) % INF);
    }
}

//get nCm mod INF
int mcomb(int n, int m)
{
    if (mfrac.size() <= n)
    {
        set_mfrac(n);
    }
    int res = mfrac[n];
    res = res * mpow(mfrac[m], INF - 2) % INF;
    res = res * mpow(mfrac[n - m], INF - 2) % INF;
    return res;
}

vector<int> get_gcd(int n)
{
    vector<int> res;
    for (int i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            if (i * i == n)
            {
                res.push_back(i);
            }
            else
            {
                res.push_back(i);
                res.push_back(n / i);
            }
        }
    }
    return res;
}

signed main()
{
    int X, sX;
    cin >> X;
    sX = 1;
    for (int i = 2; i * i <= X; i++)
    {
        if (X % i == 0)
        {
            sX = i;
        }
    }

    cout << sX + X / sX -2<< endl;
}

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

int h,w,bl=0,wh=0,d=0;
int x[4]={1,-1,0,0};
int y[4]={0,0,1,-1};

char memo[51][51];
int memod[51][51]={0};
queue<pair<int,int>> qu;

int main(){
  int i,j,ans;
  pair<int,int> now,next;
  cin >> h >> w;
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      cin >> memo[i][j];
      if(memo[i][j]=='.')wh++;
      else bl++;
    }
  }
  
  now = make_pair(1,1);
  qu.push(now);
  while(qu.size()){
    now = qu.front();
    qu.pop();
    for(i=0;i<4;i++){
      next = make_pair(now.first+x[i],now.second+y[i]);
      if(next.first>=1&&next.first<=h&&next.second>=1&&next.second<=w&&memo[next.first][next.second]=='.'){
	d++;
	memo[next.first][next.second]='#';
	qu.push(next);
	memod[next.first][next.second] = memod[now.first][now.second] +1;
      }
    }
  }
  ans = h*w-bl-memod[h][w]-1;
  if(memod[h][w]!=0)cout << ans << endl;
  else cout << -1 << endl;
  return 0;


    
  }
  


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(){
    int h, w;
    while(true){
        cin >> h >> w;
        if(h==0) break;
        for(int j=0;j<h;j++){
            for(int i=0;i<w;i++){
                if(i==0 || i==w-1){
                    cout << "#";
                }else{
                    if(j==0 || j==h-1){
                        cout << "#";
                    }else{
                        cout << ".";
                    }
                }
            }
            cout << endl;
        }
    cout << endl;
    }
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    cin>>str;
    int t=0;
    for(int i=0;i<str.size();i++)t=(t+str[i]-'0')%9;
    if(t)puts("No");
    else puts("Yes");
    return 0;
}

Measured memory_bytes: 3740
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val s = sc.next()
  val t = sc.next()


  val prefixArray = Array(n) { s.substring(it) }
  val suffixArray = Array(n) { t.substring(0, it+1) }

  var max = 0
  for (pi in prefixArray) {
    for (si in suffixArray) {
      if (pi == si) {
        max = Math.max(pi.length, max)
      }
    }
  }

  println(n * 2 - max)

}


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

using namespace std;

#ifdef SG
	#include <debug.h>
#else
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned char uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

const ld pi = 3.1415926535897932384626433832795l;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

const int N = 310;

char a[2 * N][2 * N];
int b[2 * N][2 * N];

int main () {
	//std::ios::sync_with_stdio(false);
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);
#ifdef SG
	freopen((problemname + ".in").c_str(), "r", stdin);
//	freopen((problemname + ".out").c_str(), "w", stdout);
#endif
    int n;
    cin >> n;
    forn(i, n) {
        string qwe;
        getline(cin, qwe);
        forn(j, n) {
            scanf("%c", &a[i][j]);    
            a[i + n][j] = a[i][j + n] = a[i + n][j + n] = a[i][j];
        }
    }
    forn(i, 2 * n) {
        forn(j, 2 * n) {
            int res = 0;
            for (int k = 0; k <= i && k <= j && a[i][j - k] == a[i - k][j]; ++k) {
                res++;
            }
            b[i][j] = res;
        }
    }
    int ans = 0;
    forn(i, n) {
        forn(j, n) {
            bool ok = 1;
            forn(k, n) {
                if (b[i + k][j + k] <= k) {
                    ok = 0;
                    break;
                }
            }
            ans += ok;
        }
    }
    cout << ans << endl;
    
    

	return 0;
}

Measured memory_bytes: 2176
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
int n;
char a[10];
char b[10];
int integer(char c){
	int integer;
	if(c=='m')
	integer=1000;
	if(c=='c')
	integer=100;
	if(c=='x')
	integer=10;
	if(c=='i')
	integer=1;
	return integer;
}
int change(char d[100]){
	int changed=0;
	for(int i=0;i<strlen(d);i+=1){
		if((d[i] >= 50) && (d[i] <= 57)){
			int j=i+1;
			changed+=(d[i]-48)*integer(d[j]);   //文字列要转换成阿斯卡码
			i++;
		}
		else {
			changed+=integer(d[i]);
		}
	}
	return changed;
	
}

int main(){
	int sum;
	scanf("%d",&n);
	while (n--) {
		scanf("%s",a);
		scanf("%s",b);
		sum=change(a)+change(b);
		//printf("%d",sum);
		int a=sum;
		int digit=0;
		while (a) {
				a/=10;
				digit++;
			}
			int i=0,x=digit;
			char cb[100]={0};
			int q=0;


		while (digit--) {
				int a=(pow(10.0, x));
				int b=(pow(10.0,x-1));
				q=sum%a/b;
				 if (q==1) {
					if (x==1) {
						cb[i]='i';
					}
					if (x==2) {
						cb[i]='x';
					}
					if (x==3) {
						cb[i]='c';
					}
					if (x==4) {
						cb[i]='m';
					}
					
				}
				else if(q>1){
					cb[i]=(q+48);
					if (x==1) {
						cb[i+1]='i';
					}
					if (x==2) {
						cb[i+1]='x';
					}
					if (x==3) {
						cb[i+1]='c';
					}
					if (x==4) {
						cb[i+1]='m';
					}
					i++;

					
				}
				if (q!=0) {
					i++;
				}
				x--;
				
			}
			printf("%s\n",cb);

				
		
	}
	return 0;
	
}



Measured memory_bytes: 2060
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
/*vector<Type> v;
vector<Type> v();
vector<Type> v(n);
vector<Type> v(n, d);
vector<vector<Type>> vv;
vector<vector<Type>> vv();
vector<vector<Type>> vv(n);
vector<vector<Type>> vv(n, vector<Type>(m));
vector<vector<Type>> vv(n, vector<Type>(m, d));*/

int main() {
  long long n, d, x, y;
  cin>>n>>d;
  long long count = 0;
  rep(i,n){
    cin >> x >> y;
    if(x*x + y*y <= d*d) count++;
  }
  cout << count;
 
  return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
namespace my_std{
	using namespace std;
	#define reg register
	#define Rint register int
	#define FOR(i,a,b) for(register int i=(a);i<=(b);++i)
	#define ROF(i,a,b) for(register int i=(a);i>=(b);--i)
	#define FORit(templ,arr,i,a,b) for(register templ *i=(arr)+(a);i!=(arr)+(b)+1;++i)
	#define ROFit(templ,arr,i,a,b) for(register templ *i=(arr)+(a);i!=(arr)+(b)-1;--i)
	#define GO(x,p,e,i,v) for(register int i=p[x].head,v;i;i=e[i].link)
	#define MEM(x,v) memset(x,v,sizeof(x))
	#define fir first
	#define sec second
	#define pq priority_queue
	#define PII pair<int,int>
	#define MP make_pair
	typedef long long LL;
	typedef double DB;
	inline int read(){
		int ans=0,f=1;char c=getchar();
		while(!isdigit(c)){ f^=(c=='-'); c=getchar(); }
		for(;isdigit(c);c=getchar()) ans=(ans<<1)+(ans<<3)+(c^48); return f?ans:-ans;
	}
	const int mod = 998244353 , N = 100010;
	inline void inc(int &x,const int &y){ x+=y; if(x>=mod) x-=mod; }
	inline int ksm(int x,LL y){ int res=1; for(;y;y>>=1,x=1ll*x*x%mod) if(y&1) res=1ll*res*x%mod; return res;}
	inline int gcd(int x,int y){ if(x<y) swap(x,y); return y?gcd(y,x%y):x; }
	#define FILE(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
}
using namespace my_std;

int n,m,x[N],pos[N],vis[N];
LL k , ans[N];
int stk[N] , top;

int main(){
	n = read();
	FOR(i,1,n) x[i] = read() , pos[i] = i;
	ROF(i,n,1) x[i] -= x[i - 1];
	m = read() , scanf("%lld",&k);
	Rint xx;
	FOR(i,1,m) xx = read() , swap(pos[xx] , pos[xx + 1]);
	FOR(i,1,n){
		if(!vis[i]){
//			printf("%d\n",i);
			for(Rint j = i;!vis[j];j = pos[j]) vis[stk[top++] = j] = 1;
			FOR(j,0,top - 1) ans[stk[j]] = x[stk[(j + k) % top]];
			top = 0;
		}
	}
	FOR(i,1,n) ans[i] += ans[i - 1] , printf("%lld.0\n",ans[i]);
	return 0;
}

Measured memory_bytes: 3840
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = 1000000000000000;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
string re(string s){
    string res = "";
    int n = s.length();
    rep(i,n) res += s[n-i-1];
    return res;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    int q;
    cin >> s >> q;
    int t;
    char c;
    int flag = 0,f;
    string begin = "",end = "";
    rep(i,q){
        cin >> t;
        if (t == 1) flag = 1-flag;
        else{
            cin >> f >> c;
            if (flag) f = 3-f;
            if (f == 1) begin += c;
            else end += c;
        }
    }
    if (flag){
        end = re(end);
        s = re(s);
        s = end+s+begin;
        PRINT(s);
    }
    else{
        begin = re(begin);
        s = begin+s+end;
        PRINT(s);
    }
}


Measured memory_bytes: 1456
#include <stdio.h>

int main(){
    int h, w;
    char a[100][100];
    int i, j, check;

    scanf("%d %d", &h, &w);
    for(i=0; i<h; i++){
        scanf("%s", a[i]);
    }

    for(i=0; i<h; i++){
        check=0;
        for(j=0; j<w; j++){
            if(a[i][j] == '#')
                check=1;
        }

        if(check==0){
            for(j=0; j<w; j++)
                a[i][j] = ' ';
        }
    }

    for(i=0; i<w; i++){
        check=0;
        for(j=0; j<h; j++){
            if(a[j][i] == '#')
                check=1;
        }

        if(check==0){
            for(j=0; j<h; j++)
                a[j][i] = ' ';
        }
    }

    for(i=0; i<h; i++){
        check=0;
        for(j=0; j<w; j++){
            if(a[i][j] != ' '){
                printf("%c", a[i][j]);
                check=1;
            }
        }

        if(check == 1)
            printf("\n");
    }

    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(){
  int out[4][2] = {}, i;
  double e[2];
  while(scanf("%lf%lf", &e[0], &e[1]) != EOF){
    for(i = 0;i < 2;i++){
      if(e[i] < 0.2) out[3][i]++;
      else if(e[i] < 0.6) out[2][i]++;
      else if(e[i] < 1.1) out[1][i]++;
      else out[0][i]++;
    }
  }

  for(i = 0;i < 4;i++)
    printf("%d %d\n", out[i][0], out[i][1]);
  return 0;
}

Measured memory_bytes: 628
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int m[300][300];
bool f[300];
int main()
{
	int num, kai;
	scanf("%d%d", &num, &kai);
	for (int i = 0; i < num; i++)
	{
		for (int j = 0; j < kai; j++)scanf("%d", &m[i][j]), m[i][j]--;
	}
	int mini = 1000000000;
	for (int p = 0; p < kai; p++)
	{
		int cnt[300];
		fill(cnt, cnt + kai, 0);
		for (int i = 0; i < num; i++)
		{
			for (int j = 0; j < kai; j++)
			{
				if (!f[m[i][j]])
				{
					cnt[m[i][j]]++;
					break;
				}
			}
		}
		int maxi = -1, rr = -1;
		for (int i = 0; i < kai; i++)if (maxi < cnt[i])maxi = cnt[i], rr = i;
		mini = min(mini, maxi);
		f[rr] = true;
	}
	printf("%d\n", mini);
}

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

int main(){
    int n,a;cin>>n>>a;
    if (n%500<=a) cout << "Yes";
    else cout << "No";
}


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

string int_to_bin(int n) {
  string ret;
  for (int i = 7; i >= 0; i--) {
    ret += (n >> i & 1 ? "1" : "0");
  }
  return ret;
}

string fp_to_bin(string n) {
  n = "0." + n;
  string ret;
  double t = stod(n);
  while (ret.size() <= 32) {
    t *= 2;
    if (t >= 1) {
      ret += "1";
      t -= 1;
    } else {
      ret += "0";
    }
  }
  reverse(ret.begin(), ret.end());
  auto p = ret.find_first_not_of('0');
  if (p != string::npos) ret = ret.substr(p);
  else ret = "0000";
  reverse(ret.begin(), ret.end());
  return ret;
}

int main() {
  string s;
  while (cin >> s, s[0] != '-') {
    stringstream ss(s);
    int a;
    string b;
    char c;
    ss >> a >> c >> b;
    string t = fp_to_bin(b);
    if (a > 255 || t.size() > 4) {
      cout << "NA\n";
    } else {
      while (t.size() < 4) {
        t += "0";
      }
      cout << int_to_bin(a) << "." << t << "\n";
    }
  }
}



Measured memory_bytes: 3000
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

a = ni()
b = ni()
c = ni()
x = ni()
ans = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i + 100*j + 50*k == x:
                ans += 1
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define li long long
#define gc getchar()
#define pc putchar
li read(){
	li x = 0,y = 0,c = gc;
	while(!isdigit(c)) y = c,c = gc;
	while(isdigit(c)) x = (x << 1) + (x << 3) + (c ^ '0'),c = gc;
	return y == '-' ? -x : x;
}
void print(li q){
	if(q < 0){
		pc('-');
		q = -q;
	}
	if(q >= 10) print(q / 10);
	pc(q % 10 + '0');
}
li s1 = 19260817,s2 = 23333333,s3 = 998244853,srd;
li rd(){
	return srd = (srd * s1 + s2 + rand()) % s3;
}
int n,m;
void file(){
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
//const int mo = 998244353;
//const int mo = 1000000007;
struct edge{
	int to,nxt;
}e[400010];
int cnt,fir[200010];
inline void ins(int u,int v){
	e[++cnt].to = v;e[cnt].nxt = fir[u];fir[u] = cnt;
	e[++cnt].to = u;e[cnt].nxt = fir[v];fir[v] = cnt;
}
int dp1[200010],dp2[200010],fa[200010],as[200010],mx[200010];
void pre(int q){
	mx[q] = max(mx[fa[q]],q);
	for(int i = fir[q];i;i = e[i].nxt) if(e[i].to != fa[q]){
		fa[e[i].to] = q;pre(e[i].to);
	}
}
priority_queue<int> p[200010];
bool usd[200010];
void dfs(int q){
	if(fa[q] == 1) as[q] = 1;
	else if(usd[q]){
		if(fa[q] != mx[fa[q]]) as[q] = as[fa[q]];
		else{
			as[q] = as[fa[q]];
			p[q].push(-fa[q]);
			while(!p[q].empty()){
				int tp = -p[q].top();p[q].pop();
				//cerr<<q<<" "<<tp<<"*"<<endl;
				if(tp == fa[q]) break;
				else{
					usd[tp] = 1;++as[q];
					for(int i = fir[tp];i;i = e[i].nxt) if(e[i].to != fa[tp]) p[q].push(-e[i].to);
				}
			}
		}
	} 
	else{
		as[q] = as[fa[q]] + 1;
		//while(!p.empty()) p.pop();
		
		for(int i = fir[q];i;i = e[i].nxt) if(e[i].to != fa[q]){
			int tmp = e[i].to;
			p[tmp].push(-mx[fa[q]]);p[tmp].push(-tmp);
			while(!p[tmp].empty()){
				int tp = -p[tmp].top();p[tmp].pop();
				//cerr<<"&"<<q<<" "<<tmp<<" "<<tp<<endl;
				if(tp == mx[fa[q]]) break;
				else{
					usd[tp] = 1;++as[q];
					for(int i = fir[tp];i;i = e[i].nxt) if(e[i].to != fa[tp]) p[tmp].push(-e[i].to);
				}
			}
		} 
		
	}
	for(int i = fir[q];i;i = e[i].nxt) if(e[i].to != fa[q]) dfs(e[i].to);
}
int main(){
	srand(time(0));rd();
	//file();
	int i,j,u,v;
	n = read();
	for(i = 1;i < n;++i){
		u = read();v = read();ins(u,v);
	}
	pre(1);
	for(i = fir[1];i;i = e[i].nxt) dfs(e[i].to);
	for(i = 2;i <= n;++i) print(as[i]),pc(' ');
	return 0;
}


Measured memory_bytes: 31488
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
const double PI = 3.14159265358979;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    double r; cin>>r;
    double area=r*r*PI; double length=2*r*PI;
    printf("%f %f\n",area,length);
    return 0;
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll p=pow(10,9)+7;
ll phi(ll n) {
    ll result = n;
    for (ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            while(n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if(n > 1)
        result -= result / n;
    return result;
}
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      
    x = x % p;  
   while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
} 

ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
}
ll isPalindrome(string str) 
{ 
    // Start from leftmost and rightmost corners of str 
    int l = 0; 
    int h = str.length() - 1; 
  
    // Keep comparing characters while they are same 
    while (h > l) 
    { 
        if (str[l++] != str[h--]) 
        { 
           
            return 0; 
        } 
    } 
    return 1;
} 


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll i,n;
    cin>>n;
    ll arr[n];
    map<ll,ll> m;
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
        m[arr[i]]++;
    }
    ll ans=0;
    for(i=1;i<=n;i++)
    {
        ans+=(m[i]*(m[i]-1))/2;
    }
    
    for(i=0;i<n;i++)
    {
        cout<<ans-m[arr[i]]+1<<endl;
    }
    
 
}
    



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

const int N = 2054, M = N * 2;

int n, E = 0;
int to[M], first[N], next[M];
int size[N], depsum[N], f[N];
char A[N];

inline void down(int &x, const int y) {x > y ? x = y : 0;}

inline void addedge(int u, int v) {
	to[++E] = v, next[E] = first[u], first[u] = E;
	to[++E] = u, next[E] = first[v], first[v] = E;
}

void dfs(int x, int px = 0) {
	int i, y, z = 0; depsum[x] = size[x] = 0;
	for (i = first[x]; i; i = next[i])
		if ((y = to[i]) != px)
			dfs(y, x), size[x] += size[y], depsum[x] += depsum[y],
			f[z] < f[y] ? z = y : 0;
	f[x] = (f[z] <= depsum[x] - depsum[z] ? depsum[x] & 1 : f[z] - (depsum[x] - depsum[z]));
	depsum[x] += size[x] += A[x], f[x] += size[x];
}

int main() {
	int i, u, v, ans = INT_MAX;
	scanf("%d%s", &n, A + 1), *f = 0;
	for (i = 1; i < n; ++i) scanf("%d%d", &u, &v), addedge(u, v);
	for (i = 1; i <= n; ++i) A[i] &= 1;
	for (i = 1; i <= n; ++i)
		if (dfs(i), depsum[i] -= size[i], !(f[i] -= size[i])) down(ans, depsum[i] / 2);
	printf("%d\n", ans == INT_MAX ? -1 : ans);
	return 0;
}

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

namespace ConsoleApp5
{

    class Program
    {
        static void Main(string[] args)
        {

            String S = Console.ReadLine();
            String[] line = S.Split(' ');

            int A = int.Parse(line[0]);
            int B = int.Parse(line[1]);
            int C = int.Parse(line[2]);

            if(C - (A - B) >= 0)
            {
                Console.WriteLine(C - (A - B));
            }
            else
            {
                Console.WriteLine(0);
            }
        }
    }
}

Measured memory_bytes: 11092