akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<numeric>
#include<list>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;


//最大公約数
template<class T> T gcd(T a, T b)
{
	while (true)
	{
		T r;
		if (a%b == 0) return b;
		else
		{
			r = a % b;
			a = b;
			b = r;
		}
	}
}
//最小公倍数
template<class T> T lcm(T a, T b)
{
	return a / gcd(a, b)*b;
}
//文字0~9をint型0~9に変換
int char_to_int(char c)
{
	if (c == '0') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
	else return -1;
}
//int型0~9を文字0~9に変換
char int_to_char(int c) {
	if (c == 0) return '0';
	if (c == 1) return '1';
	if (c == 2) return '2';
	if (c == 3) return '3';
	if (c == 4) return '4';
	if (c == 5) return '5';
	if (c == 6) return '6';
	if (c == 7) return '7';
	if (c == 8) return '8';
	if (c == 9) return '9';
	else return'x';
}
//a^b mod MODを計算
long long int ModPower(long long int a, long long int b, long long int MOD)
{
	if (b == 0) return 1;
	else if (b % 2 == 0)
	{
		long long int d = ModPower(a, b / 2, MOD);
		return (d*d) % MOD;
	}
	else
	{
		return (a*ModPower(a, b - 1, MOD)) % MOD;
	}
}
//nCr mod MODを計算
long long int ModCombi(long long int n, long long int r, long long int MOD)
{
	if (n == 0 || r == 0) return 1;

	long long int Kn = 1, Kr = 1, Knr = 1;

	long long int temp = 1;
	for (long long int i = 1; i <= n; i++)
	{
		temp *= i;
		temp %= MOD;
		if (i == n) Kn = temp;
		if (i == r) Kr = temp;
		if (i == n - r) Knr = temp;
	}

	long long int x = ModPower(Kr, MOD - 2, MOD);
	long long int y = ModPower(Knr, MOD - 2, MOD);

	long long int ans;
	ans = Kn * x;
	ans %= MOD;
	ans *= y;
	ans %= MOD;

	return ans;
}
//int型10進数をord桁のstring型2進数に変換する
string binary(int x, int ord)
{
	int y;
	string ans = "";
	for (int i = 0; i < ord; i++)
	{
		y = x / (int)pow(2, ord - 1 - i);
		y %= 2;
		if (y == 0) ans += "0";
		else ans += "1";
	}

	return ans;
}
//ord桁のstring型2進数をint型10進数に変換する
int rep_binary(string x, int ord)
{
	int res = 0;
	for (int i = 0; i < ord; i++)
	{
		if (x[i] == '1') res += (int)pow(2, ord - 1 - i);
	}
	return res;
}
//xとyのビットごとの排他的論理和
template<class T> T XOR(T x, T y)
{
	T n = 0;
	while (max(x, y) > pow(2, n)) n++;
	T ans=0;
	for (int i = 0; i <= n; i++)
	{
		T x1 = (x % (T)pow(2, i + 1)) / (T)pow(2, i);
		T y1 = (y % (T)pow(2, i + 1)) / (T)pow(2, i);
		if (x1 != y1) ans += (T)pow(2, i);
	}
	return ans;
}

/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/


int main()
{
	string S;
	cin >> S;
	for (int i = 0; i < S.length(); i++)
	{
		cout << "x";
	}
	cout << endl;
}

Measured memory_bytes: 256
def solve(a, b, c, x, y)
    res = 10**10 #
     
    0.step([x*2, y*2].max, 2) do |n_c| # C
        n_a = [0, x - n_c/2].max
        n_b = [0, y - n_c/2].max
        s = a*n_a + b*n_b + c*n_c
        # puts "#{s}, #{n_a}, #{n_b}, #{n_c}"
        res = [res, s].min 
    end

    # res = a*x + b*y
    # res = [res, 2*x*c + ((x<y)? (y-x)*b : 0)].min
    # res = [res, 2*y*c + ((x>y)? (x-y)*a : 0)].min
    
    return res 
end

def main()
    a, b, c, x, y = gets.split.map(&:to_i)
    p solve(a, b, c, x, y)
end

main()



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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define dbg(var) {std::cout << #var << "  = " << var << nl;}
#define vi vector<int>
typedef long long ll;

using namespace std;

constexpr int MOD = 1e9 + 7;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(0); 

	int n;
	cin >> n;
	
	vector<vi> g(n);
	rep(i , n - 1)
	{
		int u , v;
		cin >> u >> v;
		--u, --v;
		g[u].pb(v);
		g[v].pb(u);
	}
	
	vector<vi> dp(n , { -1 , -1 });
	function<int(int,int,int)> rec = [&](int cur , int pr , int col)
	{
		if(sz(g[cur]) == 1 && g[cur][0] == pr)
			return 1;
			
		if(dp[cur][col] != -1)
			return dp[cur][col];
		
		ll ans = 1LL;
		for(const auto& to : g[cur])
		{
			if(pr != to)
			{
				if(col == 0)
				{
					ans *= (rec(to , cur , 0) + rec(to , cur , 1)) % MOD;
				}
				else
				{
					ans *= rec(to , cur , 0);
				}
				ans %= MOD;
			}
		}
		return dp[cur][col] = ans;
	};
	
	cout << (rec(0 , -1 , 0) + rec(0 , -1 , 1)) % MOD << endl;

	return 0;
}

Measured memory_bytes: 23680
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#define ll long long
#define MODD 1000000007
using namespace std;

int main() {
    int r,g,b;
    cin>>r>>g>>b;
    if ((r*100+g*10+b)%4==0)
        printf("YES\n");
    else
        printf("NO\n");
}

Measured memory_bytes: 256
kazu=[]
Max=1000000
def era(kazu,Max):
    sosu=list(range(2,Max))
    while True:
        num=sosu[0]
        if num>=Max**0.5:
            kazu+=sosu
            return kazu
        kazu.append(num)
        sosu=[i for i in sosu if i%num!=0]
era(kazu,Max)
while True:
    try:
        n=int(input())
        if n==1:
            print(0)
        elif n==2:
            print(1)
        elif n>=max(kazu):
            print(len(kazu))
        else:
            for i in range(n+1):
                if kazu[i]==n:
                    print(i+1)
                    break
                elif kazu[i]>n:
                    print(i)
                    break
    except EOFError:
        break


Measured memory_bytes: 48976
#include<stdio.h>
#define W 1
#define G 2
#define B 3

int v[101][101], d[101], f[101], count = 1, color[101];

void visit(int u){
  int i;
  color[u] = G;
  d[u] = count++;

  for(i = 1; v[u][i] != 0; i++){
    if(color[v[u][i]] == W)
      visit(v[u][i]);
  }
  color[u] = B;
  f[u] = count++;
}

int main(){
  int n, i, j, u, k;

  scanf("%d", &n);

  for(i = 1; i < n + 1; i++){
    scanf("%d%d", &u, &k);
    for(j = 1; j < k + 1; j++){
      scanf("%d", &v[u][j]);
    }
  }

  for(i = 1; i <= n; i++)
    color[i] = W;
  for(i = 1; i <= n; i++){
    if(color[i] == W)
      visit(i);
  }

  for(i = 1; i < n + 1; i++)
    printf("%d %d %d\n", i, d[i], f[i]);

  return 0;
}



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

int main(void)
{
    int H,W,K;
    cin >> H >> W >> K;
    vector<string> A(H);
    for (int i = 0; i < A.size(); i++){
        cin >> A[i];
    }
    int ans=0;
    for (int i = 0; i < 1<<H; i++){
        for (int j = 0; j < 1<<W; j++){
            int c=0;
            for (int k = 0; k < H; k++){
                if (((i>>k)&1)==0){
                    continue;
                }
                for (int l = 0; l < W; l++){
                    if(((j>>l)&1)==0){
                        continue;
                    }
                    if (A[k].at(l)=='#'){
                        c++;
                    }
                }
            }
            if(c==K){
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3580
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

void solve() {
	int ans = 0;
	int n; cin >> n;
	vector<int> v(n), c(n);
	rep(i, n)cin >> v[i];
	rep(i, n)cin >> c[i];
	rep(i, n)if (v[i] > c[i])ans += v[i] - c[i];
	cout << ans << endl;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	//stop
	return 0;
}

Measured memory_bytes: 256
<?php

  $s = trim(fgets(STDIN));
  $s = str_replace(array("\r\n","\r","\n"), '', $s);
  $s = explode(" ", $s);
  $number = $s[0] * $s[1];
  if($number % 2 == 0){
      echo "Even" . "\n";
  } else {
      echo "Odd" . "\n";
  }
?>

Measured memory_bytes: 16180
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
vector<int> color;
vector<vector<P>> graph;
void dfs(int i,int col){
    color[i]=col;
    for(auto j:graph[i]){
        if(color[j.second]!=-1) continue;
        if(j.first&1) dfs(j.second,1-col);
        else dfs(j.second,col);
    }
}

int main(){
    int N;cin>>N;
    
    graph.resize(N);
    REP(i,N-1){
        int a,b,c; cin>>a>>b>>c;
        a--;b--;
        graph[a].push_back(P(c,b));
        graph[b].push_back(P(c,a));
    }
    color.resize(N,-1);
    dfs(0,0);
    REP(i,N) cout<<color[i]<<endl;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define ocut cout
#define ouct cout
#define itn int

struct Union{
  vector<ll> par;
  Union(ll a){
  par=vector<ll>(a,-1);
  }
  ll find(ll a){
    if(par[a]<0){
      return a;
    }
    else{
      return par[a]=find(par[a]);
    }
  }
  bool same(ll a,ll b){
    return (find(a)==find(b));
  }
  ll size(ll a){
    return -par[find(a)];
  }
  void unite(ll a,ll b){
    ll c=find(a),d=find(b);
    if(c==d)
      return;
    if(size(c)<size(d)){
      swap(c,d);
    }
    par[c]+=par[d];
    par[d]=c;
  }
};
ll Nagaemon1;
void swap(ll i,ll j){
  Nagaemon1=i;
  i=j;
  j=Nagaemon1;
}
int main(){
  ll n,m;
  cin >> n;
  vector<int> d(n);
  map<int,int>a,b;
  rep(i,n){
    cin >> d[i];
    a[d[i]]++;
  }
  cin >> m;
  vector<int> t(m);
  rep(i,m){
    cin >> t[i];
    b[t[i]]++;
  }
  rep(i,m){
    int x=t[i];
    if(a[x]<b[x]){
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}


Measured memory_bytes: 20608
#include<stdio.h>
int main()
{
    char str[100];
    int i,h,k,length,j,n,m;
    scanf("%d",&k);
m=0;
        scanf(" %s",str);
        for(j=(k/2),i=0;i<=(k/2)-1,j<=k-1;j=j+1,i++) {
            if(str[i]!=str[j]){
                m++;
            }}
        if(k%2!=0){
            printf("No\n");
        }

        else if(m==0){
            printf("Yes\n");
        }
        else{
            printf("No\n");
        }

    return 0;
}


Measured memory_bytes: 128
#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 main() {
    ll N;
    cin>>N;

    for(int h=1;h<=3500;h++){
        for(int n=1;n<=3500;n++){
            
            ll x=N*h*n;
            ll y=4*h*n-N*h-N*n;
            if(y==0) continue;
            if(x%y!=0) continue;

            ll w=x/y;
            if(1<=w && w<=3500){
                cout<<h<<" "<<n<<" "<<w<<endl;
                return 0;
            }
            
        }
    }



}



Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>

#define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long ll;
using namespace std;

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

	return gcd(b, a%b);
}

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

	map<int, int> t;
	int mi = 114514;
	int memo = 0;
	for (int i = 1; i <= n; i++) {
		t[i + 1] = l + i - 1;
		if (mi > t[i + 1]) {
			memo = i;
		}
		mi = min(mi, abs(t[i + 1]));
	}
	//cout << mi << endl;
	t.erase(memo + 1);
	int app = 0;
	for (int i = 1; i <= n; i++) {
		if (mi == t[i + 1]) continue;
		app += t[i + 1];
	}
	cout << app << endl;

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define all(x) (x).begin(), (x).end()
typedef long long ll;

int main() {
  int N, K;
  cin >> N >> K;
  vector<ll> h(N);
  for (int i = 0; i < N; i++) cin >> h[i];
  sort(all(h));

  ll ans = 1000000000;
  for (int i = 0; i + K - 1 < N; i++) {
    ans = min(ans, h[i + K - 1] - h[i]);
  }

  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int n;
  cin>>n;
  string a;
  cin>>a;
  int i=0,j=n-1,cnt=0;
  while(i<j)
  {
    if(a[i]=='W'&&a[j]=='R')
    {
      cnt++;
      i++;
      j--;
    }
    if(a[i]=='R')
    {
      i++;
    }
    if(a[j]=='W')
    {j--;}
    
  }
  cout<<cnt<<"\n";
}


Measured memory_bytes: 3696
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int [] data = new int[5];
		int x = 0;
		for(int i = 0; i < 5; i++) {
			data[i]= sc.nextInt();
			if(data[i] < 40)data[i] = 40;
		}
		for(int i = 0; i < 5; i++) {
			x = x + data[i];
			
		}
		
		System.out.println(x / 5);

	}

}

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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

int main ()
{
    int r , x ;
    cin >> x ;

    r = (x * x) * 3 ;

    cout << r ;


    return 0;
}



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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
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; }
//template end

vector<int> g[201000];
bool col[201000];
void dfs(int v,int p){
   if(p>=0)col[v]=col[p]^1;
   for(int nxt:g[v])if(nxt!=p)dfs(nxt,v);
}

vector<int> p,q;
void make(int n,int cnt){
   int ps=min(cnt,n-cnt),zero_cnt=0;
   rep(i,1,n+1)if(i%3==0)zero_cnt++;
   if(zero_cnt>=ps){
      rep(i,1,n+1){
         if(i%3==0&&p.size()<ps)p.push_back(i);
         else q.push_back(i);
      }
   }
   else{
      rep(i,1,n+1){
         if(i%3==2)p.push_back(i);
         if(i%3==1)q.push_back(i);
      }
      rep(i,1,n+1)if(i%3==0){
         if(p.size()<ps)p.push_back(i);
         else q.push_back(i);
      }
   }
   if(q.size()==cnt)swap(p,q);
}

int main(){
   int n; scanf("%d",&n);
   rep(i,0,n-1){
      int x,y; scanf("%d%d",&x,&y); x--; y--;
      g[x].push_back(y); g[y].push_back(x);
   } col[0]=0; dfs(0,-1);
   int cnt=0;
   rep(i,0,n)if(col[i])cnt++;
   make(n,cnt);
   rep(i,0,n){
      if(col[i]){
         printf("%d\n",p.back());
         p.pop_back();
      }
      else{
         printf("%d\n",q.back());
         q.pop_back();
      }
   }
   return 0;
}

Measured memory_bytes: 18804
fun main(args: Array<String>) {
    val (N, M, K) = listOfInt()
    val U = UnionFind(N)
    val D = IntArray(N)
    val G = Array<MutableList<Int>>(N) { mutableListOf<Int>() }
    repeat(M) {
        val (a, b) = listOfInt(-1)
        D[a] += 1
        D[b] += 1
        U.union(a, b)
    }
    repeat(K) {
        val (c, d) = listOfInt(-1)
        G[c].add(d)
        G[d].add(c)
    }
    val ans = IntArray(N)
    repeat(N) { n ->
        var f = U.size(n) - 1 - D[n]
        for (u in G[n]) {
            if (U.same(n, u)) f -= 1
        }
        ans[n] = f
    }
    println(ans.joinToString(separator = " "))
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }
class UnionFind(n: Int) {
    var rank: IntArray
    var par:  IntArray
    var size: IntArray

    init {
        this.rank = IntArray(n) { 0 }
        this.par  = IntArray(n) { it }
        this.size = IntArray(n) { 1 }
    }

    fun union(x: Int, y: Int): Boolean {
        var rx = this.root(x)
        var ry = this.root(y)
        if (rx == ry) return false

        if (this.rank[rx] < this.rank[ry]) {
            val w = rx.toInt()
            rx = ry
            ry = w
        } else if (this.rank[rx] == this.rank[ry]) {
            this.rank[rx] += 1
        }
        this.par[ry] = rx.toInt()
        this.size[rx] += this.size[ry]
        return true
    }

    fun find(x: Int): Int {
        if (this.par[x] == x) return x
        else {
            this.par[x] = this.find(this.par[x])
            return this.par[x]
        }
    }
    fun same(x: Int, y: Int): Boolean = this.root(x) == this.root(y)
    fun size(x: Int): Int = this.size[this.find(x)]
    fun root(x: Int): Int = this.find(x)
    fun unite(x: Int, y: Int): Boolean = this.union(x, y)

}


Measured memory_bytes: 90580
from collections import defaultdict

def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass

def main():
    N = int(input())
    d = defaultdict(int)
    for i in range(1,N+1):
        for j in prime_factor(i):
            d[j] += 1
    # 1 * 75
    # 3 * 25
    # 5 * 15
    # 3 * 5 * 5
    e = defaultdict(int)
    for i, j in d.items():
        if j >= 2:
            e[2] += 1
        if j >= 4:
            e[4] += 1
        if j >= 14:
            e[14] += 1
        if j >= 24:
            e[24] += 1
        if j >= 74:
            e[74] += 1
    ans = 0
    ans += (e[2] - 1) * e[24]
    ans += (e[4] - 1) * e[14]
    ans += e[74]
    ans += (e[2] - 2) * e[4] * (e[4] - 1) // 2
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 65856
fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {

        val maxA = 1000000
        val sc = MyScanner()
        val n = sc.nextInt()
        val a = sc.intList()

        val cnt = Array(maxA + 1) { 0 }
        for (i in 0 until n) {
            cnt[a[i]]++
        }

        var ans = 0
        for (i in 1..maxA) {
            if (cnt[i] > 0) {
                if (cnt[i] == 1) ans++
                var j = i
                while (j <= maxA) {
                    cnt[j] = 0
                    j += i
                }
            }
        }

        println(ans)
    }
}

class MyScanner {
    private var ptr = 0
    private var l = listOf<String>()

    fun next(): String {
        while (l.size <= ptr) {
            l = readLine()!!.split(' ')
            ptr = 0
        }
        return l[ptr++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]

    fun list(): List<String> {
        ptr = l.size
        return readLine()!!.split(' ')
    }

    fun intList() = list().map { s -> s.toInt() }
    fun longList() = list().map { s -> s.toLong() }
    fun doubleList() = list().map { s -> s.toDouble() }

    fun array() = list().toTypedArray()
    fun intArray() = intList().toIntArray()
    fun longArray() = longList().toLongArray()
    fun doubleArray() = doubleList().toDoubleArray()
}


Measured memory_bytes: 65304
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  queue<pair<string, char>> Q;
  Q.push(make_pair("", 'a'));
  while (!Q.empty()){
    string S = Q.front().first;
    char c = Q.front().second;
    Q.pop();
    if (S.size() == N){
      cout << S << endl;
    } else {
      for (char l = 'a'; l < c; l++){
        Q.push(make_pair(S + l, c));
      }
      Q.push(make_pair(S + c, c + 1));
    }
  }
}

Measured memory_bytes: 8832
#include <stdio.h>

int main(void) {
	int W, H, x, y, r;
	scanf("%d%d%d%d%d",&W, &H, &x, &y, &r);
	if (0<=x+r&&0<=y+r)
	{
		if(0<=x-r&&0<=y-r)
		{
			if (x+r<=W&&y+r<=H)
			{
				printf("Yes\n");
			}
			else
			{
				printf("No\n");
			}
		}
		else
		{
			printf("No\n");
		}
	}
	else
	{
		printf("No\n");
	}
	return 0;
}



Measured memory_bytes: 2136
#include <stdio.h>
#include <stdlib.h>
int cmp(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
}
int main(void) {
  int n, ans, cnt = 0;
  int a[100001] = {};
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int tmp;
    scanf("%d", &tmp);
    a[tmp]++;
  }
  qsort(a, 100001, sizeof(int),cmp);
  
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) break;
    cnt++;
  }
  if (cnt%2 == 0) ans = cnt - 1;
  else ans = cnt;
  
  printf("%d\n", ans);
  
  return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k,a,b,flag=1;
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++)
	{
		if(i%k==0)
		{
			cout<<"OK"<<endl;
			flag=0;
			break;
		}
	}
	if(flag)
	{
	cout<<"NG"<<endl;
    }
}


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

int main() {
    int N;
    cin >> N;
    vector<int> d(N);
    for (int i=0; i<N; i++) cin >> d.at(i);
    int ans=0;
    for (int i=0; i<N-1; i++) {
        for (int j=i+1; j<N; j++) {
            ans += d.at(i)*d.at(j);
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S chmax(S &a, T b){
  if(a<b){
    a=b;
  }
  return a;
}
int N;
int M;
int Q;
int A[50];
int B[50];
int C[50];
int D[50];
int res;
int arr[10];
void doit(int dep, int st){
  int i;
  if(dep==N){
    int i;
    int tmp = 0;
    for(i=(0);i<(Q);i++){
      if(arr[B[i]] - arr[A[i]] == C[i]){
        tmp += D[i];
      }
    }
    chmax(res, tmp);
    return;
  }
  for(i=(st);i<(M);i++){
    arr[dep] = i;
    doit(dep+1, i);
  }
}
int main(){
  rd(N);
  rd(M);
  rd(Q);
  {
    int cTE1_r3A;
    for(cTE1_r3A=(0);cTE1_r3A<(Q);cTE1_r3A++){
      rd(A[cTE1_r3A]);A[cTE1_r3A] += (-1);
      rd(B[cTE1_r3A]);B[cTE1_r3A] += (-1);
      rd(C[cTE1_r3A]);
      rd(D[cTE1_r3A]);
    }
  }
  doit(0, 0);
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200419-1

// --- original code ---
// int N, M, Q, A[50], B[50], C[50], D[50];
// int res;
// 
// int arr[10];
// void doit(int dep, int st){
//   if(dep==N){
//     int tmp = 0;
//     rep(i,Q) if(arr[B[i]] - arr[A[i]] == C[i]) tmp += D[i];
//     res >?= tmp;
//     return;
//   }
// 
//   rep(i,st,M){
//     arr[dep] = i;
//     doit(dep+1, i);
//   }
// }
// 
// {
//   rd(N,M,Q,(A--,B--,C,D)(Q));
//   doit(0, 0);
//   wt(res);
// }


Measured memory_bytes: 3644
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      String n = sc.next();
      int k = sc.nextInt();
      Set<Integer> digitSet = new HashSet<>();
      for(int i = 0; i < k; i++)
        digitSet.add(sc.nextInt());

      char[] charArr = n.toCharArray();
      int[] numArr = new int[charArr.length];
      for(int i = 0; i < charArr.length; i++)
        numArr[i] = charArr[i] - '0';

      int carry = 0;
      for(int i = numArr.length - 1; i >= 0; i--) {
        int num = numArr[i] + carry;
        carry = num / 10;
        num %= 10;
        while(digitSet.contains(num)) {
          num++;
          if(num == 10) {
            carry = 1;
            num = 0;
          }
        }
        
        if(num != numArr[i]) {
          for(int j = i+1; j < numArr.length; j++) {
            int nu = 0;
            while(digitSet.contains(nu))
                nu++;
            numArr[j] = nu;
          }
        }
        numArr[i] = num;
      }
      StringBuilder sb = new StringBuilder();
      if(carry != 0) {
          while(digitSet.contains(carry))
            carry++;
          sb.append(carry);
          for(int i = 0; i < numArr.length; i++) {
            int num = 0;
            while(digitSet.contains(num))
              num++;
            sb.append(num);  
          }
      } else {
          for(int num : numArr)
            sb.append(num);
      }
      System.out.println(sb.toString());
  }
}

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

using namespace std;

int main() {

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

	vector<int> A(M);
	for (int i = 0; i < M; ++i)
	{
		cin >> A[i];
	}

	int ans = 0;

	for (int i = 0; i < M; ++i)
	{
		N -= A[i];
	}

	if (N >= 0) {
		cout << N << endl;
	}
	else {
		cout << "-1" << endl;
	}

	return 0;
}

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

using namespace std;
typedef long long lint;

#define RPT(i, b, e) for (int i = ((int)b); i <= ((int)e); i++)
#define RPT0(i, n) RPT(i, 0, ((int)n) - 1)
#define RPT1(i, n) RPT(i, 1, (n))
#define EACH(it, v) for (const auto& it : v)
#define ALL(v) v.begin(), v.end()

void resolve()
{
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> e(M);
    RPT0(i, M) cin >> e[i].first >> e[i].second;

    map<int, set<int>> m;
    RPT0(i, M)
    {
        m[e[i].first].insert(e[i].second);
        m[e[i].second].insert(e[i].first);
    }

    map<int, int> michishirube;
    michishirube[1] = 0;

    queue<int> q;
    q.push(1);

    while (!q.empty()) {
        auto cur = q.front();
        q.pop();
        EACH(it, m[cur])
        {
            if (michishirube.count(it) == 0) {
                michishirube[it] = cur;
                q.push(it);
            }
        }
    }

    cout << "Yes" << endl;
    RPT(i, 2, N) cout << michishirube[i] << endl;
}

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


Measured memory_bytes: 38012
#include <iostream>
#include <algorithm>
#include <vector>

typedef long long ll;

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

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

using namespace std;

int main(void){

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

  vector<int> x(n), y(n);
  vector<int> xAry, yAry;

  REP(i,n){
    cin >> x[i] >> y[i];
    xAry.push_back(x[i]);
    yAry.push_back(y[i]);
  }

  sort(xAry.begin(), xAry.end());
  sort(yAry.begin(), yAry.end());

  ll ans = 1LL * (xAry[n-1] - xAry[0]) * (yAry[n-1] - yAry[0]);

  REP(xi,n){
    FOR(xk,xi+1,n){
      REP(yi,n){
        FOR(yk,yi+1,n){

          int num = 0;
          ll lx = xAry[xi], rx = xAry[xk];
          ll by = yAry[yi], uy = yAry[yk];

          REP(i,n){
            if(lx <= x[i] && x[i] <= rx &&
               by <= y[i] && y[i] <= uy){
                 num++;
               }
          }

          if(num >= k) ans = min(ans,1LL * (rx-lx) * (uy -by));

        }
      }
    }
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

const int N = 1e5 + 5;
int n, q;
long long arr[N], cnt[N];

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

    cin >> n;
    long long sum = 0;
    for(int i = 1; i <= n; i++){
        cin >> arr[i];
        sum += arr[i];
        cnt[arr[i]]++;
    }

    cin >> q;
    while(q--){
        int b, c;
        cin >> b >> c;
        sum -= (long long) b * (cnt[b]);
        sum += (long long) c * (cnt[b]);
        cnt[c] += cnt[b];
        cnt[b] = 0;
        cout << sum << '\n';
    }


    return 0;
}

Measured memory_bytes: 5140
a = input().split()
m, tot = int(a[0]), int(a[1])

count = 0
for i in range(m+1):
  for j in range(m+1):
    k = m - i - j
    if k >= 0:
    	tot_sim = 10000*i + 5000*j + 1000*k
    	if tot == tot_sim:
      		print(i,j,k)
      		count += 1
      		exit()
if count == 0:
  print("-1 -1 -1")

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<numeric>
#include<set>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
typedef long long li;
#define minimize(a,b) (a>(b)?a=(b),1:0)
#define maximize(a,b) (a<(b)?a=(b),1:0)
#define ceil(a,b) (((a)+(b)-1)/(b))
#define yn(i) print((i)?"Yes":"No")
#define chmin(a,b) (a>(b)?a=(b),1:0)
#define abs(n) max((n),-(n))
#define dist(a,b) max((a)-(b),(b)-(a))
#define chmax(a,b) (a<(b)?a=(b),1:0)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define MOD 1000000000
#define rep(i,n) for(int i=0;i<(n);i++)

#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }




string key="keyence";

void add(char m,string s,set<string> st){
  int n=s.size();
  rep(i,n){
    if(s[i]!=m) continue;
    string t;
    repa(j,i,n){
      t.push_back(s[j]);
      st.insert(t);
    }
  }
}

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

int legal(string s,string t,int k){
  int n=s.size();
  repa(i,k,n){
    if(s[i]!=t[i-k]) return 0;
  }
  return 1;
}

string merge(string s,string t,int k){
  int n=s.size();
  string ret;
  rep(i,k) ret.push_back(s[i]);
  rep(i,n) ret.push_back(t[i]);
  return ret;
}


int main(){
  li n; cin >>n;
  vector<li> a(n),b(n);
  rep(i,n){
    li x; cin >>x;
    a[i]=x; b[i]=x;
  }
  sort(a.begin(),a.end());
  int mid=n/2;
  li m1=a[mid-1],m2=a[mid];
  rep(i,n){
    print((b[i]<=m1)?m2:m1);
  }
}





Measured memory_bytes: 6424
#include <stdio.h>

int main()
{
	int i = 0;
	int n = 0;
	int ave = 0;
	int* a = new int[10000];
	int cnt = 0;

	while (1) {
		
		scanf("%d", &n);

		if (n == 0)break;

		while (1) {
			scanf("%d", &a[i]);
			i++;
			if (i >= n)break;
		}

		for (i = 0; i < n; i++) {
			ave += a[i];
		}
		ave /= n;

		for (i = 0; i < n; i++) {
			if (a[i] <= ave)cnt++;
		}

		printf("%d\n", cnt);

		i = 0;
		n = 0;
		ave = 0;
		for (i = 0; i < n; i++) {
			a[i] = 0;
		}
		cnt = 0;
	}

    return 0;
}




Measured memory_bytes: 2728
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const int MAX_N=2e5,MAX_M=2e5;
const int INF=1e8;
int N,M;
typedef pair<int,int> P;
P pnt[MAX_N];
int M2;
int seg[(MAX_M+1)<<2],laz[(MAX_M+1)<<2];
void lazpro(int k,int a,int b){
	if (laz[k]!=0){
		seg[k]+=laz[k];
		if (b-a>1){
			laz[k*2+1]+=laz[k];
			laz[k*2+2]+=laz[k];
		}
		laz[k]=0;
	}
}
void add(int l,int r,int x,int k,int a,int b){
	if (r<=a || b<=l){
		return;
	}
	if (l<=a && b<=r){
		laz[k]+=x;
		return;
	}
	lazpro(k,a,b);
	add(l,r,x,k*2+1,a,(a+b)>>1);
	add(l,r,x,k*2+2,(a+b)>>1,b);
	lazpro(k*2+1,a,(a+b)>>1);
	lazpro(k*2+2,(a+b)>>1,b);
	seg[k]=max(seg[k*2+1],seg[k*2+2]);
}
	
int query(int l,int r,int k,int a,int b){
	if (r<=a || b<=l){
		return -INF;
	}
	lazpro(k,a,b);
	if (l<=a && b<=r){
		return seg[k];
	}
	return max(query(l,r,k*2+1,a,(a+b)>>1),query(l,r,k*2+2,(a+b)>>1,b));
}
int main(){
	cin>>N>>M;
	REP(i,N){
		int l,r;
		cin>>l>>r;
		pnt[i]=P(l,r);
	}
	sort(pnt,pnt+N);
	int ans=max(N-M,0);
	M2=1;
	while(M2<M+1){
		M2<<=1;
	}
	REP(i,M+1){
		seg[M2-1+i]=-M+i;
	}
	REP(i,M2-M-1){
		seg[M2-1+M+1+i]=-INF;
	}
	REP(i,M2-1){
		int k=M2-2-i;
		seg[k]=max(seg[k*2+1],seg[k*2+2]);
	}
	REP(i,N){
		add(0,pnt[i].second,1,0,0,M2);
		ans=max(ans,query(0,M+1,0,0,M2)-pnt[i].first);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 7424
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
 ll a,b;
  cin>>a>>b;
  if(a<=2*b){
cout<<0<<endl;
  }
  else{
    cout<<a-2*b<<endl;
  }
}


Measured memory_bytes: 3600
A,B=map(int,input().split())
S=input()
number=0
list=['0','1','2','3','4','5','6','7','8','9']
for a in range(A):
    if S[a] in list:
        number+=1
if S[A]=='-':
    number+=1
for a in range(B):
    if S[A+a+1] in list:
        number+=1
if number==A+B+1:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a<b){
    cout<<"a < b"<<endl;
  }
  else if(a>b){
    cout<<"a > b"<<endl;
  }
  else{
    cout<<"a == b"<<endl;
  }
  return 0;
}

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

int main() {
    string c1; cin >> c1;
    string c2; cin >> c2;
    if(c1[0]==c2[2] && c1[1]==c2[1] && c1[2]==c2[0]) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdlib>
using namespace std;
int maps[1005][1005];
int main() {
	int h,w,a,b;
	cin>>h>>w>>a>>b;
	memset(maps,0,sizeof(maps));
	for(int i=1; i<=b; i++) {
		for(int j=a+1; j<=w; j++) {
			maps[i][j]=1;
		}
	}
	for(int i=b+1; i<=h; i++) {
		for(int j=1; j<=a; j++) {
			maps[i][j]=1;
		}
	}
	for(int i=1; i<=h; i++) {
		for(int j=1; j<=w; j++)cout<<maps[i][j];
		cout<<'\n';
	}
	return 0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(x) cout<<#x<<":";cout<<x<<endl;
#define debugs(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

int n;
vector<ll> a;
vector<vector<int>> g;
vector<ll> ans;
vector<ll> lis(200010,LINF);
ll L;

void dfs(int par,int now){

    // cout<<par<<" "<<now<<endl;

    auto ite=lower_bound(ALL(lis),a[now]);
    ll prea=*ite;
    bool f=false;
    if(*ite==LINF)f=true,L++;
    *ite=a[now];

    ans[now]=L;


    for(int to:g[now])if(par!=to){
        dfs(now,to);
    }
    if(f) L--;
    *ite=prea;
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    cin>>n;
    a.resize(n);
    g.resize(n);
    ans.resize(n);
    rep(i,n) cin>>a[i];
    rep(i,n-1){
        int u,v;cin>>u>>v;u--,v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    dfs(-1,0);

    for(auto x:ans) cout<<x<<endl;
    return 0;
}


Measured memory_bytes: 33284
N = int(input())
A = list(map(int, input().split()))

M = 0
sum = 0
for i in range(N):
  sum += A[i]

for i in range(N-1):
  sum = sum - A[i]
  M += A[i] * sum
  if M > 10 ** 9 + 7:
    M = M % (10 ** 9 + 7)
print(M)

Measured memory_bytes: 31612
/*
    飲んだ魔剤で家が建つ。
    created at: 2020-05-02 20:52:06
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF 1000000000

int main()
{
    int k, a, b;
    cin >> k >> a >> b;

    int ok = 0;
    for (int i = k; i <= b; i += k) {
        if (i >= a) {
            ok = 1;
        }
    }

    if (ok) cout << "OK" << endl;
    else cout << "NG" << endl;

    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

int main()
{
	string s;
	cin >> s;
	int ans = 0;
	rep(i,s.size()-1){
		if (s[i] != s[i+1]) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3768
#include<stdio.h>
int main(void){
    int r,c,i,j,s=0,f=0;
    int a[100][100],b[100]={0};
    scanf("%d %d",&r,&c);
    for(i=0;i<r;i++){
        for(j=0;j<c;j++){
            scanf("%d",&a[i][j]);
        }
    }
    for(i=0;i<r;i++){
        for(j=0;j<c;j++){
            printf("%d ",a[i][j]);
            s+=a[i][j];
            b[j]+=a[i][j];
        }
        printf("%d\n",s);
        s=0;
    }
    for(i=0;i<c;i++){
        printf("%d ",b[i]);
        f+=b[i];
    }
    printf("%d\n",f);
    return 0;
}





Measured memory_bytes: 2056
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;



int main(void){
	ll X,Y,ans=1;
	scanf("%lld%lld",&X,&Y);
	while(Y>=X*2){
		ans++;
		X*=2;
	}
	
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};

ll fact(ll n){
  if (n==0){
    return 1;
  }else{
    return (n * fact(n-1))%MOD;
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  ll ans;
  cin >> n >> m;
  if (abs(n-m)>1){
    ans =  0;
  }else if (abs(n-m)==1){
    ans = (fact(n)*fact(m))%MOD;
  }else{
    ans = (fact(n)*fact(m)*2)%MOD;
  }
  cout << ans << endl;

  

}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstdio>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <set>
#include <utility>
#include <functional>
using namespace std;
typedef pair<int, int> pii;
typedef pair<string, int> P;
typedef long long ll;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
const int MAXN = 100000;
const int MAXE = 100000;
const int MAXV = 10000;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
struct UnionFind{
    vector<int> par,rank;
    UnionFind(int n):par(n),rank(n){
        for(int i=0;i<n;++i) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        return par[x]=root(par[x]);
    }
    void unite(int x,int y){
        int rx=root(x),ry=root(y);
        if(rx==ry) return ;
        if(rank[ry]>rank[rx]) par[rx]=ry;
        else par[ry]=rx;
        if(rank[rx]==rank[ry]) rank[rx]++;
    }
    bool same(int x,int y){
        return root(x)==root(y);
    }
};
vector<ll> fac(1e6),inv(1e6),finv(1e6);
void initcom(){
    fac[0]=fac[1]=1;
    inv[1]=1;
    finv[0]=finv[1]=1;
    for(int i=2;i<1e6;++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;
    }
}
ll com(int n,int k){
    if(n<0||k<0) return 0;
    if(n<k) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
int compress(vector<int> &x,int w){
    vector<int> sx;
    for(int i=0;i<(int)x.size();++i){
        for(int d=-2;d<=2;++d){
            int t=x[i]+d;
            if(t>=0&&t<w) sx.push_back(t);
        }
    }
    sort(sx.begin(),sx.end());
    sx.erase(unique(sx.begin(),sx.end()),sx.end());
    for(int i=0;i<(int)x.size();++i){
        x[i]=lower_bound(x.begin(),x.end(),x[i])-x.begin();
    }
    return (int)sx.size();
}
int main(){
    int n,k;cin>>n>>k;
    vector<int> a(n);
    for(int i=0;i<n;++i) cin>>a[i];
    for(int i=k;i<n;++i){
        if(a[i-k]<a[i]) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 27536
#include<bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
using namespace std;
//using namespace __gnu_pbds;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long 
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,arr,n) for(int i=arr;i<=n;i++)
#define repd(i,arr,n) for(int i=arr;i>=n;i--)
#define trav(arr,x) for(auto& arr:x)
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(arr) arr.size()
#define pi 3.14159265358979323846
#define MAX (1000*1000*1000+7)
#define vi vector<int>
#define pii pair<int,int>
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int,vi,greater<int> >
//#define endl "\n"
 
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
const int mod=998244353;
int power(int a,int b)
{
    int ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return ans;
}

int32_t main()
{
    fast;

    int n,m,k,ans=0,val,val1;
    cin>>n>>m>>k;

    vi fac(n+2,0);

    fac[0]=1;
    fac[1]=1;

    repa(i,2,n)
    {
        fac[i]=(fac[i-1]*i)%mod;
    }

    rep(i,k+1)
    {
        val=fac[n-i-1]*fac[i];
        val%=mod;

        val1=fac[n-1]*power(val,mod-2);
        val1%=mod;

        val=power(m-1,n-i-1);
        val*=val1;
        val%=mod;

        val*=m;
        val%+mod;
        ans+=val;
        ans%=mod;
    }

    

    cout<<ans<<endl;
    
}

Measured memory_bytes: 4752
#include <bits/stdc++.h>
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<lli>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, k, n, w, ans = 0, count = 0;
  string s, t;
  cin >> n;
  vi x(n), y;
  rep(i, 0, n)
  {
    cin >> x[i];
  }
  repe(i, 1, 100)
  {
    ans = 0;
    rep(j, 0, n)
    {
      count = (x[j] - i) * (x[j] - i);
      ans += count;
    }
    y.push_back(ans);
  }
  SORT(y);
  cout << y[0] << endl;
}

Measured memory_bytes: 256
import java.util.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        String line = null;
        int sum = 0;
        for(int i = 1; i < N+1; i++){
            int L = 0;
            line = String.valueOf(i);
            String []array = line.split("");
            for(int j = 0; j < array.length; j++){
                L += Integer.parseInt(array[j]);
            }
            if(L >= A && L <= B){
                sum += i;
            }
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 32852
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll INF=1000000010;
const ll MOD=1000000007;
const ll LINF=4000000000000000000;
const long double EPS=1e-9;
typedef pair<int,int> P;
int main(){
    string s;cin>>s;
    int n=s.length();
    int ans=0;
    for(int i=1;i<n-1;i++){
        if(i%2){
            if(s.substr(0,(i+1)/2)==s.substr((i+1)/2,(i+1)/2)){
                ans=i+1;
            }
        }
    }
    cout<<ans<<endl;
}   


Measured memory_bytes: 256
N,W=map(int,input().split())
w=[]
v=[]
jmax=100010
nmax=110

for i in range(N):
    a,b=map(int,input().split())
    w.append(a)
    v.append(b)
    
DP= [[0 for j in range(jmax)] for i in range(nmax)]


def chmax(a,b):
    if a>b:
        return a
    else:
        return b


for i in range(N):
    for j in range(jmax):
        if  j-w[i]>=0:
            DP[i+1][j]=chmax(DP[i][j],DP[i][j-w[i]]+v[i])
        else:
            DP[i+1][j]=DP[i][j]

            
print(DP[N][W])

Measured memory_bytes: 181976
#include<bits/stdc++.h>
using namespace std;
#define F(i,s,e) for(int i=s;i<e;++i)

int main(){
    int n;
    string s;
    cin >> n >> s;
    long cnt=0;
    F(i,0,n-2){
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C'){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256