akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdbool.h>
#include <string.h>

bool prime[10000005];
int  scale[1005];

void make_prime_table(void);

int main()
{
    int cnt = 0;
    make_prime_table();
    for (int i = 1; i <= (int)(1e7) - 8; i++) {
        if (prime[i] &&
            prime[i + 2] &&
            prime[i + 6] &&
            prime[i + 8]) {

            scale[cnt] = i + 8;
            cnt++;
        }
    }
    scale[cnt] = (int)(1e8);

    
    int n;
    while (scanf("%d", &n), n != 0) {
        int valid = 0;
        int invalid = cnt;
        int mid;

        while (invalid - valid > 1) {
            mid = (invalid + valid) / 2;

            if (scale[mid] <= n) {
                valid = mid;
            }
            else {
                invalid = mid;
            }
        }

        printf("%d\n", scale[valid]);
    }
}

void make_prime_table(void)
{
    memset(prime, true, sizeof(prime));

    prime[0] = prime[1] = false;

    for (int i = 2; i <= (int)(1e7); i++) {
        if (prime[i]) {
            for (int j = i + i; j <= (int)(1e7); j += i) {
                prime[j] = false;
            }
        }
    }
}



Measured memory_bytes: 11480
N = int(input())
q = [None] * N
t = [None] * N
ans = 0
for i in range(N):
    q[i], t[i] = input().split()

for i, v in enumerate(t):
    if v == "JPY":
        ans += int(q[i])
    else:
        ans += float(q[i]) * 380000

print(ans)


Measured memory_bytes: 3060
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] data = new int[3];

    for (int i = 0; i < 3; i++) {
      data[i] = sc.nextInt();
    }

    Arrays.sort(data);

    String x = data[2] +""+ (int)data[1];
    int y = Integer.parseInt(x);
    System.out.println(y + data[0]);


  }

}


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

using namespace std;

#define INF 210000000
#define int long long

bool cmp(int a,int b){
		return a > b;
}

signed main() {
		int sx,sy,tx,ty;
		cin >> sx >> sy >> tx >> ty;
		string ans1 = "";
		string ans2 = "LU";
		string ans = "";
		for(int i=0;i<ty-sy;i++){
				ans1 += 'U';
				ans2 += 'U';
		}
		for(int i=0;i<tx-sx;i++){
				ans1 += 'R';
				ans2 += 'R';
		}
		ans2 += "RDRD";
		for(int i=0;i<ty-sy;i++){
				ans1 += 'D';
				ans2 += 'D';
		}
		for(int i=0;i<tx-sx;i++){
				ans1 += 'L';
				ans2 += 'L';
		}
		ans2 += "LU";
		cout << ans1 + ans2 << endl;
}


Measured memory_bytes: 256
const input = require("fs").readFileSync("/dev/stdin", "utf8").trim();

const lines = input.split('\n');
const [_, text, ...indexes] = lines;
const textArray = text.split('');

const [acMap] = textArray.reduce(([acMap, prevCount, prevChar], c, i) => {
    const count = prevChar === 'A' && c === 'C' ? prevCount + 1 : prevCount;
    acMap[i] = count;
    return [acMap, count, c];
}, [[], 0, '']);

indexes.forEach((line) => {
    const [i, j] = line.split(' ').map(Number);
    console.log(acMap[j - 1] - acMap[i - 1]);
});


Measured memory_bytes: 36464
N=int(input())

a=[int(i) for i in input().split()]
a.sort()


#1匹からでは不可能なので
if a[-1]-a[0]>1:
	print("No")
else:
	#全部が同じではない場合
	for i in range(1,N):
		#a[i]の要素が1個増えたタイミング
		if a[i]!=a[0]:
			if 1<=a[-1]-i<=int((N-i)/2):
				print("Yes")
			else:
				print("No")
			break
	else:
		#全部同じ場合
		if 1<=a[0]<=int(N/2) or a[0]==N-1:
			print("Yes")
		else:
			print("No")


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, m, x, a[100], b[2];

int main() {
	cin >> n >> m >> x;
	inc(i, m) { cin >> a[i]; }
	
	inc(i, m) { b[a[i] < x ? 0 : 1]++; }
	
	cout << min(b[0], b[1]) << endl;
	
	return 0;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class ConnectNodeInfo{
	vector<vector<pair<ll,ll>>> graph;
public:
	ConnectNodeInfo(int node_num){
		graph.resize(node_num);
	}
	void AddNonDirectionalConnection(ll u,ll v,ll w){
		graph[u].emplace_back(v,w);
		graph[v].emplace_back(u,w);
	}
	void AddDirectionalConnection(ll u,ll v,ll w){
		graph[u].emplace_back(v,w);
	}
	vector<pair<ll,ll>>& operator[](ll index){
		return graph[index];
	}
	size_t size(){return graph.size();}
};

void DFS(ConnectNodeInfo& connection,ll child,ll parent,vector<ll>& C,vector<ll>& V,ll& cnt,ll& score){
	for(int i = 0;i < connection[child].size();i++){
		if(connection[child][i].first != parent){
			ll nc = connection[child][i].first;
			V[nc] = C[cnt++];
			score += min(V[child],V[nc]);
			DFS(connection,nc,child,C,V,cnt,score);
		}
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N=in();
	ConnectNodeInfo connect(N);
	REP(i,N-1){
		int u=in()-1,v=in()-1;
		connect.AddNonDirectionalConnection(u,v,1);
	}
	vector<ll> C=vecin<ll>(N);
	sort(ALL(C),greater<ll>());

	vector<ll> V(N,0);
	V[0] = C[0];
	ll cnt = 1;
	ll score = 0;
	DFS(connect,0,-1,C,V,cnt,score);

	out(score);
	PRINTALL(V);
	return 0;
}


Measured memory_bytes: 2304
package main

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

func main() {
	A := nextInt()
	B := nextInt()
	fmt.Println(min(B/A, nextInt()))
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

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

	return i
}

func nextFloat() float64 {
	sc.Scan()
	f64, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}

	return f64
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func abs(x int) int {
	return int(math.Abs(float64(x)))
}

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

// ---------- Util.


Measured memory_bytes: 640
#include <iostream>
#include <string>

using namespace std;

string s[8];

void bomb(int y, int x){// 4 1

  for( int i = 1 ; i <= 3 ; i++ ){ // x座標右
    if( x + i > 7 )break;
    else if( s[y][x + i] == '1' ){
      s[y][x + 1] = '0';
      bomb( y , x + i );
    }
  }
  for( int i = 1 ; i <= 3 ; i++ ){ // x座標左
    if( x - i < 0 )break;
    else if( s[y][x - i] == '1' ){
      s[y][x - i] = '0';
      bomb( y , x - i );
    }
  }
  for( int i = 1 ; i <= 3 ; i++ ){ // y座標下
    if( y + i > 7 )break;
    else if( s[y + i][x] == '1' ){
      s[y + i][x] = '0';
      bomb( y + i , x );
    }
  }
  for( int i = 1 ; i <= 3 ; i++ ){ // y座標上
    if( y - i < 0 )break;
    else if( s[y - i][x] == '1' ){
      s[y - i][x] = '0';
      bomb( y - i , x );
    }
  }


}

int main(void){

  int cnt = 1;
  int n;
  cin >> n;
  while(n--){

    for( int i = 0 ; i < 8 ; i++ ){
      cin >> s[i];
    }
    int x,y;
    cin >> x >> y;
    s[--y][--x] = '0';
    bomb( y , x ); 
    cout << "Data " << cnt++ << ":" << endl;
    for( int i = 0 ; i < 8 ; i++ ){
      cout << s[i] << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1208
(defun app ()
    (let ((n (read))
        (c 0)
        (ans ""))

        (loop while (< 0 n) do
        (progn
            (decf n)
            (setq c (rem n 26))
            (setq n (floor (/ n 26)))
             
            (setq ans (format nil "~A~A" ans (code-char (+ c 65))))
        )
        )
        (if (= (length (string ans)) 1)
                (princ (string-downcase ans))
                (format t "~(~A~%~)" (reverse ans))
        )
    )
    
)
(app)


Measured memory_bytes: 24488
N = int(input())
S = input()

max_number = 0

for i in range(1, N):

    pre = S[0:i]
    post = S[i:]

    pre_dic = {}
    post_dic = {}

    for c in pre:
        pre_dic[c] = True

    for c in post:
        post_dic[c] = True

    number = 0

    for c in post_dic:
        if c in pre_dic:
            number += 1

    max_number = max(max_number, number)

print(max_number)


Measured memory_bytes: 39024
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define ll long long

int main() {
	int n ,c , k;
	cin >> n >> c >>k;
	int arr[n] ;
	for (int i = 0 ; i < n ; i++) cin >> arr[i];
	sort (arr, arr+n);
	ll ans = 1;
	ll sum = arr[0] + k;
	int num = 1;

	for (int i = 1 ; i< n ; i++ ){
		if (arr[i] > sum || num >=c ){
			sum = arr[i] + k;
			num = 1;
			ans ++;
		}else {
			num++;
		}

	}
	cout << ans << endl;
}


Measured memory_bytes: 3920
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    ll N;
    cin >> N;
    vector<long double> T(N), A(N);
    rep(i, N){
        cin >> T.at(i) >> A.at(i);
    }
    vector<ll> t(N), a(N);
    t.at(0) = T.at(0);
    a.at(0) = A.at(0);
    rep(i, N-1){
        if(T.at(i+1)*(long double)(a.at(i)) >= (long double)(t.at(i))*A.at(i+1)){
            ll r = a.at(i) % (ll)(A.at(i+1));
            if(r != 0){
                a.at(i+1) = a.at(i) + A.at(i+1) - r;
            }
            else{
                a.at(i+1) = a.at(i);
            }
            t.at(i+1) = a.at(i+1) / (ll)(A.at(i+1)) * (ll)(T.at(i+1));
        }
        else{
            ll r = t.at(i) % (ll)(T.at(i+1));
            if(r != 0){
                t.at(i+1) = t.at(i) + T.at(i+1) - r;
            }
            else{
                t.at(i+1) = t.at(i);
            }
            a.at(i+1) = t.at(i+1) / (ll)(T.at(i+1)) * (ll)(A.at(i+1));
        }
    }
    cout << t.at(N-1) + a.at(N-1) << endl;
}

Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define pb push_back
#define size(v)  (int) v.size()
#define fast ios_base:: sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
ll power_mod(ll a,ll x){if(x==0) return 1;ll y=power_mod(a,x/2);ll ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
ll inv(ll a){return power_mod(a,mod-2);}    
ll power(ll a, ll x){ if(x==0) return 1; ll y= power(a,x/2); ll ans=(y*y); if(x%2) ans*=a; return ans;}
int main() {
	string s,t;
	cin >> s >> t;
	int n = size(s); 

	int ans = 0;
	for(int i = 0; i < n; i++) {
		if(s[i] != t[i]){
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3824
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,n) for(int i=1;i<(int)(n);i++)

typedef long long ll;
using namespace std;

int gcd(int a, int b) { //最大公約数
  if (b==0) return a;
  else return gcd(b, a%b);
}

int lcm(int a, int b) { //最小公倍数
  return a * b / gcd(a, b);
}


int main()
{
  ll a,b;
  cin>>a>>b;
  cout<<((a+b)+1)/2<<endl;
  return 0;
}


Measured memory_bytes: 3624
s = gets.chomp
t = gets.chomp
ans = t.size
same = 0
(s.size - t.size + 1).times do |i|
    t.size.times do |j|
        if t[j] == s[i+j]
            same += 1
        end
    end
    if ans > t.size - same
        ans = t.size - same
    end
    same = 0
end
puts ans


Measured memory_bytes: 14388
declare function require(x: string): any;

var input = require("fs").readFileSync("/dev/stdin", "utf8");
input = input.split("\n");

const [a,b,c,d,e,f] = input[0].split(" ").map((x:string):number=>+x);

let result_water = -1;
let result_sugar = -1;
// mizu
top:
for(let n=1; a*n<=30; n++){
	for(let i=0; i<=n; i++){
		const water = 100*a*i+100*b*(n-i);
		if(water > f) continue;

		// satou
		const sugar_limit = (a*i+b*(n-i))*e;
		for(let m=0; c*m<=sugar_limit; m++){
			for(let ii=0; ii<=m; ii++){
				const sugar = c*ii+d*(m-ii);
				if(water + sugar > f || sugar>sugar_limit) continue;
				
				if(sugar == sugar_limit){
					result_water = water;
					result_sugar = sugar;
					break top;
				}

				if(result_water == -1 || result_sugar == -1){
					result_water = water;
					result_sugar = sugar;
				}
				else if(sugar/(water+sugar)>result_sugar/(result_water+result_sugar)){
					result_water = water;
					result_sugar = sugar;
				}
			}
		}
	}
}

//console.log(a,b,c,d,e,f);
console.log(result_water+result_sugar, result_sugar);


Measured memory_bytes: 7500
H, W = map(int, input().split())
s = [input() for i in range(H)]

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

ans = True
for i in range(H):
    for j in range(W):
        if s[i][j] == '.':
            continue
        else:
            check = True
            for k in range(len(dx)):
                y = i+dy[k]
                x = j+dx[k]
                if x<0 or x>(W-1) or y<0 or y>(H-1):
                    continue
                else:
                    if s[y][x]=='#':
                        check = False
            if check:
                ans = False
                break
    if not ans:
        break

if ans:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
import fractions
A, B, C, D = map(int, input().split())

E = (C * D) // fractions.gcd(C, D)

c = B // C - (A - 1) // C 
d = B // D - (A - 1) // D 
e = B // E - (A - 1) // E
ans = B - A - c - d + e + 1
print(ans)

Measured memory_bytes: 5304
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define SZ(x)                       ll(x.size())

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1e6 + 10;
const ll LOG = 22;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll h, n;

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

    cin >> h >> n;
    cout << (h + n - 1) / n << endl;

    return 0;
}
/*

*/


Measured memory_bytes: 256
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    n, m = map(int, input().split())
    from heapq import heappop, heappush, heapreplace
    a = list(map(int, input().split()))
    from collections import Counter as cc
    a = cc(a)
    q = []
    for key in a:
        heappush(q, (key, a[key]))
    for i in range(m):
        b, c = map(int, input().split())
        now = b
        while q:
            num, cnt = q[0]
            if c <= num: break
            
            if now >= cnt:
                now -= cnt
                heappop(q)
            else:
                heapreplace(q, (num, cnt-now))
                now = 0
                break
        if now != b:
            heappush(q, (c, b-now))
    ans = 0
    for num, cnt in q:
        ans += num*cnt
    print(ans)



if __name__ == '__main__':
    main()

Measured memory_bytes: 27920
#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
using namespace std;
const ll maxn = 1e6 + 7;
const ll mod = 1e9 + 7;
const int maxx = 1005;
ll q, t, n, m, k, ans, a[maxn], b[maxn], f[maxx][maxx];
priority_queue<ll> pr;
string s, str;
char ss[maxx][maxx];
map<ll, ll> mp;
void sol()
{
    cin >> n;
    ll mx = 1e16;
    for(int i = 0; i < n; i ++)
    {
        cin >> a[i];
    }
    for(int i = n - 1; i >= 0; i--)
    {
        for(int j = i; j >= 0; j --)
        {
            if(i == n - 1)f[i][j] = (j == 0 ? a[i] : 0);
            else
                f[i][j] = min(a[i] + f[i+1][a[i] > 100 ? j + 1 : j], j > 0 ? f[i+1][j-1] : mx);
        }
    }
    cout << f[0][0];
}
void test()
{
    cin >> n >> m;
    for(int i = 1; i <= n; i ++)
    {
        for(int j = 1; j <= m; j ++)
            {
                cin >> ss[i][j];
            }
    }
    for(int i = 1; i <= n; i ++)
    {
        for(int j = 1; j <= m; j ++)
        {
            ll up, lf;
            if(ss[i][j] == '.')
            {
                if(i > 1)
                    up = f[i-1][j];
                else
                    up = 1e9;
                if(j > 1)
                    lf = f[i][j-1];
                else
                    lf = 1e9;
                f[i][j] = min(up, lf);
                if(i == 1 && j == 1)f[i][j] = 0;
            }
            else
            {
                if(i > 1)
                {
                    up = f[i-1][j];
                    if(ss[i-1][j] == '.')
                        up += 1;
                }
                else
                    up = 1e9;
                if(j > 1)
                {
                    lf = f[i][j-1];
                    if(ss[i][j-1] == '.')
                        lf += 1;
                }
                else
                    lf = 1e9;
                f[i][j] = min(up, lf);
                if(i == 1 && j == 1)f[i][j] = 1;
            }
        }

    }
    cout << f[n][m];
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    test();
}


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

using namespace std;

int main()
{
	int  a, b;

	int x;

	int cnta = 0;

	int cntb = 1;

	cin >> a >> b;

	for (int i = 1; i <= 999; i++)
	{
		cnta += i;

		cntb += i + 1;

		if (b-a == cntb-cnta) 
		{
			cout << cnta - a << endl;
		}

	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    int k[m];
    vector<vector<int>>s(m);
    int p[m];
    for(int i=0;i<m;i++){
        cin>>k[i];
        s[i].resize(k[i]);
        for(int j=0;j<k[i];j++){
            cin>>s[i][j];
            s[i][j]--;
        }
    }
    for(int i=0;i<m;i++)cin>>p[i];
    int N=1,x=0;
    for(int i=0;i<n;i++)N*=2;
    for(int i=0;i<N;i++){
        int b=i;
        int sw[n]={};
        bool on=true;
        for(int j=0;j<n;j++){
            if(b%2)sw[j]=1;
            b/=2;
        }
        for(int j=0;j<m;j++){
            int right=0;
            for(int l=0;l<k[j];l++)right+=sw[s[j][l]];
            if(right%2!=p[j])on=false;
        }
        if(on)x++;
    }
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;using pld=pair<ld,ld>;
const ll INF=1LL<<60;void solve();int main(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();}
#define foreach(i,a) for(auto &i:a)
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d!=0&&d>0?i<n:i>n;i+=d)
template<class T> vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b; return 1;} return 0;}

using M=vector<vector<ll>>;
ll m;

M mat_mul(const M& A, const M& B){
  M C{{0,0,0},{0,0,0},{0,0,0}};
  rep(i,3)rep(j,3)rep(k,3) {
    (C[i][j]+=A[i][k]*B[k][j])%=m;
  }
  return C;
}

void solve(){
  ll l,a,b; cin>>l>>a>>b>>m;
  vector<ll> C(19,0);
  rep(d,1,19){
    if((ll)pow(10,d)-1-a>=0){
      C[d]=((ll)pow(10,d)-1-a)/b+1;
    } else {
      C[d]=0;
    }
  }
  rep(d,18,0,-1) C[d]-=C[d-1];
  rep(d,1,19){
    C[d]=min(l,C[d]);
    l-=min(l,C[d]);
  }

  M A{{1,0,0},{0,1,0},{0,0,1}};
  rep(d,1,19){
    M res{{1,0,0},{0,1,0},{0,0,1}};
    M power{{((ll)pow(10,d))%m,1,0},{0,1,b%m},{0,0,1}};
    ll p=C[d];
    while(p){
      if(p&1) res=mat_mul(res,power);
      power=mat_mul(power,power);
      p>>=1;
    }
    A=mat_mul(res,A);
  }
  cout<<((a%m)*(A[0][1])+A[0][2])%m<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define p (int)(1e9 + 7)

int MOD(int a){
	return (a %= p) >= 0 ? a : a + p;
}

signed main(){
	int N, K, i, ans = 0;
	scanf("%lld%lld", &N, &K);
	for(i = K; i <= N + 1; i++){
		ans += i * (N - i + 1) + 1;
	}
	printf("%lld\n", MOD(ans));
	return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <numeric>
using namespace std;

int abs(int num){
   if (num > 0)
      return num;
   else
      return -num;
}

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

Measured memory_bytes: 256
def resolve():
    '''
    code here
    '''
    import collections
    N = int(input())
    As = [int(item) for item in input().split()]
    As.sort()
    temp_set = set(As)
    is_true = True
    # print(temp_set)
    if len(temp_set) == 1:
        if As[0] != 0:
            is_true = False
    elif len(temp_set) == 2:
        x_num = As.count(max(As))
        zero_num = As.count(0)
        if x_num != 2*zero_num:
            is_true = False

    elif len(temp_set) == 3:
        temp_cnt = collections.Counter(As)
        # print(temp_cnt)
        temp_set = list(set(As))
        if temp_cnt[temp_set[0]] == temp_cnt[temp_set[1]] == temp_cnt[temp_set[2]]:
            temp_keys = list(temp_cnt.keys())
            if temp_keys[0] ^ temp_keys[1] ^ temp_keys[2] == 0:
                is_true = True
            else:
                is_true = False
        else:
            is_true = False
        
    else:
        is_true = False

    print('Yes') if is_true else print('No')
        



if __name__ == "__main__":
    resolve()


Measured memory_bytes: 20720
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<bits/stdc++.h>
#define ll long long
#define re register
using namespace std;
struct ios{
	template <typename ty> inline ios& operator >> (ty &x)
	{
		register int f=1;x=0;register char c=getchar();
		for(;c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
		for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
		x*=f;return *this;
	}
	template <typename ty>  inline ios& operator << (ty x)
	{
		if(x<0) x=-x,putchar('-');
		if(x>9) *this << x/10;
		putchar(x%10+48);
		return *this;
	}
	inline ios& operator << (char x){putchar(x);return *this;}
}io;
const int N = 2e5+5;
multiset <int> s;
int n,a[N],k;
int main()
{
	io>>n;
	for(register int i=1;i<=n;i++) io>>a[i];
	s.insert(a[1]);
	for(register int i=2;i<=n;i++)
	{
		multiset <int>::iterator it = s.lower_bound(a[i]);
//		printf("get %d,begin = %d\n",*it,*s.begin());
		if(it != s.begin()) s.erase(--it);
		s.insert(a[i]);
//		for(multiset <int>::iterator itr = s.begin();itr!=s.end();++itr) printf("%d ",*itr);puts("");
	}
	io<<s.size();
}

Measured memory_bytes: 5376
N, M = map(int, input().split())
p = [0] * M
S = [''] * M
for i in range(M):
    p_i, S[i] = input().split()
    p[i] = int(p_i)




penal_ct = 0
ac_count = 0
# prev_ac_num = -1
ac_list = [False] * N
pos = 0

wa_count = [0] * N

for i in range(M):
    if S[i] == 'WA':
        wa_count[p[i] - 1] += 1
        # print(wa_count[p[i] - 1])
    elif (not ac_list[p[i] - 1]) and S[i] == 'AC': # ACかつ今までにACしてない
        ac_list[p[i] - 1] = True
        ac_count += 1
        if i == 0:
            continue
        penal_ct += wa_count[p[i] - 1]
        # for j in range(i)[::-1]:
        #     if S[j] == 'WA' and p[j] == p[i]:
        #         penal_ct += 1
    # if all(ac_list):
        # break
# print(wa_count)
print(ac_count, penal_ct) 


Measured memory_bytes: 14836
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
int main() {
	int a, b, n = 0;
	while (cin >> a >> b) {
		a += b;
		for (int i = 0; a > 0; i++) {
			a = a / 10;
			n++;
		}
		if (n == 0) {
			n = 1;
		}
		cout << n << endl;
		n = 0;
	}
}

Measured memory_bytes: 1160
N,A,B,C,D = map(int, input().split())
DF = B-A
for plus in range(N-1):
    minus = N-1 - plus
    mn = C*plus - D*minus
    mx = D*plus - C*minus
    if mn <= DF <= mx:
        print('YES')
        break
else:
    print('NO')


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

int main() {
  int n; cin >>n;
  vector<int> h(n);
  for (int i=0; i<n; i++) cin >>h.at(i);
  string ans = "Yes";
  bool ldowned = true;
  h.at(0)--;
  
  for (int i=0; i<n-1; i++){
    if (h.at(i)==h.at(i+1)){
      ldowned = false;
    }else if (h.at(i)<h.at(i+1)){
      h.at(i+1)--; ldowned = true;
    }else if (h.at(i)>h.at(i+1)){
      ans = "No"; break;
    }
  }
  
  cout <<ans;
  cout <<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N;cin>>N;
  vector<char>s;
  while(true){
    N--;
    char tmp='a'+N%26;
    s.push_back(tmp);
    N=N/26;
    if(N==0)break;
  }
  reverse(s.begin(),s.end());
  for(ll i=0;i<s.size();i++){
    cout<<s[i];
  }
  cout<<endl;
}

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

int main(){
    int H,W;
    while(1){
        cin>>H>>W;
        if(H==0&&W==0)break;
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++)
            {
                if((i+j)%2==0)
                cout<<"#";
                else
                cout<<".";
            }
            cout<<"\n";
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <queue>
#include <sstream>
#include <cmath>
#include <functional>
#include <climits>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(s,i,n) for(int i=s;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define skip(i,n,p) for(int i=0;i<n;i+=p)
#define all(a)  (a).begin(),(a).end()
#define int64 long long
#define debug cerr << __FILE__ << ":" << __LINE__ << endl;
#define INF 2147483647

struct Init {
    Init() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
        cout << fixed;
        // setw(6) << setfill('0')
    }
} init;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {
    for(int i = 0; i < (int) v.size(); i++) {
        ostr << v[i] << (i + 1 != v.size() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const map<_K, _V>& v) {
    ostr << "{";
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << (*iter).first << ": " << (*iter).second << ", ";
    }
    ostr << "}";
    return ostr;
}

template <typename _K>
ostream& operator << (ostream& ostr, const set<_K>& v) {
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << *iter << (iter != v.end() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const pair<_K, _V>& v) {
    ostr << "(" << v.first << ", " << v.second << ")";
    return ostr;
}

int64 powmod(int64 n, int64 count, int64 mod) {
    if (count == 0) return 1;
    if (count % 2 == 0) {
        int64 t = powmod(n, count / 2, mod);
        return t * t % mod;
    }
    return n * powmod(n, count - 1, mod) % mod;
}

int64 ncr(int64 n, int64 r, int64 mod) {
    int64 a;
    if (n < r) a = min(n, r - n);
    else a = min(n - r, r);

    int64 res = 1;
    rep(i, a) {
        res = res * (n - i) % mod;
        res = res * powmod(i + 1, mod - 2, mod) % mod;
    }

    return res;
}

int main() {
    int64 n; cin >> n;
    vector<int64> l(n); rep(i, n) cin >> l[i];

    map<int64, int64> m;
    rep(i, n) m[l[i]]++;

    int64 p = 0;
    for (auto v : m) {
        if (v.second > 1) {
            p += v.second * (v.second - 1) / 2;
        }
    }

    rep(i, n) {
        cout << p - m[l[i]] + 1 << endl;
    }
}


Measured memory_bytes: 11136
#include <cmath>
#include <iostream>
const int N=1001;
double A[N]={0},B[N]={0};
double x=1,y=0;
int main(){
	for(int i=1;i<N;i++){
		A[i]=x;B[i]=y;
		double tmp=sqrt(i),dx=-y/tmp,dy=x/tmp;
		x+=dx,y+=dy;
	}
	while(1){
		int n;
		std::cin>>n;
		if(n==-1)break;
		std::cout<<A[n]<<"\n"<<B[n]<<"\n";
	}
}

Measured memory_bytes: 1252
n, q = list(map(int, input().split()))
s = input()
cnt = 0
word_list = []
for i in range(n):
  if i > 0:
    if(s[i - 1] == 'A') and (s[i] == 'C') : cnt += 1 
  word_list.append(cnt)
for i in range(q):
  l, r = list(map(int, input().split()))
  print(word_list[r - 1] - word_list[l - 1])

Measured memory_bytes: 6120
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  string s, t; cin >> s >> t;
  
  sort(all(s));
  sort(all(t));
  reverse(all(t));
  
  if(s < t) cout << "Yes" << endl;
  else cout << "No" << endl;

}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i)
#endif

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());
#define dis distance
#define so sort
#define rev reverse
#define pub push_back
#define sec second
#define fir first

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector <int> > vvi;
const int EPS = 1e-9;
const int MOD = 1e9+7;


int main (){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vi A(n);
    ll sum = 0;
    REP(i,n){
        cin >> A[i];
        sum += A[i];
    }
    ll ans = INT64_MAX;
    ll sum2 = 0;
    REP(i,n){
        sum2 += A[i];
        if(i+1 < n)ans = min(ans,abs(sum-2*sum2));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

vector<ll> divisor(ll n)
{
    vector<ll> ret;
    for (ll i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ret.push_back(i);
            if (i * i != n)
                ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return (ret);
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    vector<ll> yakusu = divisor(m);
    ll ok = 0;
    ll ng = (int)yakusu.size();
    while (llabs(ok - ng) > 1)
    {
        ll mid = (ok + ng) / 2;
        ll tmp = m / yakusu[mid];
        if (tmp >= n)
        {
            ok = mid;
        }
        else
        {
            ng = mid;
        }
    }
    cout << yakusu[ok] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;

int main()
{
  int N;
  int a[110000]={0};
  ll res=1;
  cin >> N;

  rep(i,N) {
    int aa;
    cin >> aa;
    a[aa]++;
  }

  int n=N%2;
  bool can=true;
  if(a[0]>n) can=false;
  if(N%2==1 && a[0]==0) can=false;
  FOR(i,1,N-1){
    if(i%2==n && a[i]) can=false;
    if(a[i]>2) can=false;
  }
  if(can){
    rep(i,N/2){
      res = (res*2)%MOD;
    }
    cout << res << endl;
  }
  else{
    cout << 0 << endl;
  }

}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio> 
using namespace std;
int n, a[200005];
int main()
{
	while(cin >> n)
	{
		for(int i = 1; i <= n; i++)   
		{
			scanf("%d", &a[i]);
		}
		printf("%d", a[n]);
		for(int i = n-2; i >= 1; i -= 2) printf(" %d", a[i]);
		for(int i = (n % 2)?2:1; i <= n-1; i += 2) printf(" %d", a[i]);
		printf("\n");
	}
    return 0;
}

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

int GCD(int num1, int num2) {
	if (num1 == 0 || num2 == 0) {
		return 0;
	}
	else {
		while (num1 != num2) {
			if (num1 > num2) {
				num1 -= num2;
			}
			else {
				num2 -= num1;
			}
		}
		return num1;
	}
}

int main() {
	int x, y;
	cin >> x >> y;
	cout << GCD(x, y) << endl;
	return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  char s[4],t[4];
  REP(i, 3) cin >> s[i];
  REP(i, 3) cin >> t[i];
  int cnt = 0;
  REP(i,3) if(s[i]==t[i]) cnt++;
  cout << cnt << endl;
  
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize(4)
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pi acos(-1.0)
#define LL long long
//#define mp make_pair
#define pb push_back
#define ls rt<<1, l, m
#define rs rt<<1|1, m+1, r
#define ULL unsigned LL
#define pll pair<LL, LL>
#define pii pair<int, int>
#define piii pair<pii, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stout);
//head

const int N = 2e5 + 10;
vector<int> g[N];
char s[N];
bool vis[N];
int d[N][2];
int que[N], top = 0;
int main() {
    int n, m, u, v;
    scanf("%d %d", &n, &m);
    scanf("%s", s);
    for (int i = 1; i <= m; i++) {
        scanf("%d %d", &u, &v);
        g[u].pb(v);
        g[v].pb(u);
    }
    for (int i = 1; i <= n; i++) {
        for (int v : g[i]) {
            d[v][s[i-1] - 'A']++;
        }
    }
    for (int i = 1; i <= n; i++) {
        if(!d[i][0] || !d[i][1]) que[++top] = i, vis[i] = true;
    }
    int now = 1;
    while(now <= top) {
        int u = que[now];
        for (int v : g[u]) {
            d[v][s[u-1] - 'A'] --;
            if(!vis[v] && !d[v][s[u-1] - 'A']) que[++top] = v, vis[v] = true;
        }
        now++;
    }
    if(top < n) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 12928
import Data.Ord(comparing)
import Data.List(unfoldr, sortBy)
import Control.Applicative

-- bubble sort
bubble :: [String] -> Maybe (String, [String])
bubble = foldr step Nothing
  where
    x `step` Nothing = Just (x, [])
    x `step` Just (y, ys)
      | (comparing last y x) == LT = Just (y, x:ys)
      | otherwise                  = Just (x, y:ys)

-- bSort :: Ord a => [a] -> [a]
bSort :: [String] -> [String]
bSort = unfoldr bubble

-- select sort
select :: [String] -> Maybe (String, [String])
select []     = Nothing
select (x:[]) = Just (x, [])
select (x:xs) = let min = head (sortBy (comparing last) xs)
                in if (comparing last min x) == LT
                   then Just (min, (takeWhile (/=min) xs) ++ x : (tail (dropWhile (/=min) xs)))
                   else Just (x, xs)

sSort :: [String] -> [String]
sSort = unfoldr select

--main
main = do
    getLine
    cs <- getLine
    let bs = unwords . bSort . words $ cs
    let ss = unwords . sSort . words $ cs
    putStrLn bs
    putStrLn "Stable"
    putStrLn ss
    if bs == ss then putStrLn "Stable" else putStrLn "Not stable"


Measured memory_bytes: 3872
#include <iostream>
#include <algorithm>
#include <typeinfo>
#include <numeric>
#include "math.h"
#include <string>
#include <vector>
#include <iomanip>

#define pai 3.14159265358979323846264338327950288
using namespace std;


//Serval vs Monster
int main() {

	int h, a;
	cin >> h >> a;
	int atk = h / a;
	if (h % a != 0)atk++;


	cout<<atk;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>

int main() {
  std::string word;
  std::cin >> word;
  std::transform(word.begin(), word.end(), word.begin(), ::tolower);

  int cnt = 0;
  std::string text;
  while(1) {
    std::cin >> text;
    if(text == "END_OF_TEXT") break;
    std::transform(text.begin(), text.end(), text.begin(), ::tolower);
    if(text == word) cnt++;
  }
  std::cout << cnt << std::endl;

  return 0;
}

Measured memory_bytes: 3156
#include <stdio.h>

int main (void){
    int i,j; 
    char n[3]={0};
    int ans = 0;
   
    scanf("%s",n);
    if((n[0]-'0')==1){
        ans++;
    }
    if((n[1]-'0')==1){
        ans++;
    }
    if((n[2]-'0')==1){
        ans++;
    }
    printf("%d\n",ans);
    
    

    
    return 0;
}

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

int main()
{
    int N,Y;
    cin >> N >> Y;
    int yen[] = {10000, 5000, 1000};
    int total,sub;
    REP(i,2001){
        REP(j,2001){
            total = yen[0]*i + yen[1]*j;
            sub = Y-total;
            if(0 != sub%yen[2] || sub < 0)break;
            sub /= yen[2];
            if(N == (i+j+sub)){
                cout << i << " " << j << " " << sub << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,a,n) for(int i=(a); i<(n); i++)
#define all(vec) vec.begin(),vec.end()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
int main() {
  int H, W; cin >> H >> W;
  vector<string> S(H);
  rep(i,H) {string t; cin >> t; S[i]=t;}
  rep(i,H)  cout << S[i] << endl << S[i] << endl;
  
  return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 200000000000000
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

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

#define S second
#define F first
#define int long long  

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

signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;++i)
	{
		cin>>a[i];
	}
	int ans[n]={};
	for(int i=1;i<n;++i)
	{
		int mi=ans[i-1]+abs(a[i]-a[i-1]);
		for(int j=2;j<=k;++j)
		{
			if(i-j>=0)
			{
				mi=min(mi,ans[i-j]+abs(a[i]-a[i-j]));
			}
		}
		ans[i]=mi;
	}
	cout<<ans[n-1];
}

Measured memory_bytes: 1792
let input = ''

process.stdin.resume()
process.stdin.setEncoding('utf8')
process.stdin.on('data', function(chunk) {
  input += chunk
})
process.stdin.on('end', function() {
  input = input.trim().split('\n')
  main()
})

function main() {
    for(i=0; i<input.length; i++) {
        input_line = input[i].split(' ')
        let sort_input_line = input_line.slice()
        sort_input_line.sort(compareNumbers)
        if (input_line[0] > 1000 || input_line[0] < -1000) {
          return
        }

        let a = input_line[0]
        let b = input_line[1]
        let c = input_line[2]
        let d = input_line[3]
        let e = input_line[4]
        let f = input_line[5]

        let x = (b*f - e*c)/(d*b - a*e)
        let y = (c-a*x)/b
        console.log(x.toFixed(3), y.toFixed(3))
    }
}

function compareNumbers(a, b) {
  return b - a;
}


Measured memory_bytes: 15328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////



int main(){fastio
    string s;cin>>s;
    ll n=s.size();
    bool f=true;
    rep(i,1,n-1){
        if(s[i]!='9')f=false;
    }
    ll ans=0;
    ans+=s[0]-'0';
    ans+=9*(n-1);
    if(!f)ans--;
    cout<<ans<<endl;
    
    return 0;
}



Measured memory_bytes: 256
import bisect





def main():
    a, b, k = map(int, input().split())


    for i in range(a, min(a + k, b + 1)):
        print(i)
    for i in range(max(a + k, b - k + 1), b + 1):
        print(i)
    # print(ans)







if __name__ == '__main__':
    main()



Measured memory_bytes: 38384
$N=<>;
@A=glob<>;
for(;$r<=$N;){
	if($%==$s){
		$x+=$r-$l;
		$s+=$A[$r];
		$%^=$A[$r++];
	}else{
		$a=$%;
		$s-=$A[$l];
		$%^=$A[$l++];
	}
}
print$x


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

using namespace std;

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

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int a, b, c;
	cin >> a >> b >> c;
	if (a + b + c >= 22) cout << "bust" << endl;
	else cout << "win" << endl;
    
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <math.h>
using namespace std;

int main() {
	int x;cin >> x;
	int ans = 0;
	for (int b = 1; b <= sqrt(x);b++) {
		for (int p = 1;p <= 9;p++) {
			int bp = 1;
			for (int i = 1;i <= p;i++)bp *= b;
			if (ans <= bp && bp<=x)ans = bp;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct edge {
	int t;
	edge(int _t) : t(_t) {}
};
bool use[100010];


vector<edge> te[100010];
vector<edge> fe[100010];
int d[100100];
ll rec(int num) {
	if (num == 0) return 0;
	return rec(num - 1) + num;
}
ll gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}


void Solve() {
	ll n;
	int x;
	cin >> n >> x;

	ll v = 1;
	int t[200010];
	for (size_t i = 2; i <= n; i++)
	{
		v += 2;
	}
	t[v / 2] = x;

	int c = 1;
	int less = x - 1;
	int gre = x + 1;
	while ((v / 2) + c < v)
	{
		t[(v / 2) + c] = less > 0 ? less-- : gre++;
		t[(v / 2) - c] = gre <= v ? gre++ : less--;
		c++;
	}
	if (x == 1 || x == v) {
		cout << "No" << endl;
		return;
	}
	cout << "Yes" << endl;
	for (size_t i = 0; i < v; i++)
	{
		cout << t[i] << endl;
	}
	cout << endl;
}


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



Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007

long long koubai(long long a,long long b){
    if(a<b) swap(a,b);
    long long r=a%b;
    long long x=a*b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return x/b;

}
int main(){
    int A[100005];
    int n,m,a,l2=0,l3=0;
    bool x=true;
    cin>>n>>m;
    REP(i,n){
        cin>>A[i];
    }
    a=A[0];
    while(a%2==0){
        l2++;
        a/=2;
    }
    FOR(i,1,n){
        a=A[i];
        l3=0;
        while(a%2==0){
            l3++;
            a/=2;
        }
        if(l3!=l2){
            x=false;
            break;
        }

    }
    if(x){
    long long k=koubai(1,A[0]/2);
    FOR(i,1,n){
        k=koubai(k,A[i]/2);
    }
    
    long long ans=(long long)max((long long)0,(m/k)-(m/(2*k)));
    cout<<ans<<endl;
    }
    else cout<<0<<endl;
}

Measured memory_bytes: 640