akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys


def solve(N: int):
    ans = []
    if N%2==0:
        for i in range(1, N+1):
            for j in range(i+1, N+1):
                if i+j==N+1:
                    continue
                ans.append([i, j])
    else:
        for i in range(1, N):
            for j in range(i+1, N):
                if i+j==N:
                    continue
                ans.append([i, j])
        for i in range(1, N):
            ans.append([N, i])

    print(len(ans))
    for elem in ans:
        print(elem[1], elem[0])

    #check(ans, N)

    return

def check(ans, N):
    import numpy as np
    print(np.sum(np.array(ans))//N)


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


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

int main(){
    int n;
    cin >> n;
    vector<int> t(n);
    int sum=0;
    for(int i=0; i<n; i++){
        cin >> t.at(i);
        sum+=t.at(i);
    }
    int m;
    cin >> m;
    vector<int> p(m), x(m);
    vector<int> dist(m);
    for(int i=0; i<m; i++){
        cin >> p.at(i) >> x.at(i);
    }

    int num;
    for(int i=0; i<m; i++){
        dist.at(i)=t.at(p.at(i)-1)-x.at(i);
        cout << sum-dist.at(i) << endl;
    }

}

Measured memory_bytes: 3620
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def main():
    a,b = map(int,input().split())
    lcm = (a*b)/gcd(a,b)
    print(int(lcm))
    return

if __name__=='__main__':
    main()

Measured memory_bytes: 38508
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;
 
        static void Main(string[] args)
        {
            var r = int.Parse(Console.ReadLine());
            Console.WriteLine((double)(2 * r * Math.PI));
 
        }
 
        static public long Input()
        {
            return long.Parse(Console.ReadLine());
        }
 
        static public string[] Input2()
        {
            return Console.ReadLine().Split();
        }
        
        static public long[] Input3()
        {
            string[] data = Console.ReadLine().Split();
            long[] res = new long[data.LongLength];
            for(long i = 0; i < data.LongLength; i++)
            {
                res[i] = long.Parse(data[i]);
            }
            return res;
        }
        public static long Choose(long n, long a)
        {
            long x = 1;
            long y = 1;
            for (long i = 0; i < a; i++)
            {
                x *= n - i;
                y *= i + 1;
            }
            return x / y;
        }
 
        public static long Gcd(long a, long b)
        {
            long x = Math.Max(a, b);
            long y = Math.Min(a, b);
            if (x % y == 0) return y;
            else return Gcd(y, x % y);
        }
 
        
       
    }
}

Measured memory_bytes: 27336
import java.util.*;
class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Integer[] ary = new Integer[3];
        for (int i = 0; i<ary.length ; i++){
            ary[i]= sc.nextInt();
        }
        Arrays.sort(ary);
        System.out.println(ary[0]+" "+ary[1]+" "+ary[2]);
    }
}



Measured memory_bytes: 26156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
typedef complex<double> P;
double dot(P a, P b){ //内積
    return (a.real() * b.real() + a.imag() * b.imag());
}

double cross(P a, P b){ //外積
    return (a.real() * b.imag() - a.imag() * b.real());
}

bool is_orth(P a1, P a2, P b1, P b2){ //垂直か
    return EQ(dot(a1 - a2, b1 - b2), 0.0);
}

bool is_para(P a1, P a2, P b1, P b2){ //平行か
    return EQ(cross(a1 - a2, b1 - b2), 0.0);
}

bool is_online(P a, P b, P c){ //cが線分上か
    return (abs(a-c) + abs(c-b) < abs(a-b) + EPS);
}

bool distance_lp(P a, P b, P c){ //直線abと点cの距離
    return abs(cross(b-a, c-a)) / abs(b-a);
}

double norm(P a){
  return a.real() * a.real() +a.imag() *a.imag();
}

ll ccw(P p0,P p1,P p2){
  P a = p1-p0;
  P b = p2-p0;
  if(cross(a,b) > EPS) return 1;
  if(cross(a,b) < -EPS) return -1;
  if(dot(a,b) < -EPS) return 2;
  if(abs(a) < abs(b)) return -2;
  return 0;
}

bool is_intersect(P p1, P p2, P p3, P p4){
  return (ccw(p1,p2,p3) * ccw(p1,p2,p4) <= 0 &&
      ccw(p3,p4,p1) * ccw(p3,p4,p2) <= 0 );
}

P intersect_pos(P a1, P a2, P b1, P b2){ //直線同士の交点
    P a = a2 - a1;
    P b = b2 - b1;
    return a1 + a * cross(b, b1 - a1) / cross(b, a);
}

double getDistanceLP(P a1, P a2, P b){
    return abs(cross(a2-a1, b-a1) / abs(a2 - a1));
}

double getDistanceSP(P a1, P a2, P b){
    if(dot(a2 - a1, b - a1) < EPS) return abs(b - a1);
    if(dot(a1 - a2, b - a2) < EPS) return abs(b - a2);
    return getDistanceLP(a1, a2, b);
}
double getDistance(P a1, P a2, P b1, P b2){
    if(is_intersect(a1, a2, b1, b2)) return 0.0;
    double v1 = min(getDistanceSP(a1, a2, b1), getDistanceSP(a1, a2, b2));
    double v2 = min(getDistanceSP(b1, b2, a1), getDistanceSP(b1, b2, a2));
    return min(v1,v2);
}

#define printP(P) cout << "(" << P.real() << ", " << P.imag() << ")" << endl;




int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    double x[110], y[110];
    vector<P> p;
    rep(i,0,N){
        cin >> x[i] >> y[i];
        P t(x[i], y[i]);
        p.push_back(t);

    }
    double ans = 0.0;
    rep(i,0,N){
        ans += cross(p[i%N], p[(i+1)%N]);
    }
    ans /= 2.0;
    printf("%.1f\n", ans);
}


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

#ifdef DEBUG
const int N = 20;
#else
const int N = 2e6;
#endif
int n, m, k;
string s, t;

auto naive() {
  vector<int> res(N);
  for(int i = 0; i < N; i++) {
    res[i] = ((s[i] - '0') << 1) + (t[i] - '0');
  }
  for(int t = 0; t < k; t++) {
    for(int i = 0; i < N; i++) {
      int inc = 0;
      if(res[i] == 3) res[i] = 0, inc = 3;
      for(int j = i - 1; j >= 0 && inc; j--) {
        int old = res[j];
        res[j] ^= inc;
        inc &= old;
      }
    }
  }
  return res;
}

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  cin >> n >> m >> k;
  cin >> s >> t;
  s = string(N - s.size(), '0') + s;
  t = string(N - t.size(), '0') + t;
  vector<int> data(N);
  stack<int> st;
  for(int i = 0; i < N; i++) {
    data[i] = ((s[i] - '0') << 1) + (t[i] - '0');
    int z = k;
    int inc = 0;
    if(z && data[i] == 3) inc = 3, data[i] = 0, z--;
    int now = i - 1;
    vector<int> v;
    if(data[i] == 1 || data[i] == 2) v.emplace_back(i);
    while(inc && now >= 0) {
      int nx = -1;
      if(st.size()) {
        nx = st.top();
        st.pop();
        // assert(data[nx] == 1 || data[nx] == 2);
        if(data[nx] == 1 || data[nx] == 2); else return 0;
      }
      assert(nx <= now);
      // if(nx <= now); else return 0;
      if(inc == 3) {
        int useZ = min(z, now - nx);
        z -= useZ;
        if(useZ == now - nx) {
          // assert(nx >= 0);
          if(nx >= 0); else return 0;
          inc = data[nx];
          data[nx] ^= 3; // inc
          v.emplace_back(nx);
          now = nx - 1;
        } else {
          data[now - useZ] = 3; // inc
          stack<int>().swap(st);
          break;
        }
      } else {
        if(now == nx) {
          // assert(nx >= 0);
          int old = data[nx];
          data[nx] = old ^ inc;
          if(z && data[nx] == 3) inc = 3, data[nx] = 0, z--;
          else {
            inc = old & inc;
          }
          if(data[nx] == 1 || data[nx] == 2) v.emplace_back(nx);
          now = nx - 1;
        } else {
          data[now] = inc;
          if(nx >= 0) st.push(nx);
          st.push(now);
          break;
        }
      }
    }
    reverse((v).begin(), (v).end());
    for(int e : v) st.push(e);
  }
  int g = 0;
  for(int i = 0; i < N; i++) {
    int a;
    g |= a = !!(data[i] & 0b10);
    if(g) cout << a;
  }
  cout << endl;
  g = 0;
  for(int i = 0; i < N; i++) {
    int a;
    g |= a = (data[i] & 0b01);
    if(g) cout << a;
  }
  cout << endl;
#ifdef DEBUG
  assert(data == naive());
#endif
  return 0;
}


Measured memory_bytes: 18928
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
    string S, T;
    cin >> S >> T;

    int count = 0;
    for (int i = 0; i < 3; i++) {
        if (S[i] == T[i]) count++;
    }

    cout << count << endl;
}

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

int n,m,q;
vector<int> a,b,c,d;
int ans;

void dfs(vector<int> A){
    if(A.size()==n+1){
        int now=0;
        rep(i,q){
            if(A[b[i]]-A[a[i]]==c[i]) now+=d[i];
        }
        ans=max(ans,now);
        return;
    }

    A.push_back(A.back());
    while (A.back()<=m)
    {
        dfs(A);
        A.back()++;
    }
    
}

int main() {
    
    cin>>n>>m>>q;
    a=b=c=d=vector<int>(q);
    rep(i,q){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
    }
    dfs(vector<int>(1,1));
    cout<<ans<<endl;
}



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

int main() {
   int a,b;
   cin>> a >> b;
   if(a>b){   
   cout<< "a > b" <<endl;
   }
   if(a<b){
    cout<< "a < b" <<endl;
   }
  if(a==b){
    cout<< "a == b" <<endl;
   }
  return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define e1 first
#define e2 second
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false)
#define eb emplace_back
#define OUT(x) {cout << x; exit(0); }
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define scanf(...) scanf(__VA_ARGS__)?:0
typedef long long int ll;
typedef unsigned long long ull;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;
typedef pair <PLL, int> PLLI;
typedef pair <PLL, PLL> PP;
typedef pair <PII, int> PPI;
typedef pair <ll, int> PLI;
typedef unsigned int ui;
const int inf = 1e9+9;
const int mod = 924844033;

const ll MOD = 1e9+696969;
const long long INF = 1e18+3;
ll fac[4010], invfac[4010];

ll potmod(ll a, ll b)
{
	ll res = 1;
	while (b > 0)
	{
		if (b & 1) res = (res * a ) % mod;
		a = (a * a)%mod;
		b /= 2;
	}
	return res;
}

inline ll binom(int n, int k)
{
	return fac[n] * invfac[k] % mod * invfac[n - k] % mod;
}
ll q[4010], c[4010], u, M[4010];

void mul(int x)
{
	int v = (x / 2) + 1;
	FOR(i, 0, v-1) q[i] = binom(x-i, i);
	FOR(i, 0, u+v-1) c[i] = 0;
	
	FOR(i, 0, u-1)
		FOR(j, 0, v-1) c[i+j] += (ll)M[i] * q[j], c[i+j]%=mod;
	
	FOR(i, 0, u+v-1) M[i] = c[i]; u += v-1;
}
int n, k;

int main()
{
	M[0] = 1; u = 1;
	fac[0] = 1; invfac[0] = 1;
	FOR(i, 1, 4000) 
	{
		fac[i] = fac[i-1] * i % mod;
		invfac[i] = potmod(fac[i], mod - 2);
	}
	boost;
	cin >> n >> k;
	FOR(i, 1, k)
	{
		int c = i, cnt = 0;
		while (c <= n) c+=k, ++cnt;
		mul(cnt);
		mul(cnt);
	}
	ll res = 0;
	for (int i=0; i<=n; ++i)
	{
		ll tmp = fac[n - i] * M[i]%mod;
		if (i & 1) res = (res + mod - tmp);
		else res += tmp;
		while (res >= mod) res -= mod;
	}
	cout << res;
	
}


Measured memory_bytes: 384
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>

#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>

#include <algorithm>

using namespace std;

int myCompare(pair<long long int, long long int> p1, pair<long long int, long long int> p2) {
	return p1.second > p2.second;
}

int main(int argc, char *argv[]) {
	int n, m;
	cin >> n >> m;
	
	vector<long long int> v;
	for (int i = 0; i < n; i++) {
		long long int t;
		cin >> t;
		v.push_back(t);
	}
	vector<pair<long long int, long long int> > vp;
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());
	for (int i = 0; i < m; i++) {
		long long int b, c;
		cin >> b >> c;
		vp.push_back(make_pair(b, c));
	}
	sort(vp.begin(), vp.end(), myCompare);

	long long int res = 0;

	int index = 0;
	int pindex = 0;
	int times = 0;
	while (times < n) {
		if (v[index] >= vp[pindex].second || pindex >= vp.size()) {
			res += v[index];
			index++;
			times++;
		}
		else {
			res += vp[pindex].second;
			times++;
			vp[pindex].first--;
			if (vp[pindex].first == 0)
				pindex++;
		}
		// cout << res << endl;
	}
	cout << res << endl;
	
}



Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int,int> P;
const int INF=(int)1e9;
const int MOD=(int)1e9+7;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
};



int main(){
  int N;
  cin>>N;
  if(N%2==0){
    cout<<N;
  }else{
    cout<<2*N;
  }

  return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,h,i,j,k,l,m,n,x,y;
	ll		ans = 0;
	string	s;
	cin >> a >> b >> c;
	
	ans = a + b + c - max(a , max(b,c));

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


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

int main()
{
	int N,M;
	while(cin >> N >> M,(N||M))
	{
		int a[1000],ans=0;
		for(int i=0; i<N; i++)
		{
			cin >> a[i];
			ans+=a[i];
		}

		sort(a,a+N);
		reverse(a,a+N);

		for(int i=M-1; i<N; i+=M)
			ans-=a[i];

		cout << ans << endl;
	}

}

Measured memory_bytes: 0
N, D = map(int, input().split())
points=[[]]*N
for i in range(N):
  points[i]=list(map(int, input().split()))
count=0
for i in range(N-1):
  for j in range(i+1,N,1):
    dist_sq=0
    for l in range(D):
      dist_sq+=(points[i][l]-points[j][l])**2
    dist=dist_sq**0.5
    if abs(dist-int(dist))<0.0001:
      count+=1
print(count)

Measured memory_bytes: 3064
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.print(a*b);
        System.out.print(" ");
        System.out.println((a+b)*2);
    }
}

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

int main() {
	int x, y;
	cin >> x >> y;
	if (y < 2 * x || y>4 * x || y % 2 == 1)cout << "No" << endl;
	else cout << "Yes" << endl;

}

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

typedef long long ll;
typedef long double ld;

map <int, int> ima;
int br;
int niz[100005];

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    int n;
    cin >> n;
    vector <int> vec;
    for(int i=1; i<=n; i++){
        cin >> niz[i];
        if(!ima[niz[i]]){
            br++;
            vec.push_back(niz[i]);
        }
        ima[niz[i]]++;
    }
    sort(vec.begin(), vec.end());
    if(br == 1 && vec[0] == 0){
        cout << "Yes";
        return 0;
    }
    if(br == 2 && vec[0] == 0 && n%3 == 0 && ima[0] == n/3){
        cout << "Yes";
        return 0;
    }
    if(br != 3){
        cout << "No";
        return 0;
    }
    int x = ima[niz[1]];
    for(int i=1; i<=n; i++){
        if(ima[niz[i]] != x){
            cout << "No";
            return 0;
        }
    }
    int y = 0;
    for(auto c : vec) y ^= c;
    if(y) cout << "No";
    else cout << "Yes";
    return 0;
}


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

int main()
{
 int n;
  cin>>n;
  string s;
  
  cin>>s;
  
    if(n>=3200)
    {
      cout<<s;
    }
    else
    {
      cout<<"red";
    }
  
  
  return 0;
  
}

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

typedef long long ll;
typedef long double ld;
typedef vector < ll > vl;
typedef vector < int > vi;
typedef vector < bool > vb;
typedef vector < vl > vvl;
typedef vector < vi > vvi;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < pll > vpll;
typedef vector < pii > vpii;
typedef vector < vpll > vvpll;
typedef vector < vpii > vvpii;

#define pb push_back
#define eb emplace_back
#define pf push_front
#define all(c) (c).begin(), (c).end()
#define ff first
#define ss second
#define mp(x,y) make_pair((x), (y))
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)



void solve(){
    
    int n; cin >> n;
    ll a[n];
    for(ll& u : a){ cin >> u; }
    int L = 0;
    ll money = 1000;
    for(int i = 0; i < n - 1; i++){
        if(a[i] > a[i + 1]){
            money = money / a[L] * a[i] + money % a[L];
            L = i + 1;
        }
    }
    money = money / a[L] * a[n - 1] + money % a[L];
    cout << money << '\n';
    
}


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

    boost;

    int t = 1;
    // cin >> t;


    for(int i = 1; i <= t; i++){
        // cout << "Case #" << i << ": ";

        solve();

    }
    return 0;
}

Measured memory_bytes: 3604
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE Strict #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RankNTypes #-}
import qualified Data.ByteString.Char8 as BS
import Data.ByteString.Char8 (ByteString, putStrLn)
import Prelude hiding (words, getLine, putStrLn, unwords, readLn, print)

import Control.Monad (replicateM)
import Data.List (foldl')
import Data.Maybe (isJust)


class (Read a, Show a) => CPString a where
  cpRead :: String -> a
  cpShow :: a -> ByteString
  cpRead = read
  cpShow = BS.pack . show
instance CPString ByteString where
  cpRead = BS.pack
  cpShow = id
instance CPString String where
  cpRead = id
  cpShow = BS.pack
instance CPString Char where
  cpRead [a] = a
  cpShow = BS.pack . pure
instance CPString Int
instance CPString Integer
instance CPString Float
instance CPString Double
instance CPString Rational
instance CPString a => CPString [a]

readLine :: CPString a => IO [a]
readLine = fmap (cpRead . BS.unpack) . BS.words <$> BS.getLine

printLn :: CPString a => a -> IO ()
printLn = putStrLn . cpShow

main :: IO ()
main = do
  [n] <- readLine @ByteString
  printLn $ if BS.count '7' n == 0 then "No" else "Yes" :: ByteString 

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

#define TRACE
#ifdef TRACE
#define TR(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define TR(...)
#endif

typedef long long                LL;
typedef vector < int >           VI;
typedef pair < int,int >         II;
typedef vector < II >            VII;

#define MOD                      1000000007
#define EPS                      1e-12
#define N                        200100
#define PB                       push_back
#define MP                       make_pair
#define F                        first 
#define S                        second
#define ALL(v)                   v.begin(),v.end()
#define SZ(a)                    (int)a.size()
#define FILL(a,b)                memset(a,b,sizeof(a))
#define SI(n)                    scanf("%d",&n)
#define SLL(n)                   scanf("%lld",&n)
#define PLLN(n)                  printf("%lld\n",n)
#define PIN(n)                   printf("%d\n",n)
#define REP(i,j,n)               for(LL i=j;i<n;i++)
#define PER(i,j,n)               for(LL i=n-1;i>=j;i--)
#define endl                     '\n'
#define fast_io                  ios_base::sync_with_stdio(false);cin.tie(NULL)

#define FILEIO(name) \
  freopen(name".in", "r", stdin); \
  freopen(name".out", "w", stdout);
 
inline int mult(int a , int b) { LL x = a; x *= LL(b); if(x >= MOD) x %= MOD; return x; }
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 ? MOD - b + a : a - b; }
LL powmod(LL a,LL b) { if(b==0)return 1; LL x=powmod(a,b/2); LL y=(x*x)%MOD; if(b%2) return (a*y)%MOD; return y%MOD; }

int x[55], y[55];
int a[55], b[55];

int dis (int x1, int y1, int x2, int y2) {
  return abs(x1-x2) + abs(y1-y2);
}

int main() {
  int n,m;cin >> n >> m;
  REP(i,0,n) {
    cin >> x[i] >> y[i];
  }
  REP(i,0,m) {
    cin >> a[i] >> b[i];
  }
  REP(i,0,n) {
    int mn = INT_MAX, idx = -1;
    REP(j,0,m) {
      if(dis(x[i], y[i], a[j], b[j]) < mn) {
        mn = dis(x[i], y[i], a[j], b[j]);
        idx = j+1;
      }
    }
    cout << idx << endl;
  }
  return 0;
}


Measured memory_bytes: 256
def main():

    N = int(input())
    mod = pow(10, 9) + 7

    if N == 1: return 0
    if N == 2: return 2

    v = 1
    for _ in range(N):
        v *= 8
        v %= mod
    u = 1
    for _ in range(N):
        u *= 9
        u %= mod
    w = 1
    for _ in range(N):
        w *= 10
        w %= mod

    a = w - (u-v) - (u-v) - v
    a %= mod
    return a




if __name__ == '__main__':
    print(main())


Measured memory_bytes: 63772
#include<math.h>
#include<map>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include<array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
#include<bitset>
#include <list>
//AtCoderC++.cpp

using namespace std;


inline int ceileing(int a, int b) {
	return a % b == 0 ? a / b : a / b + 1;
}

struct Trap {
	int center;//の左側
	int from, to;
	Trap(int c, int f, int t) :center{ c }, from{ f }, to{ t }{}
};

void cout_trap(Trap t) {
	int left_count = (t.center - t.from) / 2 + 1;//自分も
	//終わりは偶数回目
	left_count += (t.to - t.center) / 2;
	int right_count = t.to - t.from - left_count + 1;
	cout << left_count << " " << right_count << " ";
}

int main() {
	string S; cin >> S;
	int Length = S.length();
	auto traps = queue<Trap>();
	int left_end = 0; int center;
	for (size_t i = 1; i < S.length(); i++) {
		if (S[i] == 'L') {
			center = i - 1;
			while (i < Length&&S[i] != 'R') { ++i; }
			traps.push(Trap(center,left_end, i - 1));
//						cout << left_end << "--" << center << "--" << i - 1 << endl;
			left_end = i;
		}
	}

	for (size_t i = 0; i < Length; i++) {
		if (i < traps.front().center) {
			cout << "0 ";
		} else if (i == traps.front().center) {
			cout_trap(traps.front());
			++i;
			if (traps.front().to == Length - 1) {
				while (i != traps.front().to) {
					cout << "0 ";
					++i;
				}
				cout << endl;
				break;
			}
			traps.pop();
		}
	}
}


Measured memory_bytes: 1152
n, m, q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(q)]
ans = 0

def dfs(A:list):
    global n, m, q, ans
    if (len(A) == n+1):
        now = 0
        for i in range(q):
            if (A[abcd[i][1]] - A[abcd[i][0]] == abcd[i][2]):
                now += abcd[i][3]
        ans = max(now, ans)
        return
    
    for v in range(A[-1],m+1):
        A.append(v)
        dfs(A)
        A[-1] += 1
        A.pop()

        
dfs([1])

print(ans)



Measured memory_bytes: 9224
//https://atcoder.jp/contests/dp/tasks/dp_c
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;

#define f(i,a,b) for(int i = a;i<b;i++)
#define rep(i,a,b) for(int i = a;i<=b;i++)
#define fd(i,a,b) for(int i = a;i>b;i--)
#define repd(i,a,b) for(int i = a;i>=b;i--)

#define pii pair<int,int>
#define pll pair<ll,ll>

#define fi first
#define se second
#define pb push_back
#define sz(x) (int) (x).size()
#define all(x) x.begin(),x.end()
using namespace std;
const int mod = 1000000007;
const int maxn = 200000;
int main(){
    int n;
    cin>>n;
    vector<int> a(n),b(n),c(n);
    f(i,0,n) cin>>a[i]>>b[i]>>c[i];
    vector<vector<ll>> dp(n,vector<ll>(3,0));
    dp[0][0] = a[0];dp[0][1] = b[0];dp[0][2] = c[0];
    f(i,1,n){
        dp[i][0] = a[i] + max(dp[i-1][1],dp[i-1][2]);
        dp[i][1] = b[i] + max(dp[i-1][0],dp[i-1][2]);
        dp[i][2] = c[i] + max(dp[i-1][0],dp[i-1][1]);
    }    
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;

}

Measured memory_bytes: 9868
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

#define say(args) cout << (args) << endl
#define rep(i, a) for (int i = 0; i < a; i++)

using namespace std;

const int DEV_NUM = 1e9 + 7;

int64_t factorial(int64_t num) {
  return num == 1 ? 1 : (num * factorial(num - 1)) % DEV_NUM;
}

int main() {
  int n, m;
  cin >> n >> m;
  int sub = abs(n - m);
  int64_t ans;
  if (sub == 0) {
    int64_t factorial_num = factorial(n);
    ans = ( (factorial_num * factorial_num) % DEV_NUM ) * 2 % DEV_NUM;
  }
  else if (sub == 1) {
    ans = factorial(n) * factorial(m) % DEV_NUM;
  }
  else {
    ans = 0;
  }
  say(ans);
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] xs = new int[n];
		for (int i = 0; i < n; i++) {
			xs[i] = sc.nextInt();
		}
		int min = Integer.MAX_VALUE;
		for (int p = 0; p < 101; p++) {
			int temp = 0;
			for (int x : xs) {
				int t = (x - p);
				t = t * t;
				temp = temp + t;
			}
			min = Math.min(min, temp);
		}
		System.out.println(min);
	}
}


Measured memory_bytes: 23124
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define WRAP(y,x,h,w) (0<=y && y<h && 0<=x && x<w)

typedef long long ll;
typedef unsigned long long ull;
typedef string str;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1,0,1,0 }; const int dy[] = { 0,1,0,-1 };
int N, K, S;
vvi box;
vector<vector<pii>> G(N);
ll ans;
bool isconnect(int b1,int b2) {
	return (abs(box[b1][0]- box[b2][0])<S)&& (abs(box[b1][1] - box[b2][1])<S) && (abs(box[b1][2] - box[b2][2])<S);
}

int calc(int b1, int b2) {
	int sub[3];
	REP(i,3)
	 sub[i]=(S -abs(box[b1][i] - box[b2][i]));
	return 2*(sub[0]*sub[1]+sub[1]*sub[2]+sub[2]*sub[0]);
}
void dfs(int now,int root,int pre,int depth,ll point) {
	if (depth == K-1) {
		if (!G[now].empty()) {
			REP(i, G[now].size()) {
				if (G[now][i].first == root) {
					point += G[now][i].second;
			}
			}
		}
		ans=min(ans, 1LL * S*S * 6 * K - point);
		return;
	}
	if (!G[now].empty()) {
		REP(i, G[now].size()) {
			if (G[now][i].first != pre&&G[now][i].first != root) {
				dfs(G[now][i].first, root, now, depth + 1, point + G[now][i].second);
			}
		}
	}
}
int main() {
	while (cin>>N>>K>>S,N) {
		box.clear();
		box.resize(N, vi(3));
		REP(i,N) {
			REP(j, 3)
				cin >> box[i][j];
		}
		G.clear();
		G.resize(N);
		REP(i, N) {
			REP(j, N) {
				if(i!=j)
				if (isconnect(i, j)) {
					G[i].push_back({ j,calc(i,j) });
				}
			}
		}
		ans = 1e9;
		if (K == 1)
			ans = S*S * 6;
		if(K==2)
			REP(i,N)
			if (!G[i].empty()) {
				REP(j, G[i].size())
					ans = min(ans,1LL*S*S * 6*2 - G[i][j].second);
			}
		if(K>=3)
		REP(i, N) {
			dfs(i,i, -1, 0,0);
		}
		if (ans == 1e9) {
			cout << -1 << endl;
		}
		else {
			cout << ans << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3240
#include<iostream>
#include<climits>
#include<cstring>
#define inf 1e18
using namespace std;
long long int a[401];
long long int dp[404][404];
long long int sum(int i, int k)
{	long long int sum = 0;
	for (int s = i; s <= k; s++)
	{
		sum = (sum + a[s]);
		// sum=sum%100;
	}
	return sum;
}
long long int mixture(int i, int j)
{	if (i >= j)
		return 0;
	if (dp[i][j] != -1)
		return dp[i][j];

	dp[i][j] = inf;
	for (int k = i; k <= j; k++)
		dp[i][j] = min(dp[i][j], mixture(i, k) + mixture(k + 1, j) + sum(i, k) + sum(k + 1, j));
	return dp[i][j];


}
int main()
{
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	memset(dp, -1, sizeof(dp));
	cout << mixture(0, n - 1);

}

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

int main(){
	int N,M;
	cin >> N >> M;
	map<pair<int,int>,int> mp;
	rep(i,M){
		int a,b;
		cin >> a >> b;
		a--;b--;
		mp[make_pair(a,b)]++;
		mp[make_pair(b,a)]++;
	}
	
	vector<int> d(N);
	rep(i,N){
		d[i] = i;
	}
	
	int ans = 0;
	
	do{
		bool ok = true;
		if(d[0] != 0) continue;
		//間に辺がなかったらアウト
		rep(i,N-1){
			if(mp[make_pair(d[i], d[i+1])] == 0) ok = false;
		}
		if(ok) {
			ans++;
		}
	}while(next_permutation(d.begin(),d.end()));
	
	cout << ans << endl;
    return 0;
}




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

int main(){
  int a;
  int ac = 0, wa = 0, tle = 0, re = 0;
  cin >> a;
  for(int i = 0; i < a; i++){
    string s;
    cin >> s;
    if(s == "AC") ac++;
    else if(s == "WA") wa++;
    else if(s == "TLE") tle++;
    else re++;
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <queue>
#include <vector>
using namespace std;

struct Process {
    string name;
    int time;
};

void print(const vector<Process> &vec) {
    for (const auto &v : vec) cout << v.name << " " << v.time << endl;
}

vector<Process> simulate(queue<Process> &queue, int q) {
    vector<Process> result;
    int time = 0;

    while (!queue.empty()) {
        Process proc = queue.front();
        queue.pop();
        if (proc.time > q) {
            proc.time -= q;
            queue.push(proc);
            time += q;
        } else {
            int tmpTime = proc.time;
            proc.time += time;
            result.push_back(proc);
            time += tmpTime;
        }
    }

    return result;
}

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

    queue<Process> queue;

    for (int i = 0; i < n; i++) {
        string name;
        int time;
        cin >> name >> time;
        queue.push({name, time});
    }

    vector<Process> result = simulate(queue, q);
    print(result);
}

Measured memory_bytes: 7072
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  string S;
  int A,B;
  cin >> A >> B >> S;
  for(int i=0;i<(int)S.size();i++){
    if(i==A){
      if(S[i] != '-'){
        cout << "No" << endl;
        return 0;
      }
    }
    else{
      if(S[i] == '-'){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

int main(void){
    int n;
    ll base = 1;
    cin >> n;
    for(ll i=1; i<n+1; i++){
        base = base * i % (ll)(1e9+7);
    }
    cout << base << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define y_n(ans) cout<<(ans?"Yes":"No")<<endl;

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> a(n), b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    vector<long long> sa(n+1), sb(m+1);
    rep(i, n) sa[i+1] = sa[i] + a[i];
    rep(i, m) sb[i+1] = sb[i] + b[i];
    int ans = 0;
    for (int i=0; i<=n; ++i) {
        long long rm = k - sa[i];
        if (rm < 0) break;
        auto iter = upper_bound(sb.begin(), sb.end(), rm);
        int bn = iter - sb.begin() - 1;
        ans = max(ans, i + bn);
    }
    cout << ans << endl;
}


Measured memory_bytes: 8004
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	deque<char>s;
	string fi;
	cin>>fi;
	for(ll i=0;i<fi.size();i++){
		s.push_back(fi[i]);
	}
	ll n;
	cin>>n;
	ll ch=1;
	for(ll i=0;i<n;i++){
		ll t;
		cin>>t;
		if(t==2){
			ll now;
			char next;
			cin>>now;
			cin>>next;
			if(ch==now){
				s.push_front(next);
			}
			else{
				s.push_back(next);
			}
		}
		else{
			if(ch==1){
				ch=2;
			}
			else{
				ch=1;
			}
		}
	}
	if(ch==1){
		while(s.size()!=0){
			cout << s.front();
			s.pop_front();
		}
	}
	else{
		while(s.size()!=0){
			cout << s.back();
			s.pop_back();
		}
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 896
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        try(Scanner sc = new Scanner(System.in)){
            int w = sc.nextInt();
            int n = sc.nextInt();
            int[] values = new int[w];
            for(int i=0;i<values.length;i++){
                values[i]=i+1;
            }
            for(int i=0;i<n;i++){
                String str = sc.next();
                String[] ab = str.split(",");
                int a = Integer.parseInt(ab[0])-1;
                int b = Integer.parseInt(ab[1])-1;
                int c;
                c=values[a];
                values[a]=values[b];
                values[b]=c;
            }
            for(int i=0;i<values.length;i++){
                System.out.println(values[i]);
            }
        }
    }
}


Measured memory_bytes: 25884
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
#define fst first
#define snd second
const ll UNDEF = -1;
const ll INF=1e15;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

template<class T> T extgcd(T a, T b, T& x, T& y) { for (T u = y = 1, v = x = 0; a;) { T q = b / a; swap(x -= q * u, u); swap(y -= q * v, v); swap(b -= q * a, a); } return b; }
template<class T> T mod_inv(T a, T m) { T x, y; extgcd(a, m, x, y); return (m + x % m) % m; }
ll mod_pow(ll a, ll n, ll mod) { ll ret = 1; ll p = a % mod; while (n) { if (n & 1) ret = ret * p % mod; p = p * p % mod; n >>= 1; } return ret; }
const ll MAXFACT=2e5+4;
ll fact[MAXFACT+1],invfact[MAXFACT+1];
inline ll mul(ll x,ll y) {return (x*y)%MOD;}
void init() {
  ll got=1;
  for (ll x=0;x<=MAXFACT;x++) {
    fact[x]=got;
    got=mul(got,x+1);
  }
}

const ll mn=2e5+4;
ll cheapest[mn];
ll colcnt[mn];
void solve(long long n, long long X, long long Y, vector<long long> c, vector<long long> w){
	for (ll col=1;col<=n;col++) {
		cheapest[col]=INF;
	}
	for (ll i=0;i<n;i++) {
		chkmin(cheapest[c[i]],w[i]);
	}
	pll cheap[3]; cheap[0]=MP(INF,INF); cheap[1]=MP(INF,INF);
	for (ll col=1;col<=n;col++) {
		chkmin(cheap[0],MP(cheapest[col],col));
	}
	for (ll col=1;col<=n;col++) {
		if (col!=cheap[0].snd) chkmin(cheap[1],MP(cheapest[col],col));
	}
	if (cheap[0].fst+cheap[1].fst>Y) {
		cheap[1]=MP(INF,INF);
	}
	ll all=0;
	for (ll i=0;i<n;i++) {
		bool can=false;
		ll col=c[i];
		cheap[2]=MP(cheapest[col],col);
		ll klim=2;
		if (cheap[0].fst+cheap[2].fst<=Y) {
			klim++;
		}
		for (ll k=0;k<klim;k++) {
			ll lim;
			if (c[i]==cheap[k].snd) lim=X;
			else lim=Y;
			if (w[i]+cheap[k].fst<=lim) {
				//printf("i:%d\n",i);
				colcnt[c[i]]++;
				all++;
				break;
			}
		}
	}
	init();
	ll denom=1;
	for (ll col=1;col<=n;col++) {
		denom=(denom*fact[colcnt[col]])%MOD;
	}
	ll numer=fact[all];
	ll final=(numer*mod_inv(denom, MOD))%MOD;
	printf("%lld\n",final);
}

int main(){	
	long long X;
	long long N;
	long long Y;
	scanf("%lld",&N);
	vector<long long> w(N-1+1);
	vector<long long> c(N-1+1);
	scanf("%lld",&X);
	scanf("%lld",&Y);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&c[i]);
		scanf("%lld",&w[i]);
	}
	solve(N, X, Y, c, w);
	return 0;
}



Measured memory_bytes: 12800
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<fstream>
#include<vector>
#include<array>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>

#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#endif

//4Head

#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(nullptr));

ll const mod = 1e9 + 7;

namespace {
	ll mul(ll a, ll b) {
		ll val = a * b - (ll)((ld)a * b / mod) * mod;
		if (val < 0) val += mod;
		if (val >= mod) val -= mod;
		return val;
	}

	ll poww(ll a, ll b) {
		ll val = 1;
		a %= mod;
		while (b > 0) {
			if (b % 2) val = mul(a, val);
			a = mul(a, a);
			b >>= 1;
		}
		return val % mod;
	}

	ll inv(ll a) {
		return poww(a, mod - 2);
	}
}

int const maxn = 3e5 + 5;

ll a[15][1008];
char aa[15][1008];

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

	ll n, m; cin >> n >> m;
	ll k; cin >> k;

	for (ll i = 0; i < n; i++) {
		for (ll j = 0; j < m; j++) {
			cin >> aa[i][j];
		}
	}

	for (ll i = 0; i < n; i++) {
		for (ll j = 0; j < m; j++) {
			a[i][j] = (aa[i][j] == '1');
		}
	}


	ll ans = LLONG_MAX;

	for (int mask = 0; mask < (1 << (n - 1)); mask++) {
		vector<int>kek(n);
		ll id = 0;
		ll lol = 0;
		for (int i = 0; i < n; i++) {
			kek[i] = id;
			if (mask & (1 << i)) lol++, id++;
		}
		vector<int>cnt(id + 1);

		bool okey = true;
		for (int j = 0; j < m; j++) {
			if (!okey) break;
			bool ok = true;
			vector<int>rofl(id + 1);
			for (int i = 0; i < n; i++) {
				rofl[kek[i]] += a[i][j];
			}
			for (int i = 0; i < n; i++){
				int idd = kek[i];
				if (cnt[idd] + rofl[idd] > k) {
					ok = false;
				}
			}
			if (ok) {
				for (int i = 0; i < n; i++) {
					int idd = kek[i];
					cnt[idd] += a[i][j];
				}
			} else {
				lol++;
				for (int i = 0; i <= id; i++) {
					cnt[i] = 0;
				}
				ok = true;
				for (int i = 0; i < n; i++) {
					int idd = kek[i];
					if (cnt[idd] + rofl[idd] > k) {
						ok = false;
					}
				}
				if (!ok) {
					okey = false;
					break;
				} else {
					for (int i = 0; i < n; i++) {
						int idd = kek[i];
						cnt[idd] += a[i][j];
					}
				}
			}

		}

		if (okey) {
			ans = min(ans, lol);
		}
	}

	cout << ans << endl;

	return 0;
}

/*
5
2 6 15 5 10

4
2 6 15 5

*/

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define GET_BIT(n, i) (((n) & (1LL << ((i)-1))) >> ((i)-1)) // i start from 1
#define SET_BIT(n, i) ((n) | (1LL << ((i)-1)))
#define CLR_BIT(n, i) ((n) & ~(1LL << ((i)-1)))
typedef pair<int, int>  pii;
typedef pair<ll, ll>  pl;
typedef vector<int>   vi;
typedef vector<ll>    vl;
typedef vector<pii>   vpii;
typedef vector<pl>    vpl;
typedef vector<vi>    vvi;
typedef vector<vl>    vvl;
void myInit();
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int MOD = 1000000007;
const int N = 3e5, M = N;
//=========TQR==============
vi g[N];

int main() {
	myInit();
	FIO;
	float d, t, s;
	cin >> d >> t >> s;
	if (t >= d / s) {
		cout << "Yes\n";
	}
	else
		cout << "No\n";
	return 0;
}

void myInit() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int mpow(int base, int exp) {
	base %= MOD;
	int result = 1;
	while (exp > 0) {
		if (exp & 1) result = ((ll)result * base) % MOD;
		base = ((ll)base * base) % MOD;
		exp >>= 1;
	}
	return result;
}

void ipgraph(int n, int m) {
	int i, u, v;
	while (m--) {
		cin >> u >> v;
		g[u - 1].pb(v - 1);
		g[v - 1].pb(u - 1);
	}
}

void dfs(int u, int par) {
	for (int v : g[u]) {
		if (v == par) continue;
		dfs(v, u);
	}
}

Measured memory_bytes: 10704
from collections import Counter
N = int(input())
Dcounter = Counter(list(map(int, input().split())))
M = int(input())
Tcounter = Counter(list(map(int, input().split())))
for key in Tcounter.keys():
    if Dcounter.get(key, 0) < Tcounter[key]:
        print("NO")
        break
else:
    print("YES")


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

using namespace std;

typedef long long int li;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

vi par;

li root(li a)
{
    while(a!=par[a])
    {
        par[a]=par[par[a]];
        a=par[a];
    }

    return a;
}

void unio(li a,li b)
{
    par[root(a)]=root(b);
}



    
int main()
{    
    

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

    li n;

    cin>>n;

    string s;

    cin>>s;

    // li n=s.length();

    li cnt=0;

    f(i,0,n-3)
    {
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
        {
            cnt++;
            i+=2;
        }
    }

    cout<<cnt;

    return 0;
}

Measured memory_bytes: 256
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu) FUNC(printe) FUNC(printe0);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

struct Trie {
	char ch;
	Trie* par = nullptr;
	map<char, Trie*> dests;
    int nums[26] = {};
    bool leaf = false;
	Trie(){ }
	Trie(Trie* n):Trie() { par = n; }
	Trie* add(string& str, vector<int>& azs, int idx = -1){
        if(idx >= 0){
            ch = str[idx];
            azs[ch - 'a']--;
        }
        for(int i = 0; i < 26; i++){
            nums[i] += azs[i] > 0;
        }
        printde(ch, nums);
		if((int)str.size() == idx + 1){ leaf = true; return this; }
		char next = str[idx + 1];
		if(!dests.count(next)){
			dests[next] = new Trie(this);
		}
		return dests[next]->add(str, azs, idx + 1);
	}

	ll calc(){
        ll ret = 0;
        printde(ch, dests.size());
        if(leaf){
            ret = par->nums[ch - 'a'] - 1;
            printde(ch, ret, par->ch, par->nums[ch - 'a']);
        }
        for(auto& dest : dests){
            ret += dest.second->calc();
        }
        return ret;
    }
};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int n; cin >> n;
    Trie root;
    // root.nodes.reserve(100000);
    vector<int> azs(26);
    for(int i = 0; i < n; i++){
        string s; cin >> s;
        reverse(s.begin(), s.end());
        azs.assign(26, 0);
        for(auto& c : s){
            azs[c - 'a']++;
        }
        root.add(s, azs);
    }
    cout << root.calc() << '\n';
}
/*
a
ba
abc
dabc
eabdc
*/


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

int main() {
    string s[3];
    rep(i, 3) cin >> s[i];

    int t = 0;
    vector<int> idx(3);
    while (true) {
        if (s[t].size() == idx[t]) {
            cout << char('A' + t) << endl;
            return 0;
        }
        t = s[t][idx[t]++] - 'a';
    }

    return 0;
}


Measured memory_bytes: 3612
#include <iostream>

int main() {
	int k, x;

	std::cin >> k;
	std::cin >> x;

	int min = x-(k-1);
	int max = x+(k-1);
	for (int n = min; n <= max; n++) {
		std::cout << n;
		if (n != max) {
			std::cout << " ";
		}
	}
	std::cout << std::endl;

	return 0;
}


Measured memory_bytes: 256
s = gets.strip.split('')

if s.length==1
  p s.shift.to_i
  exit
end

r = 0
(2**(s.length-1)).times do |i|
  symbols = ("%0#{s.length-1}b" % i).split('').map(&:to_i).map {|e| e.zero? ? '+' : '' }
  r += eval(s.zip(symbols).flatten.compact.join(''))
end

p r


Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;
using Graph = vector<vector<int>>;

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> H(N);
    REP(i,N) cin >> H[i];
    sort(H.begin(),H.end());
    reverse(H.begin(),H.end());
    ll ans = 0;
    REP(i,N){
        if(i < K) continue;
        else ans += H[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4048