akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define dump(x)  cout << #x << " = " << (x) << endl;

#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
//             0123456789 - digits. check the limits, int vs long
const int MX = 100001;
const int LOW = -1000000;
const int HIGH = 1000000;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(0);
    cout << std::fixed;
    // freopen("ex.in","r",stdin);
    // freopen("ex.out","w",stdout);
    int k, x;
    cin >> k >> x;
    int r = HIGH, l = LOW;
    l = max(l, x - k + 1);
    r = min(r, x + k - 1);
    for (int i = l; i <= r; i++)
        cout << i << " ";
    cout << "\n";
    return 0;
}

Measured memory_bytes: 256
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt = fst . fromJust . BS.readInt

getInt = readInt <$> BS.getLine

getIntListN n = map readInt <$> replicateM (fromIntegral n) BS.getLine

lcms :: [Int] -> Int -> Int
lcms [] n = n
lcms (x : xs) n = lcms xs (lcm x n)

main = do
  n <- getInt
  ts <- getIntListN n
  print $ lcms ts 1


Measured memory_bytes: 3848
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#include <iomanip>
//cout << fixed << setprecision(20) << *** << endl;
#define rep(i,N) for(int i=0;i<(int)N;++i)
typedef long long ll;
using namespace std;
int main()
{
	ll A,B;
	cin>>A>>B;
	if(A%2==0){
		if((A/2)>=B)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	else{
		if((A/2)+1>=B)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 1e5 + 5;

int32_t main()
{
	IOS;
	double r;
	cin >> r;
	cout << fixed << setprecision(12) << 2 * acosl(-1.0l) * r;
	return 0;
}

Measured memory_bytes: 3804
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
          // Initialize
          var iR = cin.ReadInt;
          var Pi = 3.141592;
          // Process
          // Output
          WriteLine(iR*2*Pi);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  string S;
  cin >> S;
  int ans = 0;
  for(int i = 0; i < S.length()/2; i++){
    if(S[i] != S[S.length()-1-i]){
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
class Dice():

    def __init__(self, *n):
       self.rolls = n

    def spin(self, order):
        if order == "N":
            self.rolls = [
                self.rolls[1],
                self.rolls[5],
                self.rolls[2],
                self.rolls[3],
                self.rolls[0],
                self.rolls[4]
            ]
        if order == "E":
            self.rolls = [
                self.rolls[3],
                self.rolls[1],
                self.rolls[0],
                self.rolls[5],
                self.rolls[4],
                self.rolls[2]
            ]
        if order == "S":
            self.rolls = [
                self.rolls[4],
                self.rolls[0],
                self.rolls[2],
                self.rolls[3],
                self.rolls[5],
                self.rolls[1]
            ]
        if order == "W":
            self.rolls = [
                self.rolls[2],
                self.rolls[1],
                self.rolls[5],
                self.rolls[0],
                self.rolls[4],
                self.rolls[3]
            ]
        return self.rolls[0]


d = Dice(*[int(i) for i in input().split()])
for order in list(input()):
    l = d.spin(order)
print(l)

Measured memory_bytes: 5608
#include <iostream>
#include <list>
#include <cmath>

using namespace std;

int main() {
	int n;
	while ((cin >> n),n != 0) {
		list<int> s;
		for (int i = 2; i < sqrt(2 * n) + 1; i++) s.push_back(i);
		for (auto itr = s.begin(); itr != s.end(); itr++) {
			int val = *itr;
			s.remove_if([&](int p){ return p > val && p % val == 0; });
		}
		list<int> dst;
		for (int i = n+1; i <= 2 * n; i++) dst.push_back(i);
		for (auto itr = s.begin(); itr != s.end(); itr++) {
			int val = *itr;
			dst.remove_if([&](int p){ return p > val && p % val == 0; });
		}
		cout << dst.size() << endl;
	}
	return 0;
}

Measured memory_bytes: 6944
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
abc = [a,b,c,d,e]
ans = 0
flag = 0
for i in range(5):
    for j in range(i,5):
        ans = abc[j]-abc[i]
        if ans <= k:
            continue
        else:
            flag = 1
            break
if flag == 1:
    print(':(')
else:
    print('Yay!')

Measured memory_bytes: 3064
// IOI 2021
 
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
#define debug(x) cerr << #x << ": " << x << endl
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

////////////////////////////////////////////////////////////////////

const int N = 1e5 + 5;

int n, k, ans, A[N];
vector<int> G[N];

int DFS(int v) {
	int mx = 0;
	for (int u : G[v]) {
		int d = DFS(u);
		if (d == k - 1 && v != 1) ans++;
		else mx = max(mx, d + 1);
	}
	return mx;
}

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	cin >> n >> k;
	for (int i = 1; i <= n; i++) cin >> A[i];
	for (int i = 2; i <= n; i++) G[A[i]].push_back(i);
	ans += (A[1] != 1);
	DFS(1);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 10752
//84104971101048411497 - Can you guess what does this mean?
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i,  r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define X real()
#define Y imag()
#define maxN 200005
#define maxX 2000
#define oo 2000000007
#define EPS 1e-9
#define MOD 1000000007

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int power(int x, int n) {
    if (n == 0) return 1;
    if (n&1) return ((ll)x*power(x, n-1))%MOD;
    int p = power(x, n/2);
    return ((ll)p*p)%MOD;
}

void add(int &a, int b) {a = (a+b)%MOD;}

int n, a[maxN], b[maxN], cnt[2*maxX+1][2*maxX+1], dp[2*maxX+1][2*maxX+1], fact[4*maxX+1], invFact[4*maxX+1];

int C(int n, int k) {
    ll t = ((ll)fact[n]*invFact[k])%MOD;
    return (t*invFact[n-k])%MOD;
}

int main () {
    scanf("%d", &n);
    fto(i, 1, n) {
        scanf("%d%d", &a[i], &b[i]);
        ++cnt[maxX-a[i]][maxX-b[i]];
    }

    fact[0] = invFact[0] = 1;
    fto(i, 1, 4*maxX) {
        fact[i] = ((ll)fact[i-1]*i)%MOD;
        invFact[i] = power(fact[i], MOD-2);
    }

    fto(x, 0, 2*maxX) {
        fto(y, 0, 2*maxX) {
            dp[x][y] = cnt[x][y];
            if (x > 0) add(dp[x][y], dp[x-1][y]);
            if (y > 0) add(dp[x][y], dp[x][y-1]);
        }
    }

    int ans = 0;
    fto(i, 1, n) {
        add(ans, dp[maxX+a[i]][maxX+b[i]]);
        add(ans, MOD-C(2*(a[i]+b[i]), 2*a[i]));
    }
    ans = ((ll)ans*power(2, MOD-2))%MOD;
    printf("%d", ans);

    return 0;
}


Measured memory_bytes: 96000
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n      = Integer.parseInt(sc.nextLine());
		String[] t = sc.nextLine().split(" ");
		int[] list = new int[n];

		for(int i = 0; i < n; i++) {

			list[i] = Integer.parseInt(t[i]);
		}

		Arrays.parallelSort(list);
		int cnt = 0;

		for(int i = n - 1;i > 1; i--){
			for(int j = i - 1; j > 0; j--){
				int a = BinarySearch(list, list[i] - list[j] + 1);
		        if(a < j){
		          cnt += j - a;
		        }
		      }
		    }
		    System.out.println(cnt);
		  }

		  public static int BinarySearch(int a[] , int target){
		    int left = -1;
		    int right = a.length;

		    while(right - left > 1){
		      int mid = left + (right - left) / 2;
		      if(a[mid] >= target){
		        right = mid;
		      }else{
		        left = mid;
		      }
		    }
		    return right;
		  }
}


Measured memory_bytes: 37604
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;

struct Info{
	Info(){
		for(int i = 1; i <= 100; i++)knowTable[i] = false;
	}
	bool knowTable[101];
};

void func(int N){

	Info info[N+1];
	int num,tmp;

	for(int i = 1; i <= N; i++){
		scanf("%d",&num);

		for(int loop = 0; loop < num; loop++){
			scanf("%d",&tmp);
			info[i].knowTable[tmp] = true;
		}
	}

	int leakTable[N],index = 0;
	scanf("%d",&num);
	for(int i = 0; i < num; i++){
		scanf("%d",&tmp);
		leakTable[index++] = tmp;
	}

	int count = 0,ans;
	bool FLG;

	for(int i = 1; i <= N; i++){
		FLG = true;
		for(int k = 0; k < index; k++){
			if(info[i].knowTable[leakTable[k]] == false){
				FLG = false;
				break;
			}
		}
		if(FLG){
			count++;
			ans = i;
		}
	}

	if(count == 1){
		printf("%d\n",ans);
	}else{
		printf("-1\n");
	}

}

int main(){

	int N;

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func(N);
	}

	return 0;
}

Measured memory_bytes: 2712
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var a = ReadInt();
            var A = ReadSplitInt();

            double ans = 0;
            for (int i = 0; i < a; i++)
            {
                ans += 1.0 / A[i];
            }
            Println(1.0 / ans);
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


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

int main(){
	int A, B, C;
  	cin >> A >> B >> C;
  	
  	if(A <= C && C <= B){
    	cout << "Yes" << endl;
    }else{
    	cout << "No" << endl;
    }
  	return 0;
}

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

using namespace std;

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

#define erep(i, x, n) for (auto i = x; i<=(ll)(n); i++)
#define rep(i, x, n) for(auto i = x; i<(ll)(n); i++)
#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define mod(n, m) (((n%m) + m)%m)
#define reset(n, m) memset(n, m, sizeof n)
#define endl '\n'

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

	multiset<int> ms;
	int n, m;
	cin >> n >> m;

	rep(i, 0, n)
	{
		int x;
		cin >> x;
		ms.insert(x);
	}

	vector<pii> vec(m);
	rep(i, 0, m)
		cin >> vec[i].second >> vec[i].first;

	sort(vec.rbegin(), vec.rend());

	rep(i, 0, m)
	{
		int a = vec[i].second, b = vec[i].first;

		while (*ms.begin() < b && a)
		{
			a--;
			ms.erase(ms.begin());
			ms.insert(b);
		}
	}

	ll sum = 0;
	while (!ms.empty())
		sum += (*ms.begin()), ms.erase(ms.begin());

	cout << sum << endl;

	return 0;
}


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

int  main()
{
	int n,k;
	cin >> n >> k;
	vector<long> h(n);
	long cnt = 0;
	rep(i, n)
	{
		cin >> h[i];
	}
	sort(h.rbegin(), h.rend());
	if (k >= n)
	{
		cout << cnt << endl; return 0;
	}
	else
	{
		for (int i = k; i < n; i++)
		{
			cnt += h[i];
		}
		cout << cnt << endl;
	}
	return (0);
}

Measured memory_bytes: 1792
#include <stdio.h>
#define NUMBER 200

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


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

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

int main(){
	ll N, M;
	vll D, T;
	ll i, j;
	cin >> N;
	map<ll, ll> mp;
	for (i = 0; i < N; i++){
		ll d;
		cin >> d;
		ll nd = mp[d];
		nd++;
		mp[d] = nd;
	}
	cin >> M;
	for (i = 0; i < M; i++){
		ll t;
		cin >> t;
		ll nt = mp[t];
		if (nt == 0){
			cout << "NO" << endl;
			return 0;
		}
		else{
			nt--;
			mp[t] = nt;
		}
	}
	cout << "YES" << endl;
	return 0;
}


Measured memory_bytes: 12800
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

# 二分探索木の代わり BST HST
# 存在しない要素に対するremoveはこないことを仮定している

h = []
from collections import Counter, defaultdict
from itertools import chain
ca = defaultdict(int)
ca.update(Counter(a))
cb = defaultdict(int)
cb.update(Counter(b))
ks = set(ca.keys()) | set(cb.keys())
ans = defaultdict(list)
done = 0
amari = 0
for k in ks:
    h.append((-ca[k], -cb[k], k))
h.sort(key=lambda x: x[0]+x[1])
la = []
lb = []
for va,vb,k in h:
    la.extend([k]*-va)
    lb.extend([k]*-vb)
na = [None]*n
nb = [None]*n
ia = 0
ib = n-1
ib2 = 0
for aa,bb,k in h:
    aa *= -1
    bb *= -1
    for _ in range(aa):
        na[ia] = k
        ia += 1
    for _ in range(bb):
        if na[ib]!=k:
            nb[ib] = k
            ib -= 1
        else:
            nb[ib2] = k
            ib2 += 1
if any((na[i]==nb[i]) for i in range(n)):
    print("No")
else:
    d = defaultdict(list)
    for i in range(n):
        d[na[i]].append(nb[i])
    ans = []
    for i in range(n):
        ans.append(d[a[i]].pop())
    print("Yes")
    write(" ".join(map(str, ans)))

Measured memory_bytes: 240612
n = int(input())
H = list(map(int,input().split()))
A = list(map(int,input().split()))

HA = list(zip(H,A,range(1,n+1)))
HA.sort()
bit = [0]*(n+1)

def update(val,idx):
    while idx < n+1:
        bit[idx] = max(bit[idx], val)
        idx += idx&(-idx)
    return

def get(idx):
    res = 0
    while idx > 0:
        res = max(res,bit[idx])
        idx -= idx&(-idx)
    return res

for h,a,i in HA:
    update(a + get(i),i)
print(max(bit))


Measured memory_bytes: 128208
# https://atcoder.jp/contests/abc152/submissions/9619555

import sys
readline = sys.stdin.readline

import numpy as np

N = int(readline())
AB = list(list(map(int, readline().split())) for _ in range(N - 1))
M = int(readline())
UV = list(list(map(int, readline().split())) for _ in range(M))

graph = [[] for _ in range(N + 1)]
for i, (a, b) in enumerate(AB):
    graph[a].append((b, i))
    graph[b].append((a, i))


def get_path(U, V):
    INF = 100
    visited = [False] * (N + 1)
    pred = [None] * (N + 1)
    stack = [U]
    visited[U] = True
    while stack:
        v = stack.pop()
        for w, i in graph[v]:
            if visited[w]:
                continue
            visited[w] = True
            pred[w] = (v, i)
            stack.append(w)
    path = 0
    w = V
    while w != U:
        v, i = pred[w]
        w = v
        path += 1 << i
    return path


condition_path = [get_path(u, v) for u, v in UV]


def popcnt(n):
    c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c >> 4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c >> 8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c >> 16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c >> 32) & 0x00000000ffffffff)
    return c


sgn = np.where(popcnt(np.arange(1 << M)) % 2, -1, 1)
S = np.zeros(1 << M, np.int64)
for i in range(M):
    S[1 << i:1 << (i + 1)] = S[:1 << i] | condition_path[i]

n_edges = popcnt(S)

x = 1 << (N - 1 - n_edges)
answer = np.sum(x * sgn)
print(answer)


Measured memory_bytes: 62412
#include <iostream>

using namespace std;

int main(void){
  int a[505]={0},i,n,cnt,d;
  for(i=1;i<505;++i) a[i]=a[i-1]+i;
  while(cin>>n,n){
    cnt=0;
    int from=0,to=0;
    while(to<505){
      d = a[to]-a[from];
      if(d==n && to-from>=2){
        ++cnt;
        //cerr<<from<<","<<to<<":"<<a[from]<<","<<a[to]<<endl;
      }
      if(d<=n) ++to;
      else ++from;
    }
    cout<<cnt<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    string s;
    cin >> s;
    bool ok = true;
    for (int i = 0; i < s.size(); ++i) {
        if (i % 2 == 0) {
            if (s[i] == 'L')
                ok = false;
        } else {
            if (s[i] == 'R')
                ok = false;
        }
    }
    if (ok)
        cout << "Yes"
             << "\n";
    else
        cout << "No"
             << "\n";
    return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

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

	cin >> N;
	vector<int>v(N);
	for (auto &i : v)cin >> i;
	int cnt = 1;
	for (auto i : v) {
		if (i == cnt)cnt++;
	}
	if (cnt == 1) {
		cout << -1 << endl;
		return 0;
	}
	cout << N - cnt + 1 << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
int main(){
    int a, b, c, d, e;
    scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
    if(a==0){
        printf("%d\n", 1);
    }else if (b==0)
    {
        printf("%d\n", 2);
    }else if (c==0)
    {
        printf("%d\n", 3);
    }else if (d==0)
    {
        printf("%d\n", 4);
    }else
    {
        printf("%d\n", 5);
    }
    
    
    
    
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln =  '\n';

const int mx=100010;
const ll mod=1e9+7;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; }
    mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { mint res(*this); return res+=a; }
    mint operator-(const mint a) const { mint res(*this); return res-=a; }
    mint operator*(const mint a) const { mint res(*this); return res*=a; }
    mint pow(ll t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; }
    // for prime mod
    mint inv() const { return pow(mod-2); }
    mint& operator/=(const mint a) { return (*this) *= a.inv(); }
    mint operator/(const mint a) const { mint res(*this); return res/=a; }
};

vector<int> v[mx];
vector<vector<ll>> dp(mx, vector<ll>(2,-1));

ll rec(int n, int p, int c){
  if(dp[n][c]!=-1) return dp[n][c];
  mint cur1 = 1;  //wh 0
  mint cur2 = 1;  //bl 1
  for(auto it:v[n])if(it!=p){
    cur1 *= (rec(it,n,0) + rec(it,n,1));
    cur2 *= rec(it,n,0);
  }
  if(c==0){
    dp[n][c] = cur1.x;
  } else {
    dp[n][c] = cur2.x;
  } 
  return dp[n][c];
}

int main(){
  int n;
  cin >> n;
  
  rep(i,n-1){
    int x,y; cin >> x >> y; x--; y--;
    v[x].emplace_back(y);
    v[y].emplace_back(x);
  }
  mint ans = rec(0,-1,0) + rec(0,-1,1);
  cout << ans.x << ln;
  return 0;
}

Measured memory_bytes: 20864
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

int N;
ll K;
ll dp[2][42];
ll a[101000];
int x[64];
int n[64];


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

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

    fill(x, x+64, 0);
    for(int i = 0; i < 42; i++){
        for(int j = 0; j < N; j++){
            x[i] += 1 - (a[j] >> i) % 2;
        }
        n[i] = (K >> i) % 2;
    }

    dp[0][41] = 0;
    dp[1][41] = 0;
    fill(dp[0], dp[0]+64, 0);
    fill(dp[1], dp[1]+64, 0);
    for(int i = 40; i >= 0; i--){
        if(n[i] == 0){
            dp[0][i] = dp[0][i+1] + (N-x[i]) * (1LL << i);
            if(dp[1][i+1]) {
                dp[1][i] = dp[1][i + 1] + max(N - x[i], x[i]) * (1LL << i);
            }
        }
        else{
            dp[0][i] = dp[0][i+1] + x[i] * (1LL << i);
            dp[1][i] = dp[0][i+1] + (N-x[i]) * (1LL << i);
            if(dp[1][i+1]){
                dp[1][i] = max(dp[1][i+1] + max(N-x[i], x[i]) * (1LL << i), dp[0][i+1] + (N-x[i]) * (1LL << i));
            }
        }
    }

    cout << max(dp[0][0], dp[1][0]) << endl;


    return 0;

}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

int main()
{
	double a, b, x;

	cin >> a >> b >> x;
	double c = a * a;
	if (x * 2 > b * c) {
		double t = (b * c - x) / c * 2;
		cout << setprecision(15) << atan2(t, a) * 180 / M_PI << '\n';
	} else {
		double t = x * 2 / b / a;
		cout << setprecision(15) << 90 - atan2(t, b) * 180 / M_PI << '\n';
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int N,M;
int A[1000],B[1000],C[1000];
int D[1000],E[1000],F[1000];
bool vis[3010][3010];
int wx[3010][3010],wy[3010][3010];
main()
{
	cin>>N>>M;
	vector<long>X,Y;
	X.push_back(0);
	Y.push_back(0);
	for(int i=0;i<N;i++)
	{
		cin>>A[i]>>B[i]>>C[i];
		X.push_back(A[i]);
		X.push_back(B[i]);
		Y.push_back(C[i]);
	}
	for(int i=0;i<M;i++)
	{
		cin>>D[i]>>E[i]>>F[i];
		X.push_back(D[i]);
		Y.push_back(E[i]);
		Y.push_back(F[i]);
	}
	sort(X.begin(),X.end());
	X.erase(unique(X.begin(),X.end()),X.end());
	sort(Y.begin(),Y.end());
	Y.erase(unique(Y.begin(),Y.end()),Y.end());
	for(int i=0;i<N;i++)
	{
		A[i]=lower_bound(X.begin(),X.end(),A[i])-X.begin();
		B[i]=lower_bound(X.begin(),X.end(),B[i])-X.begin();
		C[i]=lower_bound(Y.begin(),Y.end(),C[i])-Y.begin();
		wx[A[i]][C[i]]++;
		wx[B[i]][C[i]]--;
	}
	for(int i=0;i<M;i++)
	{
		D[i]=lower_bound(X.begin(),X.end(),D[i])-X.begin();
		E[i]=lower_bound(Y.begin(),Y.end(),E[i])-Y.begin();
		F[i]=lower_bound(Y.begin(),Y.end(),F[i])-Y.begin();
		wy[D[i]][E[i]]++;
		wy[D[i]][F[i]]--;
	}
	for(int i=0;i<=X.size();i++)for(int j=0;j<=Y.size();j++)
	{
		wx[i+1][j]+=wx[i][j];
		wy[i][j+1]+=wy[i][j];
	}
	queue<pair<int,int> >P;
	int sx=lower_bound(X.begin(),X.end(),0)-X.begin();
	int sy=lower_bound(Y.begin(),Y.end(),0)-Y.begin();
	for(int x=sx-1;x<=sx;x++)for(int y=sy-1;y<=sy;y++)
	{
		vis[x][y]=true;
		P.push(make_pair(x,y));
	}
	long ans=0;
	while(!P.empty())
	{
		int x=P.front().first,y=P.front().second;
		P.pop();
		if(x==-1||y==-1||x+1==X.size()||y+1==Y.size())
		{
			cout<<"INF"<<endl;
			return 0;
		}
		ans+=(X[x+1]-X[x])*(Y[y+1]-Y[y]);
		if(!wy[x][y]&&!vis[x-1][y])
		{
			vis[x-1][y]=true;
			P.push(make_pair(x-1,y));
		}
		if(!wx[x][y]&&!vis[x][y-1])
		{
			vis[x][y-1]=true;
			P.push(make_pair(x,y-1));
		}
		if(!wy[x+1][y]&&!vis[x+1][y])
		{
			vis[x+1][y]=true;
			P.push(make_pair(x+1,y));
		}
		if(!wx[x][y+1]&&!vis[x][y+1])
		{
			vis[x][y+1]=true;
			P.push(make_pair(x,y+1));
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 83168
using System;
using System.IO;
using System.Linq;
 
class Program
{
    static void Solve()
    {
        var c = new int[3][];
        for (int i = 0; i < 3; i++)
            c[i] = sc.Int(3);

        for (int i = 0; i <= 100; i++)
        {
            for (int j = 0; j <= 100; j++)
            {
                for (int k = 0; k <= 100; k++)
                {
                    var correct = true;
                    var a = new int[] {i, j, k};
                    var b = new int[] {c[0][0] - i, c[1][1] - j, c[2][2] - k};

                    if (b[0] < 0 || b[1] < 0 || b[2] < 0)
                        continue;
                    
                    for (int ii = 0; ii < 3; ii++)
                        for (int jj = 0; jj < 3; jj++)
                            if (c[ii][jj] != a[ii] + b[jj])
                                correct = false;
                    
                    if (correct)
                    {
                        pr.WriteLine("Yes");
                        return;
                    }
                }
            }
        }

        pr.WriteLine("No");
    }
 
 
    static void Main(string[] args)
    {
        // pr.AutoFlush = true;
        Solve();
        pr.Flush();
    }
 
    static Scanner sc = new Scanner();
    static Printer pr = new Printer();
}
 
#region IO
class Scanner
{
    private int _i = 0; 
    private string[] line = new string[0];
 
    private T[] Enumerate<T>(int n, Func<T> f)
    {
        T[] ret = new T[n];
        for (int i = 0; i < n; i++)
            ret[i] = f();
        return ret;
    }
 
    public string Str()
    {
        if (line.Length <= _i)
        {
            line = Console.ReadLine().Split(' ');
            _i = 0;
        }
 
        return line[_i++];
    }
 
    public int Int() => int.Parse(Str());
    public long Long() => long.Parse(Str());
    public double Double() => double.Parse(Str());
    public int[] Int(int n) => Enumerate(n, Int);
    public long[] Long(int n) => Enumerate(n, Long);
    public double[] Double(int n) => Enumerate(n, Double);
    public string[] Str(int n) => Enumerate(n, Str);
}
 
class Printer : StreamWriter
{
    public Printer() : base(Console.OpenStandardOutput())
    {
        AutoFlush = false;
    }
}
#endregion

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

#define fl(n)             for(long long int i=0;i<n;i++)
#define sz(a)             int((a).size())
#define tr(c,i)           for(auto i = (c).begin(); i != (c).end(); i++)
#define trr(c,i)          for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define present(c,x)      ((c).find(x) != (c).end())
#define cpresent(c,x)     (find(all(c),x) != (c).end())
#define vi                vector <int>
#define vvi               vector < vi >
#define pb                push_back
#define all(x)            (x).begin(),(x).end()
#define ll                long long
#define fr                first
#define sc                second
#define vc                vector
#define pii               pair<int,int>
#define msi               map<string,int>
#define mii               map<int,int>
#define psi               pair<string,int>
#define pis               pair<int,string>
#define M                 1000000007LL


int solve()
{
  int n;
  cin>>n;
  int d[n][2];
  for(int i=0;i<n;i++)
  {
    cin>>d[i][0]>>d[i][1];
  }

  for(int i=0;i<n-2;i++)
  {
    if(d[i][0]==d[i][1]&&d[i+1][0]==d[i+1][1]&&d[i+2][0]==d[i+2][1])
      return cout<<"Yes\n",0;
  }
  cout<<"No\n";


  return 0;
}


int main() {
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif

      ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);       

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




Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>

#define N (1000 + 10)

#define max(a, b) (a < b ? b : a)

int dp[N][N];

int LCS(char a[], char b[]){
  int tmp;
  
  const int a_size = strlen(a); // last one is '\n'
  const int b_size = strlen(b);
  int i, j;

  memset(dp, 0, sizeof(dp));

  for (i = 1; i < a_size + 1; ++i) {
    for (j = 1; j < b_size + 1; ++j){
      if (a[i - 1] == b[j - 1]){
        dp[i][j] = dp[i - 1][j - 1] + 1;
      }
      else{
	dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);
      }
    }
  }

  return dp[a_size][b_size];
}

int main(void){
  int n, i;
  char a[N], b[N];

  scanf("%d\n", &n);
  for ( i = 0; i < n; i++ ){
    scanf("%s",a);
    scanf("%s",b);
    printf("%d\n", LCS(a,b));
  }
  return 0;
}



Measured memory_bytes: 6724
import java.util.*

fun main(args: Array<String>) {
    val scn = Scanner(System.`in`)
    val N = scn.nextInt()

    var list = arrayListOf<Int>()

    for(i in 1 .. N){
        list.add(scn.nextInt())
    }
    list.sort()

    var min = Integer.MAX_VALUE
    for(i in list.first() .. list.last()){
        var sum = 0
        for(j in list){
            sum += (j-i)*(j-i)
        }

        if(sum<=min) min=sum
    }

    println(min)
}

Measured memory_bytes: 31384
#include<bits/stdc++.h>
using namespace std;
bool get(int a){
	int num=0;
	while(a!=0){
		a=a/10;
		num++;
	}
	if(num%2==1){
		return 1;
	}else{
		return 0;
	}
}
int main(){
	int n;
	cin>>n;
	int sum=0;
	for(int i=1;i<=n;i++){
		if(get(i)){
			sum++;
		}
	}
	printf("%d",sum);
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        int[] y = new int[n];
        int[] h = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt(); y[i] = sc.nextInt(); h[i] = sc.nextInt();
        }
        for (int cx = 0; cx <= 100; cx++) for (int cy = 0; cy <= 100; cy++) {
            int l = 0, r = 1000001000;
            while (r - l > 1) {
                int c = (l + r) / 2;
                int judge = 0;
                for (int i = 0; i < n; i++) {
                    int hgt = Math.max(c - Math.abs(x[i] - cx) - Math.abs(y[i] - cy), 0);
                    if (h[i] > hgt) judge = -1;
                    if (h[i] < hgt) judge = 1;
                    if (judge != 0) break;
                }
                if (judge == 0) {
                    System.out.println(cx + " " + cy + " " + c);
                    return;
                }
                if (judge == 1) r = c;
                if (judge == -1) l = c;
            }
        }
    }
}

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

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

  int maxel = 0, temp = 0;
  for(int i = 0; i < s.size(); i ++){
    if(s.at(i) == 'A' || s.at(i) == 'C' || s.at(i) == 'G' || s.at(i) == 'T')
      temp ++;
    else{
      if(maxel < temp)
        maxel = temp;
      temp = 0;
    }
  }

  cout << max(maxel, temp) << endl;

  return 0;
}


Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	int k, n; cin >> k >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    int ma = a[0] + (k - a[n - 1]);
    for(int i = 1; i < n; ++ i) {
        chmax(ma, a[i] - a[i - 1]);
    }
    cout << k - ma << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
#define N 1000

int main() {
    int i = 0,
        j = 0,
        len = 0,
        inp = 0,
        roop = 0,
        key = 0;
    int array[N];

    scanf("%d",&len);
    for ( i=0; i<len; i++ ) 
        scanf("%d",&array[i]);
    
        for(roop = 0; roop <len; roop++) {
            if(roop) printf(" ");
            printf("%d", array[roop]);
        }
        printf("\n");
    for ( j=1; j<len; j++) {
        key = array[j];
        i = j - 1;
        while(i >= 0 && array[i] >  key ) {
            array[i+1] = array[i];
            i--;
        }
        array[i+1] = key;
        for(roop = 0; roop <len; roop++) {
            if(roop) printf(" ");
            printf("%d", array[roop]);
        }
        printf("\n");
    }

    return 0;
}



Measured memory_bytes: 2072
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

//
// # Examples
//
// # integers
// input! { n: usize, m: usize, ... }
//
// # array
// input! { n: usize, v: [i32; n], }
//
// # matrix
// input! { n: usize, m: usize, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
//     h: usize,
//     w: usize,
//     board: [chars; h],
// }

// https://practice.contest.atcoder.jp/tasks/practice_1
//fn main() {
//    input!{
//        a: usize, b: usize, c: usize,
//        foo: chars,
//    }
//    let s: String = foo.into_iter().collect();
//    println!("{} {}", a+b+c, s);
//}

fn main() {
    input!{
        n: usize, k: usize
    }
    println!("{}", if n%k == 0 { 0 } else { 1 } );
}	

Measured memory_bytes: 4352
import java.util.Scanner;
import java.util.ArrayList;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		ArrayList<Integer> cnd = new ArrayList();
		for(int i = 1 ;i<=b;i++){
			int tmp = a*i%(b);
			if(cnd.contains(tmp) == false){
				cnd.add(tmp);
			}
		}
		if(cnd.contains(c)){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}
		
	}

}


Measured memory_bytes: 23764
#define TST 0
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <cctype>
#include <bits/stdc++.h>
#include <queue>

using namespace std;
// for loop
#define F(i, L, R) for(long i = L; i < R; i++)
#define FE(i, L, R) for(long i = L; i <= R; i++)
// for (reversed)
#define FR(i, L, R) for(long i = L; i > R; i--)
#define FRE(i, L, R) for(long i = L; i >= R; i--)

// data types
#define Int long
#define ul unsigned long
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned shoft

// vectors
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
#define ALL(c) (c).begin(),(c).end()
#define last(vec) vec.size()-1
#define lastEle(vec) vec[last(vec)]
#define pb push_back
#define InputV(a, n) F(i,0,n){long l; cin >> l; a.pb(l);}

// debug
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a, L, R) FE(i, L, R) cout << a[i] << (i==R?'\n':' ')
#define printAF(a, L) printA(a, 0, L-1)
#define printV(a) printA(a, 0, a.size()-1)

// utils
#define char2int(c) (c-'0')
#define bit(x, i) (x&(1<<i))
#define space ' '
#define PI 3.14159265358979323

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

void printM(vector<vector<int> > &vec, long height, long width){
    F(i, 0, height){
        F(j, 0, width){
            cout << vec[i][j] << space;
        }
    cout << endl;
    }
}

int main() {
#if TST==1
    ifstream in ("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    int n;
    cin >> n;
    vi x,y;
    x.resize(n);
    y.resize(n);
    F(i, 0, n) cin >> x[i];
    F(i, 0, n) cin >> y[i];
    vector<double> ansv;
    FE(p, 1, 3){
        double d = 0;
        F(i, 0, n){
            d += pow(abs(x[i] - y[i]), p);
        }
        d = pow(d, (double)1/p);
        ansv.pb(d);
    }
    int maxn = 0;
    F(i, 0, n){
       maxn = max(maxn, abs(x[i] - y[i]));
    }
    ansv.pb(maxn);
    F(i, 0, ansv.size()){
        printf("%1.8lf\n",ansv[i]);
    }


#if TST==1
#endif
}



Measured memory_bytes: 3400
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define FOR(i, j, k, in) for (int i = j; i < k; i += in)
#define RFOR(i, j, k, in) for (int i = j; i >= k; i -= in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string a, b;
    cin >> a >> b;
    int count = 0;
    REP(i, a.size()) {
        if (a[i] != b[i]) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 3816
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		boolean not[] = new boolean[1000000];
		
		not[0] = true;
		not[1] = true;
		
		for (int i = 2; i * i < 1000000; i++)
		{
			if (not[i]) continue;
			for (int x = (i << 1); x < 1000000; x += i)
			{
				if (not[x]) continue;
				not[x] = true;
			}
		}
		Scanner sc = new Scanner(System.in);
		
		while (true)
		{
			int a = sc.nextInt(),
				d = sc.nextInt(),
				n = sc.nextInt();
			if (a == 0 && d == 0 && n == 0)
			{
				break;
			}
			int m, count = 0;
			while (true)
			{
				if (!not[a])
				{
					count++;
					if (count == n)
					{
						break;
					}
				}
				a += d;
			}
			System.out.println(a);
		}
	}
}

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

const int N = (1e5) + 5;
char s[N];
int ans[N];

// claudio van
int main() {
  scanf("%s", s);
  int n = strlen(s);
  for (int i = 0; i + 1 < n; ++i) {
    if (s[i] == 'R' and s[i + 1] == 'L') {
      int l = i;
      int cnt = 0;
      while (l >= 0 and s[l] == 'R') {
        if (cnt % 2 == 0) {
          ans[i]++;
        } else {
          ans[i + 1]++;
        }
        l--;
        cnt++;
      }
      int r = i + 1;
      cnt = 0;
      while (r < n and s[r] == 'L') {
        if (cnt % 2 == 0) {
          ans[i + 1]++;
        } else {
          ans[i]++;
        }
        r++;
        cnt++;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    if (i != 0) printf(" ");
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
  int n;cin>>n;
  vector<int> a(n),b(n),c(n);
  for(int i = 0; n > i; i++)cin>>a[i];
  for(int i = 0; n > i; i++)cin>>b[i];
  for(int i = 0; n > i; i++)cin>>c[i];
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  sort(c.begin(),c.end());

  long long ans = 0;
  for(int i = 0; n > i; i++){
    auto y = upper_bound(a.begin(),a.end(),b[i]-1);
    auto z = lower_bound(c.begin(), c.end(),b[i]+1);
    ans += (y-a.begin())*(c.end()-z);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1408
import numpy as np
N, M = map(int,input().split())
H = list(map(int,input().split()))

goodpoint = [1]*N #1 is good point

for i in range (M):
    A, B = map(int,input().split())
    if H[A-1] <=H[B-1]:
        goodpoint[A-1] = 0
    if H[B-1] <=H[A-1]:
        goodpoint[B-1] = 0
print(sum((np.array(goodpoint)==1)*1))###aaaaaaaaああああああみすったあ


Measured memory_bytes: 38648