akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long
signed main(){
  int n;
  cin>>n;
  vector<int> p(n),q(n),a(n),b(n);
  for(auto& i:p)cin>>i,--i;
  for(int i=0;i<n;++i)q[p[i]]=i;
  for(int i=1;i<=n;++i)a[i-1]=b[n-i]=i*(1e9/2e4-10);
  for(int i=0;i<n;++i)cout<<(i?" ":"")<<a[i];
  cout<<"\n";
  for(int i=0;i<n;++i)cout<<(i?" ":"")<<b[i]+q[i];
}

Measured memory_bytes: 1280
import Control.Monad

main = do
  n <- liftM read $ getLine
  ls <- forM [1..n] (\ _ -> getLine)
  putStrLn $ abc109b ls

abc109b ls
  | noDupe ls && connected ls = "Yes"
  | True = "No"

noDupe [] = True
noDupe (x:xs) = null bs && noDupe as && noDupe cs
  where
    (as,bs,cs) = part3 x xs

part3 _ [] = ([],[],[])
part3 p (x:xs) =
  case compare p x of
    LT -> (x:as,bs,cs)
    EQ -> (as,x:bs,cs)
    GT -> (as,bs,x:cs)
  where
    (as,bs,cs) = part3 p xs

connected [] = True
connected xs = and $ zipWith (==) (map last xs) (map head $ tail xs)

Measured memory_bytes: 764
#include<map>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<stack>
#define REP(i,x,y) for(ll i=x;i<y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll>
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define UNIQUE_ARRAY(a,n) n = unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>x;i--)
typedef long long ll;
using namespace std;

int main(){
    string n;
    cin>>n;
    REP(i,0,3){
        if (n.at(i)=='1'){
            n.at(i)='9';
        }
        else if (n.at(i)=='9'){
            n.at(i)='1';
        }
    }
    cout << n << endl;
    
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int r;
  cin >> r;
  cout << r*r << endl;
}

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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

int N,Q;
int x[111],y[111],z[111],r[111],l[111];

const double EPS=1e-9;
double get(int i,double xx,double yy,double zz){
    return sqrt((x[i]-xx)*(x[i]-xx)+(y[i]-yy)*(y[i]-yy)+(z[i]-zz)*(z[i]-zz));
}

void solve(){
    int xx,yy,zz,xxx,yyy,zzz;
    cin>>xx>>yy>>zz>>xxx>>yyy>>zzz;

    int cost=0;
    rep(i,N){
        double lb=0,ub=1;
        rep(loop,100){
            double mid1=(lb*2+ub)/3,mid2=(lb+ub*2)/3;
            double d1=get(i,xx+(xxx-xx)*mid1,yy+(yyy-yy)*mid1,zz+(zzz-zz)*mid1);
            double d2=get(i,xx+(xxx-xx)*mid2,yy+(yyy-yy)*mid2,zz+(zzz-zz)*mid2);
            if(d1>d2)lb=mid1;
            else ub=mid2;
        }
        double d=get(i,xx+(xxx-xx)*lb,yy+(yyy-yy)*lb,zz+(zzz-zz)*lb);
        if(d<r[i]+EPS)cost+=l[i];
    }
    cout<<cost<<endl;
}

signed main(){
    cin>>N>>Q;
    rep(i,N)cin>>x[i]>>y[i]>>z[i]>>r[i]>>l[i];
    while(Q--)solve();
    return 0;
}

Measured memory_bytes: 3112
n=int(input())
a=input()
b=input()
c=input()
ans=0
for j in range(n):
    d=a[j]
    e=b[j]
    f=c[j]
    if d==e and d!=f:
      ans+=1
    elif d==f and d!=e:
      ans+=1
    elif e==f and e!=d:
      ans+=1
    elif d!=e and e!=f and f!=d:
      ans+=2
    
print(ans)
           

Measured memory_bytes: 3064
#define _CRT_NONSTDC_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>

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

using namespace std;
using ll = long long;

template<typename T>
using Matrix = vector<vector<T>>;

int gcd(int a, int b) {
	return b ? gcd(b, a%b) : a;
}

int main() {

	int n;

	cin >> n;

	REP(i, 30) {
		REP(j, 20) {
			int v = i * 4 + j * 7;
			if (v > n) break;
			if (v == n) {
				cout << "Yes" NL;
				return 0;
			}
		}
	}

	cout << "No" NL;

	return 0;

}

Measured memory_bytes: 256
package main

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

var scanner= bufio.NewScanner(os.Stdin)

func main() {
	MAX := 10001
	SQRT := 100
	isPrime := make([]bool, MAX)
	for i :=range isPrime {
		isPrime[i] = true
	}
	for i := 3; i < SQRT; i += 2 {
		if isPrime[i] {
			for j := i*i; j < MAX; j += i {
				isPrime[j] = false
			}
		}
	}
	// log.Println(isPrime)
	tbl := make([]int, MAX)
	ans := 0
	for i := 5; i < MAX; i += 2 {
		if isPrime[i] && isPrime[i-2] {
			ans = i
		}
		tbl[i] = ans
	}
	// log.Println(tbl)
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		if n&1 == 0 {
			n--
		}
		fmt.Printf("%d %d\n", tbl[n]-2, tbl[n])
	}
}


Measured memory_bytes: 1400
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

const int maxN = 1e3 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll gcd(ll a, ll b) {return !b ? a : gcd(b, a % b);}
ll sq(ll x) {return (x * x) % MOD;}
ll modP(ll a, ll b) {return (!b ? 1 : (sq(modP(a, b / 2)) * (b % 2 ? a : 1)) % MOD);}

bool flag[2];
int x[maxN], y[maxN];
vector <int> vec;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n; cin >> n;
	for (int i = 0; i < n; i++){
		cin >> x[i] >> y[i];
		flag[(x[i] + y[i]) % 2] = true;
	}
	if (flag[0] && flag[1]) return cout << -1 << endl, 0;
	if (flag[0]) vec.push_back(1);
	for (int i = 0; i <= 30; i++){
		vec.push_back(1 << (30 - i));
	}
	cout << (int)vec.size() << endl;
	for (auto v : vec) cout << v << " ";
	cout << endl;
	string s;
	for (int i = 0; i < n; i++){
		s = "";
		for (auto v : vec){
			if (abs(x[i]) > abs(y[i])){
				s += (x[i] > 0 ? 'R' : 'L');
				x[i] += v * (x[i] > 0 ? -1 : +1);
			}
			else{
				s += (y[i] > 0 ? 'U' : 'D');
				y[i] += v * (y[i] > 0 ? -1 : +1);
			}
		}
		cout << s << "\n";
	}
	return 0;
}
 



Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	l, _ := strconv.Atoi(sc.Text())
	for i := 0; i < l; i++ {
		sc.Scan()
		s := strings.Split(sc.Text(), " ")
		a, _ := strconv.Atoi(s[0])
		b, _ := strconv.Atoi(s[1])
		c, _ := strconv.Atoi(s[2])

		n := []int{a, b, c}
		sort.Sort(sort.IntSlice(n))

		if square(n[0])+square(n[1]) == square(n[2]) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

func square(x int) int {
	return x * x
}



Measured memory_bytes: 1180
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a=[0]
b=[0]

tmp_a=0
tmp_b=0
for i in A:
    tmp_a+=i
    a.append(tmp_a)

for i in B:
    tmp_b+=i
    b.append(tmp_b)
    

ans,j=0,M
for i in range(N+1):#i…A台の本数
    if a[i]>K:
        break
    while(1):
        if b[j]<=(K-a[i]):
            break
        j-=1
    ans=max(ans,i+j)
    
print(ans)

Measured memory_bytes: 47404
#include<iostream>
#include<vector>
#include<string.h>
using namespace std;
int main(){
	long long int i,uz;
	char dizi[101];
	cin>>uz;
	cin>>dizi;
	if(uz%2==0){
		for(i=0;i<uz/2;i++){
			if(dizi[i]==dizi[uz/2+i]){
				uz=uz*1;
			}
			else{
				cout<<"No";
				return 0;
			}
		}
		cout<<"Yes";
		return 0;
	}
	else{
		cout<<"No";
		return 0;
	}
}


Measured memory_bytes: 764
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		BufferedReader br =
        new BufferedReader(new InputStreamReader(System.in));
        
        String line = br.readLine();
		String ans = "";
        
    	for (int i = 0; i < line.length(); i++) {
    		String s = line.substring(i, i+1);
    		if (s.equals(s.toUpperCase())) {
    			ans += s.toLowerCase();
    		}
    		else {
    			ans += s.toUpperCase();
    		}
    	}   
    	
    	System.out.println(ans);
	}
}

Measured memory_bytes: 24096
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	fmt.Println(resolve(parseProblem()))
}

func parseProblem() int {
	n := scanInt(sc)
	as := nextIntSlice(sc, n)
	pairNum := 0
	for i := 0; i < len(as); i++ {
		if as[as[i]-1]-1 == i {
			pairNum++
		}
	}
	// pairs are counted 2 times.
	return pairNum >> 1
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	a, _ := strconv.Atoi(sc.Text())
	return int(a)
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextIntSlice(sc *bufio.Scanner, n int) (a []int) {

	a = make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt(sc)
	}
	return a
}

func resolve(n int) int {
	return n
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 3240
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            var rl = RL();
            //var sprlst = spr(rl);
            //var intlist = sprlst.Select(x => c2i(x)).ToList();
            var k = c2i(rl);
            //var ls1 = Enumerable.Range(0, 10).Select(x => (long)x);
 
            bool ret = false;
            int cy = 7;
            if (k % 10 == cy) ret = true;
            if ((k / 10) % 10 == cy) ret = true;
            if ((k / 100) % 10 == cy) ret = true;
 
 
            Console.WriteLine(bool2ret(ret));
           // Console.ReadLine();
            
 
 
 
 
        
        }
        static string RL() { return Console.ReadLine().Trim(); }
        static IEnumerable<string> spr(string s) { return s.Split(' '); }
        static Int64 c2i(string c) { return Int64.Parse(c); }
        //static double c2d(string c) { return double.Parse(c); }
        static string bool2ret(bool b) { return b ? "Yes" : "No"; }
    }
}

Measured memory_bytes: 27484
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  std::vector<int> v;
  std::vector<int> v2;
  int n,tmp;
  std::cin >> n;
  for (int i = 0; i < n; i++) {
    std::cin >> tmp;
    v.push_back(tmp);
    v2.push_back(tmp);
  }
  sort(v.begin(),v.end());
  int cnt=0;
  for (int i = 0; i < n; i++) {
    if(v[i]!=v2[i])cnt++;
  }
  if(cnt<=2)std::cout << "YES" << '\n';
  else std::cout << "NO" << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
 
int main(){
   
  int e;

  while(cin>>e, e){
    int mi=1000000;
    for(int z=0;z*z*z<=e;z++){
      for(int y=0;z*z*z+y*y<=e;y++){
	int x=e-(z*z*z+y*y);
	mi=min(mi, x+y+z);
      }
    }
    cout<<mi<<endl;
  }
   
  return 0;
}

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

using namespace std;
#define ll long long
#define ld long double

#define endl '\n'
#define FAST                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int MAXN = 1e5 + 5;
ll fastPow(ll x, ll b)
{
    if (b == 0)
        return 1;
    else if (!(b & 1))
    {
        return fastPow(x * x, b / 2);
    }
    else
        return x * fastPow(x * x, (b - 1) / 2);
}
//__builtin_popcount ();
struct def
{
    string h = ">";
};
int main()
{
    FAST
        ll a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    ll mn = INT_MAX;
    for (ll i = 0; i < max(x, y) + 1;i++)
    {
        mn = min(mn, (2 * c * i) + (a * max((ll)0, x - i)) + (b * max((ll)0, y - i)));
    }
    cout << mn << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < (int)vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

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

	int N, A;
	cin >> N >> A;

	cout << N * N - A << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;



int main() {
    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    ll n;
    cin >> n;
    ll a[5];
    for (int i = 0; i < 5; i++) {
        cin >> a[i];
    }

    ll ans, m = LONG_LONG_MAX;
    for (int i = 0; i < 5; i++) {
        m = min(m, a[i]);
        ans = ceil((double) n / m) + i;
    }

    cout << ans;




}




Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#define endl "\n"
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const ll mod = 998244353;
template<class T> inline void fix(T &x) {if(x >= mod | x <= -mod) {x %= mod;} if(x < 0) {x += mod;}}
#define out(x) cout << __LINE__ << ": " << (#x) << " = " << (x) << endl
  
const ll MAX_N = 1e6 + 10;
ll pref[MAX_N];

ll sum(ll l, ll r) {
	if(r <= 0) {
		return 0;
	} else if(l <= 0) {
		return pref[r];
	}
	return (pref[r] - pref[l - 1] + mod) % mod;
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n, k;
    vector<pair<ll, ll> > arr;
    cin >> n >> k;
    arr.resize(k);
    for(ll i = 0; i < k; i ++) {
    	cin >> arr[i].first >> arr[i].second;
    }
    pref[0] = 0;
    pref[1] = 1;
    for(ll i = 2; i <= n; i ++) {
    	ll curr = 0;
    	for(ll j = 0; j < k ; j ++) {
    		curr = (curr + sum(i - arr[j].second, i - arr[j].first)) % mod;
    	}
    	pref[i] = (pref[i - 1] + curr) % mod;
    }
    cout << (pref[n] - pref[n - 1] + mod) % mod;
    return 0;
}


Measured memory_bytes: 5168
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		long MOD = 1000000007;
		if(Math.abs(N-M)>=2){
			System.out.println("0");
			return;
		}
		
		long ans = 1;
		for(long i=2; i<=N; ++i){
			ans *= i;
			ans %= MOD;
		}
		for(long i=2; i<=M; ++i){
			ans *= i;
			ans %= MOD;
		}
		
		if(Math.abs(N-M)==0){
			ans*=2;
			if(ans>=MOD) ans -= MOD;
		}
		
		System.out.println(ans);
		return;
	}
}

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

using ll = long long;
const int INF = 1e9 + 1;

int main(){

	int K, X;
	cin >> K >> X;

	if (K * 500 >= X)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

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

int main() {
    // エラトステネスのふるい
    int MAX = 101010;
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0, is_prime[1] = 0;
    for (int i = 2; i < MAX; ++i) {
        if (!is_prime[i]) continue;
        for (int j = i*2; j < MAX; j += i) is_prime[j] = 0;
    }

    // 2017-like 数かどうか
    vector<int> a(MAX, 0);
    for (int i = 0; i < MAX; ++i) {
        if (i % 2 == 0) continue;
        if (is_prime[i] && is_prime[(i+1)/2]) a[i] = 1;
    }

    // 累積和
    vector<int> s(MAX+1, 0);
    for (int i = 0; i < MAX; ++i) s[i+1] = s[i] + a[i];

    // クエリ処理
    int Q; cin >> Q;
    for (int q = 0; q < Q; ++q) {
        int l, r;
        cin >> l >> r;
        ++r;

        cout << s[r] - s[l] << endl;
    }
}
//けんちょん

Measured memory_bytes: 4440
#include <iostream>
#include <algorithm>
using namespace std;
#define NIL -1
struct Node {
	int depth, left, right, parent;
	Node()
	{
		left = right = parent = NIL;
	}
}node[1000005];

void setDepth(int x, int d)
{
	node[x].depth = d;
	if (node[x].left != NIL)
		setDepth(node[x].left, d + 1);
	if (node[x].right != NIL)
		setDepth(node[x].right, d);
}

int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, id, k, root;
	int c[100005];
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> id >> k;
		if (k > 0)
		{
			cin >> c[0];
			node[id].left = c[0];
			node[c[0]].parent = id;
			for (int j = 1; j < k; j++)
			{
				cin >> c[j];
				node[c[j - 1]].right = c[j];
				node[c[j]].parent = id;
			}
		}
	}
	for (root = 0; root < n; ++root)
		if (node[root].parent == NIL)
			break;

	setDepth(root, 0);

	for (int i = 0; i < n; ++i)
	{
		cout << "node " << i << ": parent = " << node[i].parent << ", depth = " << node[i].depth << ", ";
		if (node[i].parent == NIL)
			cout << "root, ";
		else if (node[i].left == NIL)
			cout << "leaf, ";
		else
			cout << "internal node, ";
		cout << '[';
		if (node[i].left != NIL)
		{
			int j = node[i].left;
			cout << j;
			while (node[j].right != NIL)
			{
				j = node[j].right;
				cout << ", " << j;
			}
		}
		cout << ']' << endl;
	}

	return 0;
}

Measured memory_bytes: 19180
#include<stdio.h>
int main()
{
    int a,j=0,i;
    double b;
    scanf("%d",&a);
    for(i=1;i<=a;i++)
    {
        if(i%2!=0)
        {
            j++;
        }
    }
    b=(double)j/a;
    printf("%lf",b);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std ;
int main()
{
	int n , Min , x ;
	int ans = 1 ;
	cin >> n ;
	cin >> Min ;
	for(int i = 2 ; i <= n ; i ++)
	{
		cin >> x ;
		if(x < Min)  ans ++ ;
		Min = min(Min , x) ;
	}
	cout << ans << '\n' ;
	return 0 ; 
}

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

int N, M;
string S, T;

int main()
{
    cin >> S >> T;
    N = S.length();
    M = T.length();

    for(int i = N - M; i >= 0; i--)
    {
        for(int j = 0; j <= M; j++)
        {
            if(j == M)
            {
                replace(S.begin(), S.end(), '?', 'a');
                for(int k = 0; k < M; k++) S[i + k] = T[k];
                cout << S << endl;
                return 0;
            }
            if(S[i + j] == '?' || S[i + j] == T[j]);
            else break;
        }
    }

    cout << "UNRESTORABLE" << endl;

    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cout.precision(10);
    string s;
    cin >> s;
    string ans = s.substr(0, s.size() - 8);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

double angle(double x1, double y1, double x2, double y2)
{
    double l1 = sqrt(x1 * x1 + y1 * y1);
    double l2 = sqrt(x2 * x2 + y2 * y2);
    return acos((x1 * x2 + y1 * y2) / (l1 * l2));
}

int main(void)
{
    double x1, x2, x3, xp;
    double y1, y2, y3, yp;

    while (~scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)){
        double s1, s2, s3;
        double a1, a2, a3;

        a1 = angle(x1 - xp, y1 - yp, x2 - xp, y2 - yp);
        a2 = angle(x2 - xp, y2 - yp, x3 - xp, y3 - yp);
        a3 = angle(x3 - xp, y3 - yp, x1 - xp, y1 - yp);

        puts(fabs(a1 + a2 + a3 - acos(-1) * 2) < 1e-9 ? "YES" : "NO");
    }

    return 0;
}

Measured memory_bytes: 668
//g++ -std=c++14 test.cpp -o test.out
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
using namespace std;

string S;
int N;
int ans = 0;
 
void solve(){
  deque<char> q;
  for(int i=0;i<N;i++){
    if(q.size()>=3){
      if(q[0]=='A' && q[1]=='B' && q[2]=='C'){
        ans++;
      }
      q.pop_front();
    }
    q.push_back(S[i]);
  }
  if(q[0]=='A' && q[1]=='B' && q[2]=='C'){
    ans++;
  }
}
 
int main(){
  cin>>N;
  cin>>S;
 
	solve();

  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		String[] a = new String[] {sc.next(), sc.next()};
		int l = a[0].length() + a[1].length();
		for (int i = 0; i < l; i++) {
			System.out.print(a[i % 2].charAt(i / 2));
		}
		System.out.println();
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI = acos(-1);
const ll MOD = 1000000007;

int main() {
  string X; cin >> X;
  
  int countT = 0;
  int countS = 0;
  for (int i = 0; i < X.size(); i++) {
    if (X[i] == 'S') countS++;
    else if (countS > 0) countS--;
    else countT++;
  }
  
  cout << countT + countS << endl;
}

Measured memory_bytes: 640
#include<cstdio>
#include<queue>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<map>
#include<cmath>

using namespace std;

int d, n,t[200],a[200],b[200],c[200];
int dp[200][200] = {};

int ans(int day, int cloth){
	if (day == d-1)return 0;
	if (dp[day][cloth] > 0)return dp[day][cloth];
	int ret = 0;
	for (int i = 0; i < n; i++){
		if (a[i] <= t[day+1] && b[i] >= t[day+1]){
			ret = max(ret, ans(day + 1, i) + abs(c[cloth] - c[i]));
		}
	}
	return dp[day][cloth]=ret;
}

int main(){
	int answer = 0;
	scanf("%d %d", &d, &n);
	for (int i = 0; i < d; i++){
		scanf("%d", &t[i]);
	}
	for (int i = 0; i < n; i++){
		scanf("%d %d %d",&a[i],&b[i],&c[i]);
	}
	for (int i = 0; i < n; i++){
		if (a[i] <= t[0] && b[i] >= t[0]){
			answer = max(answer, ans(0, i));
		}
	}
	printf("%d\n",answer);
	return 0;
}

Measured memory_bytes: 1360
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>

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

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RREP(i, n) for(int i = n - 1; i >= 0; i--)
#define REP2(i, n, k) for(int i = 0; i < n; i += k)

int main() {
    string s;
    ll ans = 0;
    
    cin >> s;
    
    REP(i, pow(2, s.size() - 1)){
        string t = s;
        int p = 1;
        for(int j = i; j > 0; j = (j >> 1) & 0x7fffffff){
            if(j & 1){
                t.insert(t.begin() + p, '+');
                p++;
            }
            p++;
        }
        // cout << t << endl;
        
        ll k = 0;
        REP(j, t.size()){
            if(t[j] != '+'){
                k = k * 10 + (t[j] - '0');
            }
            else{
                ans += k;
                k = 0;
            }
        }
        ans += k;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
    static final int NALPHA = 26;

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        int m = t.length();
        int T[][] = new int[NALPHA][n];
        for (int i = 0; i < NALPHA; i++) {
            for (int j = 0; j < n; j++) {
                T[i][j] = -1;
            }
        }
        for (int i = 0; i < n; i++) {
            int c = s.charAt(i) - 'a';
            T[c][i] = 0;
        }
        for (int c = 0; c < NALPHA; c++) {
            int tail = -1;
            for (int i = n-1; i >= 0; i--) {
                if (T[c][i] == 0) {
                    tail = i;
                    break;
                }
            }
            if (tail < 0) continue;
            int x = 0;
            for (int i = 0; i >= - n + 1; i--) {
                int pos = (tail + i + n) % n;
                if (T[c][pos] == 0) {
                    x = 0;
                } else {
                    x += 1;
                }
                T[c][pos] = x;
            }
        }
        /*
        for (int c = 0; c < NALPHA; c++) {
            System.out.printf("%c:%s\n", 'a'+c, Arrays.toString(T[c]));
        }
        */
        long ans = 0;
        int p = 0;
        for (int i = 0; i < m; i++) {
            int c = t.charAt(i) - 'a';
            int d = T[c][p];
            if (d < 0) {
                ans = -1;
                break;
            }
            ans += d + 1;
            p = (p + d + 1) % n;
        }
        System.out.println(ans);

    }
}


Measured memory_bytes: 38676
while True:
    try:
        a,b,n=map(int, input().split())
    except:
        break
    a=a%b
    total=0
    for i in range(n):
        if a==0:
            break
        a=a*10
        total+=int(a/b)
        a=(a%b)
    print(total)
        
    



Measured memory_bytes: 5592
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i,n) for(int i=0;i<n;i++)
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; }

lli n;
string s;

int main(void){
    cin >> n >> s;
    lli l = 0, r = 0;
    deque<char> ans;
    rep(i, n){
        if(s[i] == '(') l++;
        else r++;
        if(l < r){
            ans.push_front('(');
            r--;
        }
        ans.push_back(s[i]);
    }
    string t;
    rep(i, ans.size()) t+=ans[i];
    while(r < l) t+=')', r++;
    cout << t << endl;
    return 0;
}


Measured memory_bytes: 3576
#include<bits/stdc++.h>
#define re register
#define int long long
#define ll long long
#define M 1000000007
using namespace std;
inline int read() {
	re int t=0;
	re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0') {
		t=(t<<3)+(t<<1)+v-48;
		v=getchar();
	}
	return t;
}
inline int ksm(re int x,re int y){
	int sum=1;
	while(y){
		if(y&1)sum*=x,sum%=M;
		x*=x,x%=M;
		y>>=1;
	}
	return sum;
}
int n,k,q,ans,m,f[200005],g[200005],fac[200005],inv[200005];
inline int C(re int x,re int y){
	return fac[x]*inv[y]%M*inv[x-y]%M;
}
signed main() {
	n=read();
	k=read();
	if(k>=n)k=n;
	fac[0]=1;
	for(re int i=1;i<=n;++i)fac[i]=fac[i-1]*i%M;
	inv[n]=ksm(fac[n],M-2);
	for(re int i=n-1;i;--i)inv[i]=inv[i+1]*(i+1)%M;
	inv[0]=1;
	f[0]=1;
	for(re int i=1;i<=k;++i){
		f[i]=f[i-1]+C(n,i)*C(n-1,n-i-1)%M;
		f[i]%=M;
	}
	printf("%lld",f[k]);
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mkp make_pair
#define int long long
#define fori(j,n) for(int i=j;i<n;i++)
#define forb(n,j) for(int i=n-1;i>=0;i--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define PI 3.141592653589793
#define M 1000000007
using namespace std;
int fast(int a,int b)
{
    int ans=1;
    a=a%M;
    if(a==0)
        return 0;
    while(b>0)
    {
        if(b&1)
        {
            ans=(ans*a)%M;
        }
        b>>=1;
        a=(a*a)%M;
    }
    return ans;
}
int p[1000005]={0};
int32_t main()
{
    int n;
    cin>>n;
    int a[n];
    unordered_map<int,int>mp;
    fori(0,n)
    {
        cin>>a[i];
        mp[a[i]]++;
    }
	int  count=0;
	for (int i=0;i<n;i++)
	{
        int flag = 1;
		for (int j=1; j*j <= a[i]; j++)
		{
			if (a[i]%j==0)
            {
				if (j == a[i] && mp[j] >= 2 || j != a[i] && mp[j] >= 1 || a[i]/j == a[i] && mp[a[i]/j] >= 2 || a[i]/j != a[i] && mp[a[i]/j]>=1)
                {
					flag = 0;
					break;
				}
			}
		}
		if (flag)
            count++;
	}
	cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 33408
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))

typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;

#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
typedef long long int LL;
//typedef __int64 LL;

int H, W, K;
char board[802][802];
int dist[802][802];

int dr[] = { 0, 0, 1, -1 };
int dc[] = { 1, -1, 0, 0 };

int main()
{
	scanf("%d %d %d", &H, &W, &K);
	for (int i = 0; i < H; i++) scanf("%s", board[i]);

	PII start = PII(-1, -1);
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (board[i][j] == 'S') {
				start = PII(i, j);
				board[i][j] = '.';
			}
		}
	}

	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			dist[i][j] = -1;
		}
	}

	dist[start.first][start.second] = 0;
	queue<PII> Q;
	Q.push(start);
	while (!Q.empty()) {
		PII u = Q.front();
		Q.pop();
		if (dist[u.first][u.second] == K) continue;

		for (int d = 0; d < 4; d++) {
			PII end;
			end.first = u.first + dr[d];
			end.second = u.second + dc[d];
			if (!(IN(end.first, 0, H - 1) && IN(end.second, 0, W - 1))) continue;
			if (board[end.first][end.second] == '#') continue;
			if (dist[end.first][end.second] == -1) {
				dist[end.first][end.second] = dist[u.first][u.second] + 1;
				Q.push(end);
			}
		}
	}

	int ans = 0;
	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) {
				if (dist[i][j] != -1) {
					ans = 1;
				}
			}
		}
	}

	if (ans) {
		printf("1\n");
		return 0;
	}

	ans = 1000000000;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (dist[i][j] == -1) continue;
			int d = MIN(i, j);
			d = MIN(d, H - 1 - i);
			d = MIN(d, W - 1 - j);
			int now = (d + K - 1) / K;
			ans = MIN(ans, now + 1);
		}
	}

	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 3456
import java.util.Scanner;
import java.lang.Math;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while(in.hasNext()){
			int a = in.nextInt();
			int b = in.nextInt();
			System.out.println((int)Math.floor(Math.log10(a+b)+1));
		}
	}

}

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

using namespace std;
#define ll long long


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> fr(n + 2, 0);
    for (int i = 1; i < n; i++) {
        int a;
        cin >> a;
        fr[a]++;

    }
    for (int i = 1; i <= n; i++)cout << fr[i] << "\n";
    return 0;
}

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

using ll = long long;

const int M = 1e9 + 7;

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

int main(int argc, char *argv[])
{
    int N;
    cin >> N;
    vector<ll> arr(N);
    for (auto& v : arr) {
        cin >> v;
    }
    ll res = 0;
    for (int b = 0; b < 64; b++) {
        ll v = 1LL << b;
        ll n = 0;
        for (int i = 0; i < N; i++) {
            if (arr[i] & v) {
                n++;
            }
        }
        res += mul(mul(n, N - n), v % M);
        res %= M;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 2560
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long[] head = new long[5];
    for(int i = 0;i<n;i++){
      String s = sc.next();
      char[] c = s.toCharArray();
      if(c[0]=='M'){
        head[0]++;
      }else if(c[0]=='A'){
        head[1]++;
      }else if(c[0]=='R'){
        head[2]++;
      }else if(c[0]=='C'){
        head[3]++;
      }else if(c[0]=='H'){
        head[4]++;
      }
    }
    long ans = 0l;
    for(int i = 0;i<3;i++){
      for(int j = i+1;j<4;j++){
        for(int k = j+1;k<5;k++){
          ans += head[i]*head[j]*head[k];
        }
      }
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 57868
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

N = int(input())
A = list(map(int, input().split()))

def get_count(summary):
    count = 0
    for i in range(1, N):
    #    print(summary)

        # 次はマイナス
        if summary > 0:
            # 条件を満たしてる？
            if (summary + A[i]) < 0:
                summary += A[i]
            else:
                # プラスになっちゃってるので修正
                summary += A[i]
                count += (summary+1)
                summary = -1

        # 次はプラス
        else:
            if (summary + A[i]) > 0:
                summary += A[i]
            else:
                # マイナスになっちゃってるので修正
                summary += A[i]
                count += abs(summary)+1
                summary = 1

    return count

if A[0] > 0:
    plus = get_count(A[0])
    minus = get_count(-1)
    minus += (A[0]+1)
elif A[0] == 0:
    plus = get_count(1)+1
    minus = get_count(-1)+1
else:
    plus = get_count(1)
    plus += (abs(A[0])+1)
    minus = get_count(A[0])

print(min(plus, minus))

Measured memory_bytes: 14336
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

int main() {
    string S; cin >> S;
    long long K; cin >> K;

    int now = 0;
    for(int i=0; i < S.size(); i++) {
        int tmp = S.at(i) - '0';
        if(tmp == 1) {
            now++;
            if(K == now) {
                cout << 1 << endl;
                return 0;
            }
        } else {
            cout << tmp << endl;
            return 0;
        }

    }

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 9e5+20 , Mod = 1e9+7;
inline int add(int a,int b) { return a + b >= Mod ? a + b - Mod : a + b; }
inline int sub(int a,int b) { return a - b < 0 ? a - b + Mod : a - b; }
inline int mul(int a,int b) { return 1LL * a * b % Mod; }
inline void Add(int &a,int b) { a = add( a , b ); }
inline void Sub(int &a,int b) { a = sub( a , b ); }
inline void Mul(int &a,int b) { a = mul( a , b ); }
inline int quickpow(int a,int b) { int res = 1; for (;b;Mul(a,a),b>>=1) if ( 1 & b ) Mul(res,a); return res; }
int n,m,k,fac[N],inv[N],Pow3[N],ans;
inline void init(void)
{
    fac[0] = inv[0] = Pow3[0] = 1;
    for (int i=1;i<=n+m+k;i++)
        fac[i] = mul( fac[i-1] , i ) , Pow3[i] = mul( Pow3[i-1] , 3 );
    inv[n+m+k] = quickpow( fac[n+m+k] , Mod-2 );
    for (int i=n+m+k-1;i>=1;i--)
        inv[i] = mul( inv[i+1] , i+1 );
}
inline int C(int n,int m)
{
    if ( n < m || m < 0 || n < 0 ) return 0;
    return mul( fac[n] , mul( inv[m] , inv[n-m] ) );
}
inline int getval(void)
{
    int res = 0;
    for (int i=0;i<=m;i++) Add( res , C(k,i) );
    return res;
}
inline void solve(void)
{
    int val = 1;
    for (int i=0;i<=m+k;i++)
    {
        Add( ans , mul( mul( C(i+n-1,n-1) , Pow3[m+k-i] ) , val ) );
        if ( i < k ) Mul( val , 2 );
        else if ( i < m ) val = sub( mul( val , 2 ) , C(i,k) );
        else val = sub( mul( val , 2 ) , add( C(i,m) , C(i,k) ) );
    }
}
int main(void)
{
    scanf("%d%d%d",&n,&m,&k);
    if ( k > m ) swap( k , m );
    init();
    solve();
    printf("%d\n",ans);
    return 0;
}


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

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: u32 = read();
    let b: u32 = read();
    let c: u32 = read();
    let x: u32 = read();
    let mut ans = 0;
    for i in 0..a+1 {
        for j in 0..b+1 {
            for k in 0..c+1 {
                if i*500 + j*100 + k*50 == x {
                    ans += 1;
                }
            }
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
n,m=map(int,input().split())
a=list(map(int,input().split()))
data=[[int(i) for i in input().split()] for i in range(m)]
data.sort(key=lambda x:x[1],reverse=True)
a.sort(reverse=True)
ans=0
flag=True
for _ in range(n):
  if data[0][1]<a[0] or flag==False:
    ans+=a.pop(0)
  else:
    ans+=data[0][1]
    data[0][0]-=1
    if data[0][0]==0:
      if len(data)>1:
        data.pop(0)
      else:
        flag=False
print(ans)

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

int r[10];

int main(){
    int n; cin >> n;
    for(int i=0;i<n;i++){
        int a; cin >> a;
        if(a<3200) r[a/400]++;
        else r[8]++;
    }

    int cnt = 0;
    for(int i=0;i<8;i++){
        if(r[i]) cnt++;
    }

    cout << max(cnt, 1) << ' ' << cnt + r[8] << endl;
    return 0;
}

Measured memory_bytes: 256
n,m=map(int,raw_input().split())
a=[0]*m;b=[0]*m;c=[0]*m
p=[[10e9 for i in range(n)] for i in range(n)]
for i in range(n):p[i][i]=0
for i in range(m):
    a[i],b[i],c[i]=map(int,raw_input().split())
    a[i]-=1;b[i]-=1
    p[a[i]][b[i]]=p[b[i]][a[i]]=c[i]
for i in range(n):
    for j in range(n):
        for k in range(n):
            p[j][k]=min(p[j][k],p[j][i]+p[i][k])
            p[k][j]=p[j][k]
cnt=0
for i in range(m):
    if p[a[i]][b[i]]<c[i]:cnt+=1
print cnt


Measured memory_bytes: 14576
local n,x,y=io.read("*n","*n","*n")

local ma=math.abs
local t={}
for i=1,n do
    for j=i+1,n do
        local mindist=math.min(ma(j-i),ma(x-i)+1+ma(j-y),ma(y-i)+1+ma(j-x))
        t[mindist]=(t[mindist] or 0)+1
    end
end

for i=1,n-1 do
    print(t[i] or 0)
end

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int> a(n+1);
    for(int i=2;i<=n;i++)
    {
        int k;
        cin>>k;
        a[k]++;
    }
    for(int i=1;i<=n;i++) cout<<a[i]<<endl;
}

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

#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

ll gcd( ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

bool IsPrime(ll num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (ll i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main (void) {
    ll A,B;
    ll ans;
    ll GCDnumber,N;
    scanf("%lld %lld", &A, &B);
    GCDnumber = gcd(A,B);
    vector<ll> ret;
    for( ll i = 1; i * i <= GCDnumber; i++ ) {
        if(GCDnumber % i == 0){ 
            ret.push_back(i);
            if(i * i != GCDnumber) ret.push_back(GCDnumber/i);
        }
    }
    ans = 1;
    for ( ll j : ret ){
        if (IsPrime(j)) ans++;
    }
    printf("%lld\n", ans);
    return 0;
}

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

int main(){
	/*input*/
	int x;	cin >> x;
	/*output*/
	switch(x){
		case 3:
		case 5:
		case 7:
		cout << "YES" << endl;	
		break;

		default:
		cout << "NO" << endl;
		break;
	}
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

  ll ans = 0LL;
  ans += x / 11 ;
  ans *= 2;
  x -= (x / 11) * 11;
  if(0 < x && x <= 6){
    ans += 1;
  }
  else if(7 <= x){
    ans += 2;
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main ()
{
int a ,b ;
cin>>a>>b;
if (a>b){
	for(int i=0 ; i<a; i++)
	cout<<b;
	}
else if (b>a){
    for(int i=0 ; i<b; i++)
	cout<<a;
}
else {
	for(int i=0 ; i<b; i++)
	cout<<a;
	
}
return 0;
}

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

int main(){
  int n;  cin >> n;
  vector<bool>a(n,false);
  for(int i=0;i<n;i++){
    int d1,d2;  cin >> d1 >> d2;
    if(d1 == d2)  a.at(i) = true;
  }
  for(int i=0;i<n-2;i++){
    if(a.at(i) && a.at(i+1) && a.at(i+2)){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3628
import java.util.Scanner;
public class Main {
 public static void main(String[] args) {
 Scanner sc= new Scanner(System.in);
 int n = sc.nextInt();
 int i= 1;
 do{
 	int x =i;
if(x%3==0){
	System.out.print(" "+i);
}else{
do{ 
	if (x % 10 == 3) {
	System.out.print(" " + i); 
	break; 
} 
x /= 10;
 }while(x!=0); 
}
 } while (++i <= n); 
 	System.out.println();
}
 }

Measured memory_bytes: 28640
import sys
import numpy as np
W,H,N = map(int, sys.stdin.readline().split())

L = np.array([[0 for _ in range(W)] for _ in range(H)])
#print(L)

for i in range(N):
    x, y, a = map(int, sys.stdin.readline().split())
    if a ==1:
        for j in range(x):
            L[:,j]=1
    elif a ==2:
        for j in range(x, W):
            L[:,j]=1
    elif a ==3:
        for i in range(y):
            L[i] =1
    elif a ==4:
        for i in range(y, H):
            L[i] =1
print(np.sum(L==0))

Measured memory_bytes: 19104
package main

import (
	"bufio"
	"fmt"
	"math/rand"
	"os"
	"strconv"
)

var MIN int = 0

var sc = bufio.NewScanner(os.Stdin)

var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }

type Node struct {
	key, pri    int
	left, rigth *Node
}

func next() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i

}

func rigthRotate(t *Node) *Node {
	s := t.left
	t.left = s.rigth
	s.rigth = t
	return s
}

func leftRotate(t *Node) *Node {
	s := t.rigth
	t.rigth = s.left
	s.left = t
	return s
}

func insert(t *Node, key int, pri int) *Node {
	if t == nil {
		return &Node{key: key, pri: pri}
	}
	if key == t.key {
		return t
	}
	if t.key > key {

		t.left = insert(t.left, key, pri)
		if t.pri < t.left.pri {
			t = rigthRotate(t)
		}
	} else {
		t.rigth = insert(t.rigth, key, pri)
		if t.pri < t.rigth.pri {
			t = leftRotate(t)
		}

	}
	return t
}

func find(t *Node, key int) bool {
	if t == nil {
		return false
	}

	if t.key == key {
		return true
	}

	if t.key > key {
		return find(t.left, key)

	} else if t.key < key {
		return find(t.rigth, key)

	}
	panic("error")
}

func erase(t *Node, key int) *Node {
	if t == nil {
		return nil
	}
	if key == t.key {
		if t.left == nil && t.rigth == nil {
			return nil

		} else if t.left == nil {
			t = leftRotate(t)
		} else if t.rigth == nil {
			t = rigthRotate(t)

		} else {
			if t.left.pri > t.rigth.pri {
				t = rigthRotate(t)

			} else {

				t = leftRotate(t)

			}

		}
		return erase(t, key)

	}
	if key < t.key {
		t.left = erase(t.left, key)

	} else {
		t.rigth = erase(t.rigth, key)

	}
	return t
}

func getMin(t *Node) int {
	if t.left != nil {
		return getMin(t.left)
	}
	return t.key

}

func main() {
    	defer writer.Flush()

	sc.Split(bufio.ScanWords)

	var head *Node

	N, L := next(), next()

	items := make([]int, N)
	memo := make(map[int]int, N)

	for i := 0; i < N; i++ {
		items[i] = next()
	}

	for j := 0; j < L-1; j++ {
		head = insert(head, items[j], rand.Int())
		memo[items[j]] += 1
	}

	for i := L - 1; i < N; i++ {
		head = insert(head, items[i], rand.Int())
		memo[items[i]] += 1
		if i == N-1 {
			printf("%d\n", getMin(head))
		} else {
			printf("%d ", getMin(head))

		}

		r, ok := memo[items[i-L+1]]
		if ok {
			if r <= 1 {
				head = erase(head, items[i-L+1])
			}
			memo[items[i-L+1]] -= 1
		}
	}
}




Measured memory_bytes: 83636
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
//long long int countt[200003];
#include<ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set, multimap, map etc.
#include<ext/pb_ds/tree_policy.hpp> // include the tree_order_statistics_node update
using namespace __gnu_pbds; //necessary for the GNU based Policy based data structures.
typedef tree<pair<int,int> ,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define int long long
#define endl "\n"


signed main()
{
    FAST;
    
    int i=0,j=0,k=0,n=0,m=0,count=0,temp=0;
    int temp1=0,temp2=0,temp3=0,x=0,l=0,y=0,sum=0;
    int left=0,up=0,down=0,start=0,end=0,r=0,q=0,total=0;
    int maxx=0,minn=0,curr=0,ans=0,places=0,zeroes=0,low=0,high=0;
    int prev=0,mid=0,z=0,d=0,val=0,pos=0,shift=0,h=0,right=0,var=0;
    
    cin>>n;
    map<int,int> mp;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    
    for(i=0;i<n;i++)
    {
        curr = i+a[i];
        int reqd = i-a[i];
        
        if(mp.count(reqd))
        {
            ans+=mp[reqd];
        }
        
        mp[curr]++;
    }
    
    cout<<ans<<endl;
    
    
}

Measured memory_bytes: 17512
import scala.io.StdIn

object Main {
  def main(args: Array[String]): Unit = {
    val inputs = Iterator.continually(StdIn.readLine()).takeWhile(_ != null)
    inputs.map(_.split(" ").map(_.toInt)).foreach{
      case Array(0, 0) =>
      case Array(a, b) if a <= b => println(s"$a $b")
      case Array(a, b) if a > b => println(s"$b $a")
    }
  }
}

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

#define rep0(i, n) for(int i=0; i<(int)(n);i++)
#define rep1(i, n) for(int i=1; i<=(int)(n);i++)
#define all(x) (x).begin(), (x).end()
#define debug(a) if(flagdebug){cout << "debug (" #a "):" << endl << (a) << endl;}

typedef uint64_t ulint;
typedef int64_t lint;
using namespace std;

lint a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
bool flagdebug = false;

int main(){
//////////////////////////////////////////////////////
    // flagdebug = true;

    cin >> n;



    cout << (n+1)/2 << endl;

//////////////////////////////////////////////////////
// Ctrl + Opt + N to make
    return 0;
}


Measured memory_bytes: 256
n,m,x=map(int,input().split())
ca=[list(map(int,input().split())) for i in range(n)]
ans=100000000000000000
for i in range(2**n):
    check=[0]*m
    ans_=0
    for j in range(n):
        if ((i>>j)&1):
            ans_+=ca[j][0]#(✳︎)
            for k in range(m):
                check[k]+=ca[j][k+1]
    if all([l>=x for l in check]):
        ans=min(ans,ans_)
if ans==100000000000000000:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 9144