akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        double[] v = new double[n];
        for (int i = 0; i < n; i++) {
            v[i] = sc.nextDouble();
        }
        Arrays.sort(v);
        double ans = v[0];
        for (int i = 1; i < n; i++) {
            ans = (ans + v[i]) / 2;
        }
        System.out.printf("%.5f%n", ans);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 22484
import numpy as np

N = int(input())
X = np.array([0. for i in range(N)])
U = np.array([0. for i in range(N)])

for i in range(N):
	x, u = input().split()
	x = float(x)
	X[i] = x
	if u == 'JPY':
		U[i] = 1.0
	elif u == 'BTC':
		U[i] = 380000.0

A = np.dot(X,U)

print(A)


Measured memory_bytes: 20148
N = int(input())
Ryori = [[int(i) for i in input().split()] for j in range(3)]

ans = 0
before_eat = -1
for i in range(N):
    a = Ryori[0][i] - 1
    b = Ryori[1][a]
    c = Ryori[2][before_eat] if before_eat != -1 and a == before_eat + 1 else 0
    before_eat = a
    ans += b + c
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

using namespace std;
int main()
{
    char  sr[10];
    int a=0,b;
    cin>>sr;
    int i;
    for(i=0;sr[i]!='\0';i++)
    	a+=sr[i]-'0';
    b=atoi(sr);
	if(b%a==0)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main()
{
  int L;
  cin >> L;
  double a = L/3.0;
  cout <<fixed << setprecision(20)<< a*a*a << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using static System.Math;

class Program
{
    static int n;
    static int[] a;
    static long mod = (long)1e9 + 7;

    static void Main()
    {
        /* 入力を受け取る */
        n = int.Parse(Console.ReadLine());
        a = Console.ReadLine().Split().Select(int.Parse).ToArray();

        /* 重複について
         *   l個 重複左 (n - l - r)個 重複右 r個
         *  なるl,rを調べる */
        bool[] check = new bool[n + 1]; // check[i] : iがすでに登場したか
        int d = 0; // 重複する数を格納
        for (int i = 0; i <= n; i++)
        {
            if (check[a[i]]) // すでに登場していれば重複
            {
                d = a[i];
                break;
            }
            check[a[i]] = true; // 登場済みに
        }
        int l = 0;
        int r = 0;
        for (; l <= n; l++) // lを決定
            if (a[l] == d)
                break;
        for (; r <= n; r++) // rを決定
            if (a[n - r] == d)
                break;

        /* Combination計算の前処理 */
        Comb c = new Comb(n, mod);

        /* 各kについて答えを計算 */
        for (int k = 1; k <= n + 1; k++)
        {
            long ans = 0;
            ans += c.Com(n - 1, k);
            ans += 2 * c.Com(n - 1, k - 1) % mod;
            ans %= mod;
            ans -= c.Com(l + r, k - 1);
            ans += mod;
            ans %= mod;
            ans += c.Com(n - 1, k - 2);
            ans %= mod;
            Console.WriteLine(ans);
        }
    }
}

class Comb // 組み合わせ計算用のクラス
{
    private long size;
    private long[] inv;
    private long[] kai;
    private long[] invkai;
    private long mod;
    public Comb(long size, long mod)
    {
        this.size = size;
        this.mod = mod;
        inv = new long[size + 1];
        kai = new long[size + 1];
        invkai = new long[size + 1];
        inv[1] = 1;
        for (int i = 2; i <= size; i++)
            inv[i] = mod - (mod / i) * inv[mod % i] % mod;
        kai[0] = 1;
        invkai[0] = 1;
        for (int i = 1; i <= size; i++)
        {
            kai[i] = kai[i - 1] * i % mod;
            invkai[i] = invkai[i - 1] * inv[i] % mod;
        }
    }
    public long Com(long a, long b)
    {
        if (a < b || b < 0)
            return 0;
        return (invkai[b] * invkai[a - b]) % mod * kai[a] % mod;
    }
}

Measured memory_bytes: 28764
use std::io::*;
use std::str::FromStr;


pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let a = read::<u64>();
  let b = read::<u64>();
  let k = read::<u64>();
  let mut count = 0;
  let mut ans = 0;

  let m = if a > b { a } else { b };
  for i in (1..m + 1).rev() {
    if a % i == 0 && b % i == 0 {
      count += 1;
      if count == k {
        ans = i;
        break;
      }
    }
  }
  println!("{}", ans)
}



Measured memory_bytes: 4352
n, m, x = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(n)]
INF = float('inf')

ans = INF
for i in range(2**n):
    tmp = 0
    tmp_l = [0]*m
    for j in range(n):
        if i & (1<<j):
            tmp += ca[j][0]
            for k in range(m):
                tmp_l[k] += ca[j][1+k]
    if min(tmp_l) >= x:
        ans = min(ans, tmp)
if ans == INF:
    ans = -1
print(ans)

Measured memory_bytes: 9224
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b;
    cin >> a >> b;
    int B = b;
    int i = 1;
    while(B > 0){
        B /= 10;
        i *= 10;
    }
    int c = a*i + b;
    for(int j = 0; j <= sqrt(c); j++){
        if(j*j == c){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
// Problem Title : AC or WA
// Link : https://atcoder.jp/contests/abc152/tasks/abc152_a
// Date : 03-09-2020 17:30:32

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n, m;
	cin >> n >> m;

	if(m < n) {
		cout << "No\n";
	} else {
		cout << "Yes\n";
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main() {
    int n,k;
    int ans =0;
    cin >> n >> k;
    vector<int>p(n);
    rep(i,n) cin >> p[i];
    sort(all(p));
    rep(i,k){
        ans += p[i]; 
    }
    cout << ans << endl;

    

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;

int main() {
    string day;
    cin >> day;
    if (day == "SUN") cout << 7 << endl;
    else if (day == "MON") cout << 6 << endl;
    else if (day == "TUE") cout << 5 << endl;
    else if (day == "WED") cout << 4 << endl;
    else if (day == "THU") cout << 3 << endl;
    else if (day == "FRI") cout << 2 << endl;
    else cout << 1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){
  string s;
  cin>>s;
  int n=s.size();
  vector<int> v(n+1);
  v[0]=0;
  map<int,vector<int> > m;
  m[0].push_back(-1);
  m[0].push_back(0);
  for(int i=0;i<n;i++){
    v[i+1]=v[i]^(1<<(s[i]-'a'));
    if(m[v[i+1]].empty()) m[v[i+1]].push_back(-1);
    m[v[i+1]].push_back(i+1);
  }
  //cout<<bitset<26>(v[n])<<endl;
  vector<int> dp(n+1,1<<28);
  map<int,int> mm;
  dp[0]=0;
  for(int i=0;i<n;i++){
    int b=v[i];
    //cout<<i<<":"<<dp[i]<<" "<<bitset<26>(b)<<endl;
    if(!mm.count(b)) mm[b]=dp[i];
    for(int j=0;j<26;j++){
      b^=(1<<j);
      if(mm.count(b)) dp[i]=min(dp[i],mm[b]+1);
      b^=(1<<j);
    }
    
    dp[i+1]=min(dp[i+1],dp[i]+1);
    dp[m[b].back()]=min(dp[m[b].back()],dp[i]+1);
    for(int j=0;j<26;j++){
      b^=(1<<j);
      //if(m.count(b)) cout<<i<<":"<<bitset<26>(b)<<" "<<m[b].back()<<endl;
      //cout<<v[i]<<" "<<b<<endl;
      if(m.count(b)){
	auto latte=--m[b].end();
	int cnt=4;
	while(cnt--&&*latte>i){
	  dp[*latte]=min(dp[*latte],dp[i]+1);
	}
      }
      b^=(1<<j);
    }
  }
  cout<<dp[n]<<endl;
  return 0;
}


Measured memory_bytes: 33284
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#define nmax_def 110000
#define Cmax_def 2200
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

int main() {
	int N;
	cin >> N;
	vi d(N);
	rep(i, N) {
		cin >> d[i];
	}
	ll ans = 0;
	rep(i, N) {
		rep(j, N) {
			if (i > j) {
				ans += d[i] * d[j];
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int H;
    int W;
    int i,j;
    cin >> H;
    cin >> W;
    char data_in[H][W];

//input
    for(i=0 ; i<=H-1 ; i++){
        for(j=0 ; j<=W-1 ; j++){
            cin >> data_in[i][j];
        }
    }

//output
    for(i=0 ; i<=H+1 ; i++){
        for(j=0 ; j<=W+1 ; j++){
            if(i==0 || i==H+1 || j==0 || j==W+1){
                cout << "#";
            }else{
                cout << data_in[i-1][j-1];
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T>() -> T
    where T: std::str::FromStr {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let k: usize = input();
    let mut abs: Vec<(i32, usize)> =
        (0..n).map(|_| (input(), input())).collect();
    abs.sort_by_key(|c| c.0);
    let mut sum: usize = 0;
    for ab in abs.iter() {
        if sum + ab.1 >= k {
            println!("{}", ab.0);
            return;
        } else {
            sum += ab.1
        }
    }
}

Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);cout.precision(20);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) (upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X))
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')
#define pow2(x) ((long long)((long long)1<<x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const long long dy9[] = {0,1,1,1,0,-1,-1,-1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* liblary */



/* main */

signed main(){
    ll N,A,B;
    cin >> N >> A >> B;
    cout << min(A*N,B) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int sum[33];

int main()
{
    int n, m;
    cin>>n>>m;
    REP(i,n) {
        int k;
         cin>>k;
         REP(j,k) {
             int a;
             cin>>a;
             sum[a-1]++;
         }
    }
    int ans = 0;
    REP(i,m) {
        if (sum[i] == n)
            ans++;
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    char str[n + 1];
    scanf("%s",str);
    if(n % 2 == 1){
        printf("No");
        return 0;
    }else{
        for(int i = 0;i < (n / 2);i++){
            if(str[i] != str[i + (n / 2)]){
                printf("No");
                return 0;
            }
        }
    }
    printf("Yes");
    return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <map>
using namespace std;
const int maxn = 1e5 + 10;
map<pair<int,int>,int> ans;
vector<int> edge[maxn];
priority_queue<int,vector<int>,greater<int> > q[maxn];
priority_queue<int,vector<int>,less<int> > Q[maxn];
int n,a[maxn],b[maxn],Max;
inline void dfs(int now,int fa) {
	for (size_t i = 0;i < edge[now].size();i++) {
		int to = edge[now][i];
		if (to ^ fa) {
			int val = 0;
			if (q[now].size()) val = q[now].top()-1;
			else val = 1;
			if (!val) val = Q[now].top()+1;
			Max = max(Max,val);
			q[now].push(val);
			q[to].push(val);
			Q[now].push(val);
			Q[to].push(val);
			ans[make_pair(now,to)] = val;
			ans[make_pair(to,now)] = val;
			dfs(to,now);
		}
	}
}
signed main() {
	scanf("%d",&n);
	for (int i = 1;i < n;i++) {
		scanf("%d%d",&a[i],&b[i]);
		edge[a[i]].push_back(b[i]);
		edge[b[i]].push_back(a[i]);
	}
	dfs(1,0);
	printf("%d\n",Max);
	for (int i = 1;i < n;i++) printf("%d\n",ans[make_pair(a[i],b[i])]);
	return 0;
}

Measured memory_bytes: 32000
#include <stdio.h>

void sort(int *a,int n)
{
        int i,j,index,max;
        for(i=0;i<n;i++){
                max=a[i];index=i;
                for(j=i+1;j<n;j++)
                        if(max<a[j]){
                                max=a[j];index=j;
                        }
                a[index]=a[i];a[i]=max;
        }
        return ;
}
int main(void)
{
        int k,n,i,s=0;
        scanf("%d%d",&n,&k);
        int l[n];
        for(i=0;i<n;i++)
                scanf("%d",&l[i]);
        sort(l,n);
        for(i=0;i<k;i++)
                s+=l[i];
        printf("%d\n",s);
        return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(register int i = a; i <= b; i++)
#define per(i, a, b) for(register int i = a; i >= b; i--)
typedef long long LL;
const LL mod = 1e9 + 7;
const int N = 605;

int n, a, b, c1[N][N], c2[N][N];
struct node {
	int x, y;
};
vector <node> v1, v2, vec[4];

void Dfs(int x, int y, int last, int c) {
	if(c == 1) {
		c1[x][y] = 1 - last;
		rep(i, 0, (int) v1.size() - 1) {
			int nx = x + v1[i].x, ny = y + v1[i].y;
			if(0 <= nx && nx < 2*n && 0 <= ny && ny < 2*n) {
				if(c1[nx][ny] != -1) continue;
				Dfs(nx, ny, 1 - last, c);
			}
		}
	}
	else {
		c2[x][y] = 1 - last;
		rep(i, 0, (int) v2.size() - 1) {
			int nx = x + v2[i].x, ny = y + v2[i].y;
			if(0 <= nx && nx < 2*n && 0 <= ny && ny < 2*n) {
				if(c2[nx][ny] != -1) continue;
				Dfs(nx, ny, 1 - last, c);
			}
		}
	}
}

int main() {
	cin>>n>>a>>b;
	rep(i, 0, (int) sqrt(a)) {
		int j = sqrt(a - i*i);
		if(j*j + i*i != a) continue;
		v1.push_back((node) {i, j});
		v1.push_back((node) {i, -j});
		v1.push_back((node) {-i, j});
		v1.push_back((node) {-i, -j});
	}
	rep(i, 0,(int) sqrt(b)) {
		int j = sqrt(b - i*i);
		if(j*j + i*i != b) continue;
		v2.push_back((node) {i, j});
		v2.push_back((node) {i, -j});
		v2.push_back((node) {-i, j});
		v2.push_back((node) {-i, -j});
	}
	memset(c1, -1, sizeof(c1));
	memset(c2, -1, sizeof(c2));
	rep(i, 0, 2*n - 1) 
	    rep(j, 0, 2*n - 1) {
	    	if(c1[i][j] == -1) 
	    		Dfs(i, j, 0, 1);
	    	if(c2[i][j] == -1)
	    		Dfs(i, j, 0, 2);
	    	int cur = c1[i][j] + c2[i][j]*2;
	    	vec[cur].push_back((node) {i, j});
	    }
	rep(i, 0, 3) 
		if(vec[i].size() >= n*n) {
			rep(j, 0, n*n - 1) 
			    cout<<vec[i][j].x<<" "<<vec[i][j].y<<endl;
			return 0;
		}
}

Measured memory_bytes: 37316
// AtCoder ABC113: C - ID
// 2020.1.29 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef long long ll;

#if 0
int getchar_unlocked(void);
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

typedef struct { int id; ll n; int p, x; } T;
T t[100005]; int M;

void Usort(T *a, int n) {
	int i, k;
#define B 8
#define BMSK 255 // (1<<8)-1
	ll t1[1 << B], t2[1 << B];
	
	T *tmp = malloc(n * sizeof(T));	
	for (k = 0; k < 8; ++k) {  // for 64ビット
		memset(t1, 0, sizeof(t1)), memset(t2, 0, sizeof(t2));
		for (i = 0; i < n; ++i)	t1[(a[i].n >> k*B) & BMSK]++;
		for (i = 0; i < BMSK; ++i) t1[i+1] += t1[i];
		i = n; while (i--) tmp[--t1[(a[i].n >> k*B) & BMSK]] = a[i];
		k++;
		for (i = 0; i < n; ++i) t2[(tmp[i].n >> k*B) & BMSK]++;
		for (i = 0; i < BMSK; ++i) t2[i+1] += t2[i];
		i = n; while (i--) a[--t2[(tmp[i].n >> k*B) & BMSK]] = tmp[i];
	}
	free(tmp);
// for (i = 0; i < n; ++i) printf("[%d] %lld\n", i, a[i]);
}

void Usort2(T *a, int n) {
	int i, k;
#define B 8
#define BMSK 255 // (1<<8)-1
	int t1[1 << B], t2[1 << B];
	
	T *tmp = malloc(n * sizeof(T));	
	for (k = 0; k < 8; ++k) {  // for 64ビット
		memset(t1, 0, sizeof(t1)), memset(t2, 0, sizeof(t2));
		for (i = 0; i < n; ++i)	t1[(a[i].id >> k*B) & BMSK]++;
		for (i = 0; i < BMSK; ++i) t1[i+1] += t1[i];
		i = n; while (i--) tmp[--t1[(a[i].id >> k*B) & BMSK]] = a[i];
		k++;
		for (i = 0; i < n; ++i) t2[(tmp[i].id >> k*B) & BMSK]++;
		for (i = 0; i < BMSK; ++i) t2[i+1] += t2[i];
		i = n; while (i--) a[--t2[(tmp[i].id >> k*B) & BMSK]] = tmp[i];
	}
	free(tmp);
// for (i = 0; i < n; ++i) printf("[%d] %lld\n", i, a[i]);
}
int main()
{
	int i, N, P, Y;
	
	N = in(), M = in();
	for (i = 1; i <= M; ++i) {
		P = in(), Y = in();
		t[i].id = i, t[i].n = ((ll)P << 32) | Y, t[i].p = P;
	}
	Usort(t+1, M);
	for (i = 1; i <= M; ++i) {
		if (t[i].p != t[i-1].p) t[i].x = 1;
		else t[i].x = t[i-1].x+1;
	}
	Usort2(t+1, M);
	for (i = 1; i <= M; ++i) printf("%06d%06d\n", t[i].p, t[i].x);
	return 0;
}


Measured memory_bytes: 6232
// AOJ 2321: Butterfly
// 2017.10.7 bal4u@uu

#include <stdio.h>
#include <string.h>

int dp[65536+2];  
  
int main()  
{  
	int n, m, l, i, j, k, s, e, ans, a;  

	while (scanf("%d", &n) && n > 0) {
		memset(dp, 0, sizeof(dp));
		for (i = 0; i < n; i++) {
			scanf("%d%d", &m, &l);
            for (a = 0, j = 0; j < m; j++) {
				scanf("%d%d", &s, &e); s -= 6; e -= 6;  
                for (k = s; k < e; k++) a |= 1 << k;  
            }  
			for (ans = 0, j = 0; j < 65536; j++) {   // 65536 = 1 << 16  
                if (!(j & a)) {  
                    int x = j | a;
					if (dp[x] < dp[j]+l) dp[x] = dp[j]+l;
					if (ans < dp[x]) ans = dp[x];  
                }
            }
        }
        printf("%d\n",ans);  
    }  
    return 0;  
}  

Measured memory_bytes: 2000
/*
  AOJ 2527
  Title:MLE
  @kankichi573
*/
#include <stdio.h>
#include <string.h>

int division[256];
long long memo[625*625*4]; // 10^8/256*4
int x0,n,k;

long long next_rand(unsigned long long int x)
{
  x ^= x << 13;
  x ^= x >> 7;
  x ^= x << 17;
  return(x);
}

int div(long long x,int nbits)
{
  int y,mask;
  mask = (1<<nbits)-1;
  y = x >> (64-nbits);
  return(y & mask);
}
int compare_ll(const void *a, const void *b)
{
  if( *(long long *)a > *(long long *)b)
    return(1);
  if( *(long long *)a < *(long long *)b)
    return(-1);
  if( *(long long *)a > *(long long *)b)
    return(0);
}
main()
{
  int i,i1,j,d,dv,mask;
  long long x;

  scanf("%d %d %d\n",&n,&k,&x0);
  memset(division,0,sizeof(division));
  memset(memo    ,0,sizeof(memo));

  if(x0==0)
    {
      printf("0\n");
      return(0);
    }

  for(i=0,x=x0;i<n;i++)
    {
      //printf("%lld:",x);
      d=div(x,8);
      division[d]++;
      x=next_rand(x);
    }
  k--;
  for(i=-128;i<127;i++)
    {
      i1=i;
      if(i1<0)
	i1+=256;
      dv=division[i1];

      if(k<dv)
	{
	  mask=i1;
	  break;
	}
      k -= dv;
    }
  //printf("div=%d k=%d\n",mask,k);
  for(i=j=0,x=x0;i<n;i++)
    {
      d=div(x,8);
      if(d==mask)
	{
	  memo[j]=x;
	  j++;
	}
      x=next_rand(x);
    }
  qsort(memo,j,sizeof(long long),compare_ll);
  printf("%lld\n",memo[k]);
  return(0);
}

Measured memory_bytes: 15728
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	fmt.Println((nextInt() - 1) / 2)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#define SIZE 2000010
#define rep(i, a, b) for (long long i = a; i <= b; ++i)
#define ll long long
#define mp make_pair
#define pi acos(-1.0)
#define eps 1e-9
using namespace std;
void io() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }
ll n, m, x, cnt, k, ans, q;
const ll mod = 1e9 + 7;

ll pre[SIZE], inv[SIZE];
ll qpow(ll a, ll b, ll mod) { //快速幂 a ^ b % mod
	ll ans = 1;
	while (b) {
		if (b & 1) ans = (ans * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return ans;
}

void init(int n) { // 预处理阶乘和阶乘逆元
	pre[0] = pre[1] = 1;
	rep(i, 2, n) pre[i] = 1ll * i * pre[i - 1] % mod;
	inv[n] = qpow(pre[n], mod - 2ll, mod) % mod; inv[0] = 1;
	for (ll i = n; i; --i) inv[i - 1] = inv[i] * i % mod;
}

ll C(ll n, ll m) { // 求组合数 nCm
	return pre[n] * inv[n - m] % mod * inv[m] % mod;
}
int main() {
	io(); cin >> k >> q;
	vector<ll> d(k);
	rep(i, 0, (k - 1)) cin >> d[i];
	while (q--) {
		cin >> n >> x >> m;
		--n; x %= m;
		vector<ll> a = d;
		rep(i, 0, (k - 1)) a[i] %= m;
		rep(i, 1, (k - 1)) a[i] += a[i - 1];
		vector<ll> b(k);
		rep(i, 0, (k - 1)) b[i] = d[i] % m == 0;
		rep(i, 1, (k - 1)) b[i] += b[i - 1];
		ll sum = x + a[k - 1] * (n / k) + (n % k ? a[n % k - 1] : 0);
		ll ans = n - sum / m - (n / k) * b[k - 1] - (n % k ? b[n % k - 1] : 0);
		cout << ans << '\n';
	}
}

Measured memory_bytes: 384
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
#include <set>
using namespace std;

int main()
{
  int X;
  cin >> X;
  int res = 0;
  while (X > 0) {
    res ++;
    X -= res;
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n,m,ans=1;
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>m;
        ans*=(m%2==0);
    }
    if(ans)cout<<"second"<<endl;
    else cout<<"first"<<endl;
}


Measured memory_bytes: 256
def avg(data,n)
  sum = 0
  data.each do |d|
    sum = sum + d
  end
  (sum/n).to_f
end

def variance (data,n)
  sum_v = 0
  m = avg(data,n)
  data.each do |s|
    sum_v = sum_v + (s-m)**2
  end
  (sum_v/n).to_f
end

def stdev (data,n)
  Math.sqrt(variance(data,n))
end

while true
  n = gets.to_i
  break if (n==0)
  data = gets.split().map(&:to_f)
  printf("%0.9f\n", stdev(data, n))
end

Measured memory_bytes: 8716
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG_OUTPUT
#define DEBUG_LOG(s) cout << s << endl;
#else
#define DEBUG_LOG(s) void();
#endif

int t = 1;
vector<vector<bool>> g;
vector<int> d;
vector<int> f;

void dfs(const int s) {
    if(d[s] != -1) return;
    d[s] = t++;

    for (auto i = 0; i < (int)g[s].size(); i++) {
        if(g[s][i]) dfs(i);
    }

    f[s] = t++;
}

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

    g.assign(n, vector<bool>(n, false));
    for (auto i = 0; i < n; i++) {
        int u, k; cin >> u >> k;
        for (auto j = 0; j < k; j++) {
            int v; cin >> v;
            g[u - 1][v - 1] = true;
        }
    }

    d.assign(n, -1);
    f.assign(n, -1);
    for (auto i = 0; i < n; i++) {
        if(d[i] == -1) dfs(i);
    }

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

    return 0;
}


Measured memory_bytes: 3140
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

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

	ll N, aim ;
	cin >> N >> aim;

	vector<pair<ll,ll>> prbm;

	rep(i,N){
		ll num, bonus;
		cin >> num >> bonus;
		prbm.pb(mp(num, bonus));
	}

	ll ans = 10000;
	rep(i, (1<<N)){
		ll score = 0;
		ll ret = 0;
		ll rest_max = -1;

		rep(j, N){
			// all solved
			if(i & (1<<j)){
				score += prbm[j].second + prbm[j].first * (j+1)*100;
				ret += prbm[j].first;
			}
			else{
				rest_max = j;// renew some solved
			}
		}
		// some solved
		ll rest_score = aim-score;
		ll rest_max_score = (rest_max+1) * 100;


		if(rest_score > 0){
			ll a = rest_score / rest_max_score + ((rest_score%rest_max_score) != 0);
			if(a >= prbm[rest_max].first) continue;
			else ret += a;
		}

		ans = min(ret, ans);


	}



	cout << ans << endl;

	//cout << fixed << setprecision(16) << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <vector>
#include <climits>

typedef long long ll;

using namespace std;

void solve(){
    int h, w;
    while(cin >> h >> w){
        if(h == 0 && w == 0){
            return;
        }
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                if(i == 0 || i == h-1 || j == 0 || j == w-1){
                    printf("#");
                }else{
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
}

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

Measured memory_bytes: 3044
#include<bits/stdc++.h>
#define int long long

using namespace std;

const int maxn = 200010, mod = 1000000007;
int n, m;
int tem, cnt[maxn] = {0};

int read()
{
  int x = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * w;
}

inline void write(int x)
{
  static int sta[35];
  int top = 0;
  do {
    sta[top++] = x % 10, x /= 10;
  } while (x);
  while (top) putchar(sta[-- top] + 48);
}

signed main()
{
	n = read();
	m = read();
	if(n + 1 == m) {
		cout<<1;
		return 0;
	}
	int ans = n + 2;
	for(int i = m; i < n; i ++) {
		ans += ((n + (n - i + 1)) * i) / 2 - (((i - 1) * i) / 2) + 1;
		ans %= mod;
	}
	write(ans);
	return 0;
}

Measured memory_bytes: 3616
use proconio::input;
#[allow(unused_imports)]
use std::collections::HashSet;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

type pair = (usize, usize);

// max = (n-1)(n-2)/2
fn main() {
    input! {
        n: usize,
        k: usize,
    }
    let answer = solve(n, k);
    if !answer.0 {
        println!("-1");
        return;
    }
    println!("{}", answer.1);
    for p in answer.2 {
        println!("{} {}", p.0, p.1);
    }
}

fn solve(n: usize, k: usize) -> (bool, usize, Vec<pair>) {
    let mut v = Vec::<pair>::with_capacity(n);
    let max = (n - 1) * (n - 2) / 2;
    //println!("XXX max={}", max);
    if k > max {
        return (false, 0, v);
    }

    // base
    // assume node n is center
    for i in 1..n {
        let p = (i, n);
        v.push(p);
    }

    let delta = max - k;
    //println!("XXX delta={}", delta);
    if delta == 0 {
        return (true, n - 1, v);
    }

    // additional
    let mut count = 0;
    for i in 1..n - 1 {
        for j in i + 1..n {
            let p = (i, j);
            v.push(p);
            count += 1;
            if count == delta {
                return (true, n - 1 + delta, v);
            }
        }
    }

    return (true, n - 1 + delta, v);
}


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

using namespace std;

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

int n;
vector<int> a(50);

int solve(int i, int m) {
    if (m == 0) return 1;
    if (i >= n || m < 0) return 0;

    int res = solve(i + 1, m) || solve(i + 1, m - a[i]);
    return res;
}

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

    cin >> n;
    REP(i, n) cin >> a[i];
    a.resize(n);
    int q;
    cin >> q;
    REP(i, q) {
        int m;
        cin >> m;
        cout << (solve(0, m) ? "yes" : "no") << endl;
    }
    return 0;
}



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

using namespace std;

int main()
{

    int N, M;
    cin >> N >> M;

    int assignment = 0;

    for (int i = 1; i <= M; i++){
       int A; cin >> A;
       assignment +=A;
    }
    if (assignment <= N){
        cout << N - assignment << "\n";
    }
    else cout << "-1\n";

    return 0;
}


Measured memory_bytes: 3548
using System;
using AtCorder;

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve();
        }

        public void Solve()
        {
            var input1 = int.Parse(Console.ReadLine());
            var input2 = int.Parse(Console.ReadLine());
            Console.WriteLine(6 - input1 - input2);
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int N,A[100],max=0;


  scanf("%d",&N);
  for(int i=0;i<N;i++){
    scanf("%d",&A[i]);
    if(max<A[i]){
      max=A[i];
    }
  }
  int min=A[0];

  for(int i=0;i<N;i++){
    if(min>A[i]){
      min=A[i];
    }
  }

  int ans=max-min;
  printf("%d",ans);

  
  
}

Measured memory_bytes: 256
// luogu-judger-enable-o2
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	char a[105];
	scanf("%s",a);
	for(int i=0;i<strlen(a);i++)
		if(a[i]=='C')
			for(int j=i;j<strlen(a);j++)
				if(a[j]=='F'){printf("Yes");return 0;}
	printf("No");
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [int(input()) for _ in range(n)]

now = 0
visited = set()
ans = 0
while True:
    if now in visited:
        print(-1)
        exit()
    if now == 1:
        print(ans)
        exit()
    visited.add(now)
    now = a[now] - 1
    ans += 1

Measured memory_bytes: 16008
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

typedef long long ll;
const int MOD = 1000000007;


// 二項係数ライブラリ Binomial coefficient
// constexpr: constant expression 定数式
template<class T> struct BiCoef {

    vector<T> fact_, inv_, finv_;
    constexpr BiCoef() {}
//    constexpr BiCoef(int n) noexcept : fact_(n, 1), inv_(n, 1), finv_(n, 1) 
    constexpr BiCoef(int n)
    {
        init(n);
    }
    constexpr void init(int n) noexcept 
    {
        fact_.assign(n,1),inv_.assign(n,1),finv_.assign(n,1);
        //int MOD = fact_[0].getmod();
        for(int i = 2; i < n; ++i)
        {
            //累積積
            fact_[i] = fact_[i-1] * i % MOD;
            //- をつける?
            inv_[i] = MOD - inv_[MOD%i] * (MOD/i) % MOD;
            finv_[i] = finv_[i-1] * inv_[i] % MOD;
        }
    }

    //nCk = n! * (n-k)!^-1 * k!^-1
    //nCk = n! / ((n-k)! * k!)
    constexpr T com(int n, int k) const noexcept {
        if (n < k || n < 0 || k < 0) return 0;
        return fact_[n] * (finv_[k] * finv_[n-k] % MOD) % MOD;
    }

};

BiCoef<ll> bc;

int main() {
    int N, K; 
    cin >> N >> K;
    bc.init(110000); // 二項係数ライブラリを初期化

    // 求める
    for (int k = 1; k <= K; ++k)
    {
        ll res = bc.com(K-1, k-1) * bc.com(N-K+1, k) % MOD;
        cout << res << endl;
    }
}



Measured memory_bytes: 2816
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Debug.Trace
import Data.List
import Control.Monad
import Control.Arrow
import Data.Ord
import qualified Data.IntSet as IS


r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine



main :: IO ()
main = do
    [n,k] <- r'
    ass <- replicateM k (do
            d <- readLn :: IO Int
            as <- r'
            return $ IS.fromList as
        )
    let allSunuke = IS.fromList [1..n]
    let safeSunuke = IS.unions ass
    print $ IS.size $ IS.difference allSunuke safeSunuke


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int l, r, d;
  cin>>l>>r>>d;
  int ans=0;
  FOR(i, l, r+1){
    if(i%d==0){
      ++ans;
    }
  }
  cout<<ans<<'\n';
  return 0;
}


Measured memory_bytes: 3636
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let mut n = vec![0;4];
    for (i,s) in iter.next().unwrap().chars().enumerate(){
        n[i] = (s as u8 - b'0') as i8;
    }
    'outer: for o1 in 0..2{
        let p1 = (o1 as i8)*2-1;
        for o2 in 0..2{
            let p2 = (o2 as i8)*2-1;
            for o3 in 0..2{
                let p3 = (o3 as i8)*2-1;
                if n[0]+n[1]*p1+n[2]*p2+n[3]*p3 == 7 {
                    println!("{}{}{}{}{}{}{}=7",n[0],
                            vec!["-","+"][o1],n[1],
                            vec!["-","+"][o2],n[2],
                            vec!["-","+"][o3],n[3]);
                    break 'outer
                }
            }
        }
    }
}


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

using namespace std;

int main(){
  long long int N;
  cin >> N;
  vector<long long int> h(N);
  vector<long long int> cost(N);
  for(int i=0; i < N; ++i){
    cin >> h[i];
  }

  cost[0] = 0;
  long long int skip_1_cost;
  long long int skip_2_cost;
  for(int i=1; i < N; ++i){
    skip_1_cost = abs(h[i-1]-h[i]) + cost[i-1];
    if(i >= 2){
      skip_2_cost = abs(h[i-2]-h[i]) + cost[i-2];
      cost[i] = min(skip_1_cost, skip_2_cost);
    }else{
      cost[i] = skip_1_cost;
    }
  }
  cout << cost[N-1] << endl;
  return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>

int main(void){

    int N;
    int F = 4,S = 7, T = 0;
    int flag = 0;
    int i, j,h;

    scanf("%d", &N);
    //for(h = 1; h < 101; h++){
        //N = h;
        flag = 0;
        T = 0;
        if(flag == 0 && N >= 4){
            for(i = 1; T <= 100 ; i++){
                T = F * i;
                //printf("F = %d\n", T);
                if(N == T){
                    flag = 1;
                    break;
                }
            }
        }
        T = 0;
        if(flag == 0 && N >= 7){
            for(i = 1; T <= 100 ; i++){
                T = S * i;
                //printf("S = %d\n", T);
                if(N == T){
                    flag = 1;
                    break;
                }
            }
        }
        T = 0;
        if(flag == 0 && N >= 11){
            for(i = 1; i < 15 ;i++){
                if(flag == 0){
                    for(j = 1; T <= 100 ; j++){
                        T = F * j + S * i; 
                        //printf("%d %d\n", N, T);
                        if(N == T){
                            flag = 1;
                            break;
                        }else if(N < T){
                            //flag = 2;
                            break;
                        }
                    }
                }else{
                    break;
                }
                T = 0;
            }
        }
        if(flag == 1){
            printf("Yes\n");
            //printf("%d = Yes\n",h);
        }else{
            printf("No\n");
            //printf("%d = No\n", h);
        }
   //}
}

Measured memory_bytes: 128
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
#define ll long long
const int MAXN=100000+10;
ll n,A[MAXN],ans;
inline void read(ll &x)
{
	ll data=0,w=1;
	char ch=0;
	while(ch!='-'&&(ch<'0'||ch>'9'))ch=getchar();
	if(ch=='-')w=-1,ch=getchar();
	while(ch>='0'&&ch<='9')data=(data<<3)+(data<<1)+(ch^'0'),ch=getchar();
	x=data*w;
}
inline int comp(const ll a,const ll b)
{
	return a>b;
}
int main()
{
	read(n);
	for(register int i=1;i<=n;++i)read(A[i]);
	sort(A+1,A+n+1,comp);
	for(register int i=1;i<n;++i)
		if(A[i]==A[i+1])
			if(ans)
			{
				ans*=A[i];
				printf("%lld\n",ans);
				return 0;
			}
			else ans=A[i],i++;
	printf("0\n");
	return 0;
}

Measured memory_bytes: 1024
n,m=map(int,input().split())
a=[]
b=[]
for _ in range(n):
    a.append(list(input()))

for _ in range(m):
    b.append(list(input()))

d=0
r=0
while d<n-m+1 :
    for r in range(n-m+1):
        flg=0
        for i in range(m):
            for j in range(m):
                s=a[i+d][j+r]
                t=b[i][j]
                if s==t:
                    continue
                else:
                    flg+=1
        
        if flg==0:
            print('Yes')
            exit(0)

    d+=1


print('No')

Measured memory_bytes: 9092
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
typedef long double lb; 

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

ll adjust(ll num){
    while (num % 10 != 0){
        num++;
    }
    return num;
}

int main() {
    ll A,B,C,D,E;
    vector<ll> ryouri(5);
    rep(i,5){
        cin >> ryouri[i];
    }

    ll ans=LLONG_MAX;

    do{
        ll a = adjust(ryouri[0]);
        ll b = adjust(a+ryouri[1]);
        ll c = adjust(b+ryouri[2]);
        ll d = adjust(c+ryouri[3]);
        ll result = d + ryouri[4];
        ans = min(ans,result);

    }while(next_permutation(ryouri.begin(),ryouri.end()));//辞書順で次の順列が存在すれば真

    cout << ans << endl;

}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
double wa(double k){
  double ret=0;
  for(double i=1;i<=k;i++){
    ret+=i;
  }
  return ret;
}

int main(){
  int N, K; cin >> N >> K;
  vector<double> p(N);
  double v=0;
  for(int i=0;i<N;i++){
    cin >> p[i];
    if(i<K){
      v+=p[i];
    }
  }
  vector<int> A(N);
  A[K-1]=v;
  int MAX=v;
  int now=0;
  if(N!=K){
    for(int i=K;i<N;i++){
      A[i]=A[i-1]-p[i-K]+p[i];
      if(MAX<A[i]){
        now=i-K+1;
        MAX=A[i];
      }
    }
  }
  double ans=0;
  for(int i=0;i<K;i++){
    ans=ans+wa(p[now+i])/p[now+i];
  }
  cout << fixed << setprecision(10);
  cout << ans <<endl;
  return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define MIN(a,b) ((a) <= (b) ? (a) : (b))
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort( ALL(v) )

using namespace std;
using ll = long long;
using P = pair<int,int>;

int arr[1000000]{};
int main()
{

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

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

        int cum_sum[n+1]{};
        for(int i = 1 ; i<=n ; i++)
        {
            cum_sum[i] = cum_sum[i-1] + arr[i-1];
        }

        int maxIdx = k;
        int maxVal = 0 ;
        for(int i = k ; i<=n ; i++)
        {
            if(cum_sum[i]-cum_sum[i-k] >=maxVal)
            {
                maxIdx=i;
                maxVal = cum_sum[i] - cum_sum[i-k];
            }
        }

        double maxNum = 0 ;

        for(int i = maxIdx-k ; i<maxIdx ; i++)
        {
            int n2 = arr[i]+1;
            int n1 = arr[i];
            maxNum += (1.0/arr[i])*((n1*n2)/2.0);
        }

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

        cout<<maxNum<<endl;



    return 0;
}


Measured memory_bytes: 1792
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N = I()
H = I()
W = I()

print((N - H + 1) * (N - W + 1))


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

using namespace std;

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

    int a[n];
    for (int i = 0; i < n; ++i) cin >> a[i];
    sort(a, a + n);
    cout << a[n - 1] - a[0] << endl;
}

Measured memory_bytes: 384
package main

import (
	"strings"
	"fmt"
)

func main(){
	var s string
	fmt.Scan(&s)
	if strings.ContainsAny(s,"BDEFGHIJKLMNOPQRSTUVWXYZ"){
		fmt.Println("WA")
	} else {
		if (strings.Count(s,"A") == 1) && strings.Count(s,"C") == 1 {
			if strings.Index(s,"A") == 0 {

				n := strings.Index(s,"C")
				if 2 <= n && n < len(s)-1 {
					fmt.Println("AC")
				} else {
					fmt.Println("WA")
				}
			} else {
				fmt.Println("WA")
			}
		} else {
			fmt.Println("WA")
		}
	}
}

Measured memory_bytes: 640