akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define fi first
#define se second
#define show(x) cout<<#x<<"="<<x<<"\n"
typedef long long ll;
template<typename T>
void print_to(std::ostream &os,const char *,const char *tail,const T &fst){
  os<<fst<<tail;
}
template<typename Fst,typename... Rst>
void print_to(std::ostream &os,const char *del,const char *tail,const Fst &fst,const Rst &... rst){
  os<<fst<<del;
  print_to(os,del,tail,rst...);
}
template<typename Iter>
void print_to_(std::ostream &os,const char *del,const char *tail,Iter bgn,Iter end){
  for(Iter it=bgn;it!=end;){
    os<<*it;
    if(++it!=end)os<<del;
    else os<<tail;
  }
}
template<typename Fst,typename... Rst>
void println(const Fst &fst,const Rst &... rst){
  print_to(std::cout,"\n","\n",fst,rst...);
}
template<typename Fst,typename... Rst>
void print(const Fst &fst,const Rst &... rst){
  print_to(std::cout," ","\n",fst,rst...);
}
template<typename Iter>
void println_(Iter bgn,Iter end){
  print_to_(std::cout," ","\n",bgn,end);
}
using namespace std;


//const int MOD=(ll)1e10+7;
const int dy[]={1,0,-1};
const int dx[]={1,0,-1};
ll n,m,h,w;
string s;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1=freopen("in","r",stdin);
  //stream2=freopen("out","w",stdout);
  if(stream1==NULL)return 0;
  //if(stream2==NULL)return 0;
#endif
  cin>>s;
  int n=(int)s.size();
  int mink=999999999;
  for(int i=1;i<n;i++){
    if(s[i]!=s[i-1]){
        mink=min(max(i,n-i),mink);
    }
  }
  if(mink==999999999){
    if(s[0]=='0')print(n);
    else print(n);
  }else{
    print(mink);
  }
#ifdef LOCAL_DEFINE
  cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
    return 0;
}






Measured memory_bytes: 512
#include <iostream>
using namespace std;
 
int main() {
    int v1, v2;
    int l[10];
    int ls;
    char c;
    while (cin >> l[0] >> c) {
        for (int i=1; i<10; i++)
            cin >> l[i] >> c;
        cin >> v1 >> c >> v2;
 
        ls = 0;
        for (int i=0; i<10; i++)
            ls += l[i];
         
        double in = ((double)v1)/(v1+v2)*ls;
        int dis = 0;
        for (int i=0; i<10; i++) {
            dis += l[i];
            if ((double)dis >= in) { cout << i+1 << endl; break; }
        }
    }
    return 0;
}

Measured memory_bytes: 1160
use proconio::input;

fn main() {
    input! {
        n: i64,
    }

    if solve(n) {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn solve(n: i64) -> bool {
    if n % 10 == 7 {
        return true;
    } else if n == 0 {
        return false;
    }

    solve(n / 10)
}


Measured memory_bytes: 2112
import java.util.*;
public class Main {
    public static void main(String[] argas){
        Scanner sc = new Scanner(System.in);
        int N,sum_price=0;
        N = sc.nextInt();
        int [] A = new int[N+2];
        int [] price = new int[N];
        for(int a=0;a<N+2;a++){
            if(a==0) A[a] =0;
            else if(a==N+1) A[a] =0;
            else A[a] = sc.nextInt();
        }
        for(int a=0;a<N+1;a++){
            sum_price+= Math.abs(A[a]-A[a+1]);
        }

        for(int a=0;a<N;a++){
            price[a] = sum_price - Math.abs(A[a]-A[a+1]) -Math.abs(A[a+1]-A[a+2])+Math.abs(A[a]-A[a+2]);
        }
        for(int a=0;a<N;a++){
            System.out.println(price[a]);
        }
    }
}


Measured memory_bytes: 66084
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  if((N/10)%111==0 || (N%1000)>=0 && (N%1000)%111==0) {
    cout << "Yes" << endl;}
  else {
    cout << "No" << endl;}
  }


Measured memory_bytes: 256
<?php
// input取得パターン（横並び2）
$b = trim(fgets(STDIN));
$array = explode(' ', $b);

if (bin2hex($array[0]) < bin2hex($array[1])){
  echo '<';
}elseif (bin2hex($array[0]) > bin2hex($array[1])){
  echo '>';
}else {
  echo '=';
}



Measured memory_bytes: 4604
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define re register
#define LL long long
#define MOD 998244353
#define MAXN 100005
using namespace std;
struct Edge{
	int to,nex,w;Edge(int _=0,int __=0,int ___=0){to=_,nex=__,w=___;}
}e[MAXN<<1];
int n,m,cnt,es,c[5],hd[MAXN],col[MAXN];
LL ans=0;
bool ok,vis[MAXN];
int rd(){
	int x=0,tp=1;char c;c=getchar();
	while(c<'0' || c>'9'){if(c=='-')tp=-1;c=getchar();}
	while(c>='0' && c<='9'){x=(x*10+c-'0');c=getchar();}
	return x*tp;
}
void adde(int x,int y,int z){e[++cnt]=Edge(y,hd[x],z);hd[x]=cnt;}
LL quick_mod(LL a,LL x){LL res=1;while(x){if(x&1)(res*=a)%=MOD;(a*=a)%=MOD,x>>=1;}return res;}
void dfs(int now){
	c[col[now]]++,vis[now]=1;
	for(int i=hd[now];i;i=e[i].nex){
		es+=(e[i].w==1);
		if(!vis[e[i].to])col[e[i].to]=(col[now]+e[i].w+3)%3,dfs(e[i].to);
		else if(col[e[i].to]!=(col[now]+e[i].w+3)%3)ok=0;
	}
}
int main(){
	// freopen("testdata.in","r",stdin);
	// freopen("shit.out","w",stdout);
	int x,y;
	n=rd(),m=rd();
	for(int i=1;i<=m;i++){
		x=rd(),y=rd();
		adde(x,y,1),adde(y,x,-1);
	}
	for(int i=1;i<=n;i++){
		if(vis[i])continue;
		c[0]=c[1]=c[2]=es=0,ok=1;
		dfs(i);
		if(!ok)ans+=1ll*(c[0]+c[1]+c[2])*(c[0]+c[1]+c[2]);
		else if(c[0] && c[1] && c[2])ans+=1ll*c[0]*c[1]+1ll*c[1]*c[2]+1ll*c[0]*c[2];
		else ans+=es;
	}
	printf("%lld\n",ans);
	// printf("%.2lf\n",(double)clock()/CLOCKS_PER_SEC);
	return 0;
}

Measured memory_bytes: 6528
import sys
def input():
    return sys.stdin.readline()[:-1]
t=list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
at1=a[0]*t[0]
at2=a[1]*t[1]
bt1=b[0]*t[0]
bt2=b[1]*t[1]
if at1+at2==bt1+bt2:
    print("infinity")
    quit()

if at1>bt1:
    if at1+at2>bt1+bt2:
        print(0)
        quit()
    sa1=at1-bt1
    sa2=bt1+bt2-at1-at2
    # print(sa1//sa2*2+1)
else:
    if bt1+bt2>at1+at2:
        print(0)
        quit()
    sa1=bt1-at1
    sa2=-(bt1+bt2-at1-at2)
    # print(sa1//sa2*2+1)
if sa1%sa2==0:
    print(sa1//sa2*2)
else:
    print(sa1//sa2*2+1)

Measured memory_bytes: 38384
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<utility>
#include<cmath>
#include<assert.h>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

int N;
int A[100100];
map<int, int> AIdx;

signed main() {
    cin >> N;
    rep(i, N) {
        cin >> A[i];
        AIdx[A[i]] = i;
    }
    sort(A, A + N);
    int ans = 0;
    for (int i = 0; i < N; i += 2) {
        if (AIdx[A[i]] % 2 == 1)++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7296
def toi(a)
	b = []
	a.each do |n|
		b << n.to_i
	end
	b	
end

begin
a=gets().split
x = a[0].to_i
y = a[2].to_i
op = a[1]
case op
when "+" then
	z = x + y
	puts z
when "-" then
	z = x -y
	puts z
when "*" then
	z = x * y
	puts z
when "/" then
	z = x /y
	puts z
else
end
end while op != "?" 

Measured memory_bytes: 8640
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <assert.h>
#include <sys/time.h>
#include <fstream>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define REP(i,n)  FOR(i,0,n)
#define each(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define deb(x) cerr << #x << " = " << (x) << " , ";
#define debl cerr << " (L" << __LINE__ << ")"<< endl;
#define sz(s) (int)((s).size())


#define clr(a) memset((a),0,sizeof(a))
#define nclr(a) memset((a),-1,sizeof(a))
#define pb push_back
#define INRANGE(x,s,e) ((s)<=(x) && (x)<(e))
#define MP(x,y) make_pair((x),(y))

double pi=3.14159265358979323846;

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

template<typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& z){
	os << "[ ";
	REP(i,z.size())os << z[i] << ", " ;
	return ( os << "]" << endl);
}

template<typename T> std::ostream& operator<<(std::ostream& os, const set<T>& z){
	os << "set( ";
	EACH(p,z)os << (*p) << ", " ;
	return ( os << ")" << endl);
}

template<typename T,typename U> std::ostream& operator<<(std::ostream& os, const map<T,U>& z){
	os << "{ ";
	EACH(p,z)os << (p->first) << ": " << (p->second) << ", " ;
	return ( os << "}" << endl);
}

template<typename T,typename U> std::ostream& operator<<(std::ostream& os, const pair<T,U>& z){
	return ( os << "(" << z.first << ", " << z.second << ",)" );
}

double get_time(){
	struct timeval tv;
	gettimeofday(&tv, NULL);
	return tv.tv_sec + tv.tv_usec*1e-6;
}

typedef unsigned int uint32_t;
struct RND{
	uint32_t x;
	uint32_t y;
	uint32_t z;
	uint32_t w;
	RND(){
		x=123456789;
		y=362436069;
		z=521288629;
		w=88675123;
	}
	void init(int seed){
		x=123456789;
		y=362436069;
		z=521288629;
		w=seed+100;
		REP(i,10)get();
	}
	uint32_t get(){
		uint32_t t;
		t=x^(x<<11);
		x=y;y=z;z=w;
		w=(w^(w>>19))^(t^(t>>8));
		return w;
	}
};
RND rnd;

void _main(istream &inp){
	string s;
	int k;
	inp >> s >> k;
	rep(j,s.size()){
		int cost = 'a'+26-s[j];
		if(s[j]>'a' && cost<=k ){
			k -= cost;
			s[j]='a';
		}
	}
	s[s.size()-1] = ( (s[s.size()-1] - 'a')+k )%26 + 'a';
	cout << s <<endl;
}

int main(){
	if(0){
		ifstream ifs("test.txt");
		_main(ifs);
	}
	else{
		_main(cin);
	}
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
 
#define A_MAX 1000000
#define A_MAX_HALF 500000
 
using namespace std;
 
int min_factor[A_MAX + 1];
int q[A_MAX + 1];
int a[A_MAX + 1];
vector<int> primes{ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997 };
int N;
 
// 入力読み込みは uzzy 氏のコードを真似した
const int cm = 1 << 23;
char cn[cm], * ci = cn, ct;
inline int getint() {
    int A = 0;
    while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
    return A;
}
 
int main() {
    fread(cn, 1, cm, stdin);
  
    for (int i = 2; i <= A_MAX_HALF; ++i) {
        if (!min_factor[i]) {
            min_factor[i] = i;
        }
        int min_factor_i = min_factor[i];
        for (int p : primes) {
            int n = i * p;
            if (n > A_MAX) {
                break;
            }
            min_factor[n] = p;
            if (p == min_factor_i) {
                q[n] = q[i];
                break;
            } else {
                q[n] = i;
            }
        }
    }
 
    N = getint();
    for (int i = 0; i < N; ++i) {
        ++a[getint()];
    }
 
    int is_pairwise_coprime = 1;
    for (int n = A_MAX; n > 1; --n) {
        int an = a[n];
        if (an) {
            if (an > 1) {
                if (an == N) {
                    printf("not coprime\n");
                    return 0;
                }
                is_pairwise_coprime = 0;
            }
            a[min_factor[n]] += an;
            a[q[n]] += an;
        }
    }
    if (is_pairwise_coprime) {
        printf("pairwise coprime\n");
    } else {
        printf("setwise coprime\n");
    }
 
    return 0;
}

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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
      return a.second > b.second;
    }else{
      return a.first > a.first;
    }
}

int main(){
  int x,a;
  cin>>x>>a;
  if(x<a){
    cout<<0<<endl;
  }else{
    cout<<10<<endl;
  }
}


Measured memory_bytes: 256
A,B,C,X,Y = map(int, input().split(" "))

price = min(A+B, C*2)*min(X, Y)

if X > Y:
    if C*2 < A:
        price += (X-Y)*(C*2)
    else:
        price += (X-Y)*A
elif X < Y:
    if C*2 < B:
        price += (Y-X)*(C*2)
    else:
        price += (Y-X)*B

print(price)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H,W;
  cin >> H >> W;
  
  string arr[50];
  for (int i=0; i<50; i++){
    cin >> arr[i];
  }
  
  int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
  int dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};

  for (int y = 0; y< H; y++){
    for(int x=0; x<W; x++){
      if (arr[y][x] == '#') continue;
      
      int sum = 0;
      for (int d=0; d<8; d++){
        int ny = y + dy[d];
        int nx = x + dx[d];
        
        if (ny<0 || ny>=H) continue;
        if (nx<0 || nx>=W) continue;
        if (arr[ny][nx] == '#') sum++;
      }
      arr[y][x] = char('0'+sum);
    }
  }
  
  for (int y = 0; y< H; y++){
      cout << arr[y] << endl;
  }

}

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

int main() {
  string S;
  cin >> S;
  int N = S.size();

  vector<int> ans(N);

  int j;
  for (int i = 0; i < N; i++) {
    if (S.at(i) == 'R') j = i;
    else ans.at(j + (i - j) % 2)++;
  }
  for (int i = N - 1; i >= 0; i--) {
    if (S.at(i) == 'L') j = i;
    else ans.at(j - (j - i) % 2)++;
  }

  for (int i = 0; i < N; i++) cout << ans.at(i) << "\n";
}

Measured memory_bytes: 1024
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h> 
using namespace std;
	typedef long long int lli;
	const int MaxN=200005;
	#define fst first
	#define snd second
	#define mp make_pair
	lli mcd(lli a,lli b){	
		if(a==0)return b;
		return mcd(b%a,a);
	}		
	set <string> res;
int main(){
	lli t,N,Q,i,j,p,q,c=0;
	string word;
	string aux;
	cin>>word;
	N=word.size();
	cin>>Q;
	for(i=0;i<N;i++){
		aux=word[i];
		res.insert(aux);
		for(j=i+1;j<min(lli(N),i+50);j++){
			aux.push_back(word[j]);
			res.insert(aux);
		}
	}
	set <string>::iterator it;
	for(it=res.begin();it!=res.end();it++){
		c+=1;
		if(c==Q){
			cout<<*it;
		}
	}
}

Measured memory_bytes: 23424
#include <sstream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cassert>
#include <ctime>
#include <map>
#include <math.h>
#include <cstdio>
#include <set>
#include <deque>
#include <memory.h>
#include <queue>

#pragma comment(linker, "/STACK:64000000")
typedef long long ll;

using namespace std;

const int MAXN = 1 << 18;
const int MOD = 1; // 1000 * 1000 * 1000 + 7;
const int INF = 2e9;
const double PI = acos(-1.0);

int main() {
#ifdef _MSC_VER
	freopen("input.txt", "r", stdin);
#endif

	ll n, s;
	while (cin >> n >> s) {
		ll ans = -1;
		int base;
		for (base = 2; 1LL * base * base <= n; base++) {
			ll x = n;
			ll sum = 0;
			while (x) {
				sum += x % base;
				x /= base;
			}
			if (sum == s) {
				ans = base;
				break;
			}
		}
		if (ans != -1) {
			cout << ans << endl;
			continue;
		}
		for (int a = base - 1; a >= 1; a--) {
			ll b = s - a;
			if (n - b > 0 && (n - b) % a == 0) {
				ll cbase = (n - b) / a;
				if (n % cbase + n / cbase == s && n / cbase / cbase == 0) {
					ans = cbase;
					break;
				}
			}
		}
		if (ans != -1) {
			cout << ans << endl;
			continue;
		}
		if (s == 1 && n > 1) {
			cout << n << endl;
			continue;
		}
		if (s == n) {
			cout << n + 1 << endl;
			continue;
		}
		cout << -1 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
/*
	0554:Total Time
*/
#include	<iostream>

using namespace std;

int main(void) {
	int t1, t2, t3, t4;
	int totalS;
	
	cin >> t1 >> t2 >> t3 >> t4;
	totalS = t1 + t2 + t3 + t4;
	
	cout << totalS / 60 << endl;
	cout << totalS % 60 << endl;
}

Measured memory_bytes: 1160
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;



int main(){

    int i,n,x,count=0;
    cin >> n >> x;
    int l[n],d[n+1];
    for( i=0;i<n;i++){
        cin >> l[i];
    }
    d[0]=0;

    for(i=1;i<n+1;i++){
        if(count==0)count+=1;
        d[i]=d[i-1]+l[i-1];
        if(d[i]>x)break;
        count+=1;
        
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 384
import java.util.*;
import java.util.function.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    sc.close();

    int[] map = new int[100];
    for (int n = 1; n <= N; n++) {
      int h = 0;
      for (int m = n; m != 0; m /= 10) h = m;
      int l = n % 10;
      int k1 = h * 10 + l;
      map[k1]++;
    }

    long ans = 0;
    for (int k1 = 0; k1 < map.length; k1++) {
      int k2 = (k1 % 10) * 10 + k1 / 10;
      ans += map[k1] * map[k2];
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
// 基本テンプレート

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

typedef pair<int, int> pii;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int a[100010];
int b[3];

signed main() {
    int N; cin >> N;
    rep(i,0,N) {
        int p; cin >> p;
        if(p % 4 == 0) b[0]++;
        else if(p % 2 == 0) b[1]++;
        else b[2]++;
    }

    if(b[1] == 0) {
        if(b[0] + 1 >= b[2]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    else {
        if(b[0] >= b[2]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

constexpr int P = 998244353;

ll powmod(ll n, ll k) {
    ll r = 1, t = n % P;
    for (; k != 0; k /= 2) {
        if (k & 1) r = r * t % P;
        t = t * t % P;
    }
    return r;
}

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

    vector<int> inv(n / 2 + 1);
    inv[1] = 1;
    for (int i = 2; i <= n / 2; i++) {
        inv[i] = (ll)(P - P / i) * inv[P % i] % P;
    }

    ll r = 0, s = 1, t = 1;
    for (int i = n; i > n / 2; i--) {
        r += t * s % P;
        (s *= 2) %= P;
        (t *= i) %= P;
        (t *= inv[n - i + 1]) %= P;
    }
    r = powmod(3, n) - r * 2;

    r %= P;
    if (r < 0) r += P;

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 19712
N, K = map(int, input().split())

M = N // K
ans = M * (M - 1) * (M - 2) + M * (M - 1) * 3 + M

if K % 2 == 0:
    if N % K >= K // 2:
        M += 1
    ans += M * (M - 1) * (M - 2) + M * (M - 1) * 3 + M

print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N,x;
  x =0;
  cin >> N;
  for (int a=N; a > 0; a/=10){
    x += a % 10;
  }
  if( N % x == 0)
    cout << "Yes" << endl;
  else if(N % x != 0)
    cout << "No" << endl;
}
       

Measured memory_bytes: 256
alphabets = ("a".."z").to_a
ans = Array.new(alphabets.length, 0)

while line = gets
    alphabets.each_with_index do |n, i|
        ans[i] +=  line.downcase.split("").grep(n).length
    end
end

alphabets.each_with_index do |n, i|
    puts "#{alphabets[i]} : #{ans[i]}"
end


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

using namespace std;

#define sp(x) cout<<setprecision(x);
#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 inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k; cin>>n>>k;
    string s; cin>>s;
    s[k-1]+=32;
    print(s);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint 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(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 

    int main(){
        lint s;
        cin>>s;
        COMinit();
        lint x=1;
        lint ans=0;
        while(x*3<=s){
            lint g=s-x*3;
            ans+=COM(g+x-1,x-1);
            x++;
            ans%=MOD;
        }
    cout<<ans<<endl;
    }
      

Measured memory_bytes: 27088
import java.util.*;

public class Main{

  static Scanner sc = new Scanner(System.in);
  static StringBuilder sb = new StringBuilder();

  public static void main(String[] args) {

    int n = nextInt();
    int m = nextInt();

    List<List<Integer>> G = new ArrayList<>();
    for(int i=0;i<n;i++){
      G.add(new ArrayList<>());
    }

    //2次元リストから1次元リストを取り出し、格納
    for(int i=0;i<m;i++){
      int a = nextInt() - 1;
      int b = nextInt() - 1;
      G.get(a).add(b); // [G3.get(a[i])] はリスト
      G.get(b).add(a);
    }

    //ノードiのノード0までの距離を格納
    int[] kyori = new int[n];

    //今探索している場所の深さ
    int depth = 1;

    //ノードiを検出済みかどうか
    boolean[] seen = new boolean[n]; //初期値はfalse
    //検出済みのノードを起点にした探索の2回目以降を防ぐ

    //これから隣接を探索するリスト
    ArrayDeque<Integer> todo = new ArrayDeque<>(); //先入先出（キュー）

    //ノード0からスタートするため
    seen[0] = true;
    todo.add(0);

    //これから隣接を探索するノード番号の格納先
    int v = 0;

    //探索中の深さのノードの数
    int width = 1; //始めはノード0のみなので1

///////////////////////////////////////////////////////////////
    while(todo.size()>0){

      v = todo.removeFirst();

      //vがどこと繋がっているか見る
      for(int i : G.get(v)){
        if(!seen[i]){ //未検出なら
          seen[i] = true; //検出済みにする
          todo.addLast(i); //探索リストに追加
          kyori[i] = depth; //深さを格納
        }
      }

      //深さ記録
      width --;

      if(width==0){ //今の深さのノードを全て探索し終えたら
        depth++; //深さをプラス1
        width = todo.size(); //次から探索する深さのノード数を記録
      }

    }
///////////////////////////////////////////////////////////////

    //解答が存在するか否か
    boolean ok = true;

    //答えを格納
    int[] ans = new int[n];

    for(int i=1;i<n;i++){ //G[1]～G[n-1]に対して（0以外の全ノードに対して）
      for(int j : G.get(i)){ //G[i]の要素を1つずつjに代入していく
        if(kyori[i]>kyori[j]){ //2つ小さい深さのノードには繋がらないので、これでok
          ans[i] = (j+1); //実際のノード番号はプラス1
          break;
        }
      }
      if(ans[i]==0){ //ノード番号が更新されなければ、
        ok = false;
        break;
      }
    }

    if(ok){
      System.out.println("Yes");
      for(int i=1;i<n;i++){
        System.out.println(ans[i]);
      }
    }
    else{
      System.out.println("No");
    }

  }

  static int nextInt(){
    return Integer.parseInt(sc.next());
  }

}


Measured memory_bytes: 77704
#include <bits/stdc++.h>
using namespace std;
int n;
long long a[3010];
long long dp[3001][3001][2];
long long getScore(int i = 0 , int j = n-1 , bool player = 0)
{
    if(i>j)return 0;

    long long &ret = dp[i][j][player];
    if(~ret)    return ret;

    if(player)
    return ret = min(getScore(i+1,j,!player) -a[i],getScore(i,j-1,!player) -a[j]);
    else
    return ret = max(getScore(i+1,j,!player) +a[i],getScore(i,j-1,!player) +a[j]);

}

int main()
{
    cin >> n;
    for(int i = 0 ; i < n ; i++)    cin >> a[i];
    memset(dp,-1,sizeof dp);
    cout << getScore();
    return 0;
}


Measured memory_bytes: 141184
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<string>
#include<map>

using namespace std;

int main(void) {
	int A, B;
	cin >> A >> B;
	int count = A;
	int ans = 1;
	if (B == 1) {
		cout << 0;
	}
	else {
		while (B > count) {
			count += A - 1;
			ans++;
		}
		cout << ans;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin >> n;
  m = n%10;
  int k[5] = {2,4,5,7,9};
 
  string s;
  for(int i =0; i < 5; i++){
    if(k[i] == m)
    {s ="hon";
     break;}
      if(m == 3){
    s = "bon";
  }else{
    s = "pon";}
  }

  cout << s << endl;
}

Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;
#define PI 3.141592653589793

int main(){
  int N; cin >> N;
  pair<ll, ll>P = {1, 1};
  rep(i, N){
    ll a, b; cin >> a >> b;
    ll p = max((P.first-1)/a + 1, (P.second-1)/b + 1);
    P.first=a*p; P.second=b*p;
    //cout << P.first << " " << P.second << endl;
  }
  cout << P.first+P.second << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
	int a,b,c,tmp;
	scanf("%d %d %d",&a,&b,&c);
	if(a>b){
		tmp=a;
		a=b;
		b=tmp;
	}
	if(b>c){
		tmp=b;
		b=c;
		c=tmp;
	}
	if(a>b){
		tmp=a;
		a=b;
		b=tmp;
	}
	printf("%d %d %d\n",a,b,c);
	return 0;
}

Measured memory_bytes: 596
#include <stdio.h>
#include <stdlib.h>
int main(void){
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(abs(a-b)<=d && abs(b-c)<=d || abs(a-c)<=d) printf("Yes");
    else printf("No");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include <string>
#define ll long long
#define ull unsigned long long
#define make(type,x) type x; cin>>x
#define make2(type,x,y) type x,y; cin>>x>>y
#define fr(x,y) for(long long x=0;x<y;x++)
#define makevec(x,y,n) vector <x> y(n); for(ll i=0;i<n;i++) cin>>y[i]
#define M (ll)1000000007
#define MM (ll) 1e8
#define INF (ll) 1e18
# define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)

using namespace std;

template <typename T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
bool sortbysec(const pair <ll,ll> &a,const pair <ll,ll> &b){
    return a.second<b.second;
}

struct cmp {
	bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
		int lena = a.second - a.first + 1;
		int lenb = b.second - b.first + 1;
		if (lena == lenb) return a.first < b.first;
		return lena > lenb;
	}
};

ll calcpow(ll x, ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = calcpow(x, y / 2);
    if (y % 2 == 0)
        return temp * temp;
    else
    {
        if(y > 0)
            return x * temp * temp;
        else
            return (temp * temp) / x;
    }
}
ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b,a%b);

}
ll egcd(ll a, ll b, ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1;
    ll y1;
    ll g=egcd(b,a%b,x1,y1);
    x=y1;
    y=x1-y1*(a/b);
    return g;
}


bool isprime(ll a){
bool flag=1;
for(ll i=2;i*i<=a;i++){
    if(a%i==0) {flag=0; break;}
}
return flag;
}



int main(){
    IOS;
    make2(ll,x,y);
    if(4*x-y>=0 && (4*x-y)%2==0 && (4*x-y)/2<=x) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;


    return 0;
}


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

using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    map<int, int> m;
    for (int x = 1; x <= 100; x++) {
        for (int y = 1; y <= 100; y++) {
            for (int z = 1; z <= 100; z++) {
                int a = x * x + y * y + z * z + x * y + y * z + z * x;
                if (a <= n) {
                    m[a]++;
                }
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        cout << m[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 4020
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int N, A, B, C, D;
	char S[200001] = {};
	scanf("%d %d %d %d %d", &N, &A, &B, &C, &D);
	scanf("%s", &(S[1]));

	int a = A, b = B, flag = 1;
	if (C < D) {
		while (b < D) {
			if (S[b+1] == '.') b++;
			else if (b < D - 1 && S[b+2] == '.') b += 2;
			else break;
		}
		if (b < D) flag = 0;
		while (a < C) {
			if (S[a+1] == '.') a++;
			else if (a < C - 1 && S[a+2] == '.') a += 2;
			else break;
		}
		if (a < C) flag = 0;
	} else {
		while (b < D) {
			if (S[b-1] == '.' && S[b+1] == '.') break;
			else if (S[b+1] == '.') b++;
			else if (b < D - 1 && S[b+2] == '.') b += 2;
			else break;
		}
		if (b < D && (S[b-1] == '#' || S[b+1] == '#')) flag = 0;
		if (b == D) S[b] = '#';
		while (a < C) {
			if (S[a+1] == '.') a++;
			else if (a < C - 1 && S[a+2] == '.') a += 2;
			else break;
		}
		if (a < C) flag = 0;
	}
	
	if (flag == 1) printf("Yes\n");
	else printf("No\n");
	fflush(stdout);
	return 0;
}

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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

class UnionFind {
    using i64 = std::int64_t;

private:
    std::vector<i64> par;
    std::vector<i64> sz;

public:
    UnionFind(i64 N) : par(N), sz(N, 1) {
        for (i64 i = 0; i < N; ++i) par[i] = i;
    }
    i64 root(i64 x) {
        return par[x] == x ? x : par[x] = root(par[x]);
    }
    bool same(i64 x, i64 y) {
        return root(x) == root(y);
    }
    void unite(i64 x, i64 y) {
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (sz[x] < sz[y]) std::swap(x, y);
        par[y] = x;
        sz[x] += sz[y];
    }
    i64 size(i64 x) {
        return sz[root(x)];
    }
    void reset(i64 N) {
        par.resize(N);
        for (i64 i = 0; i < N; ++i) par[i] = i;
        sz.assign(N, 1);
    }
};

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

    ll N, M, K;
    cin >> N >> M >> K;
    UnionFind uf(20010);

    uf.unite(2, 101);
    uf.unite(3030, 1278);

    uf.reset(N);
    Vl indeg(N);
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        uf.unite(a, b);
        ++indeg[a], ++indeg[b];
    }
    vector<Vl> blocks(N);
    for (int i = 0; i < K; i++) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        blocks[a].push_back(b);
        blocks[b].push_back(a);
    }
    Vl ans(N);
    for (int i = 0; i < N; i++) {
        ans[i] = uf.size(i) - 1 - indeg[i];
        for (const auto& b : blocks[i]) {
            if (uf.same(i, b)) --ans[i];
        }
    }
    for (int i = 0; i < N - 1; i++) {
        cout << ans[i] << " ";
    }
    cout << ans[N - 1] << endl;

    return 0;
}


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

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

    int n;
    cin >> n;

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

    return 0;
}

Measured memory_bytes: 256
using System;
class Program{
    static void Main(string[]args){
        int N=int.Parse(Console.ReadLine());
        if(N<=111){
            Console.WriteLine(111);
        }else if(N<=222){
            Console.WriteLine(222);
        }else if(N<=333){
            Console.WriteLine(333);
        }else if(N<=444){
            Console.WriteLine(444);
        }else if(N<=555){
            Console.WriteLine(555);
        }else if(N<=666){
            Console.WriteLine(666);
        }else if(N<=777){
            Console.WriteLine(777);
        }else if(N<=888){
            Console.WriteLine(888);
        }else{
            Console.WriteLine(999);
        }

    }
}

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

int main(){
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;
  if (x + r <= W && x - r >= 0 &&
      y + r <= H && y - r >= 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    return Parent[a] = root(Parent[a]);
  }

  bool issame(int a, int b){
    return root(a) == root(b);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);

    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

int main(){
  ll a,b; cin >> a >> b;
  cout << a*b/gcd(a,b) << endl;
}

Measured memory_bytes: 256
// ~/SolverToBe/Developers/Corvus
// ~/sudo apt-get verdict Accpeted

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <memory.h>
#include <limits.h>
#include <math.h>
#include <string.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <functional>
#include <assert.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int N = 105, M = 1000005;
const ll MOD = 1e9 + 7;
const double eps = 1e-9;

int n,W,w[N],v[N], H;
ll dp[N][100005];

ll calc(int i,int j) {
    if(j>H)
        return 0;
    if(i==n)
        return (j==H ? 0 : 1e18);
    ll &r = dp[i][j];
    if(r!=-1)
        return r;
    r = calc(i+1,j);
    r = min(r, calc(i+1,j+v[i]) + w[i]);
    return r;
}

int main() {
    scanf("%d%d",&n,&W);
    for(int i=0; i<n; i++)
        scanf("%d%d",w+i,v+i);
    int l=0, r=100005, m, best = 0;
    while(l<=r) {
        m = (l+r)/2;
        memset(dp,-1,sizeof dp);
        H = m;
        if(calc(0,0) <= W) {
            best = m;
            l = m+1;
        } else r = m-1;
    }
    printf("%d\n", best);
    return 0;
}

Measured memory_bytes: 82304
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(aa) (aa).begin(), (aa).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define PI (acos(-1))
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
typedef pair<pill,int> PA;
//ll MOD;
ll MOD = 1000000007;
// ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	ll weight;
};
int N,K;
ll S;

int main(){
	cin>>N>>K>>S;
	if(S==1||S==2){
		rep(i,K)cout<<S<<" ";
		rep(i,N-K)cout<<1000000000<<" ";
		cout<<endl;
	}else{
		rep(i,K)cout<<S<<" ";
		rep(i,N-K)cout<<S-1<<" ";
		cout<<endl;
	}
}


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

using namespace std;

const int N = 1e5 + 7;

int n, a[N], f[N];

int main()
{
    //freopen("A.inp","r",stdin);
    //freopen("A.out","w",stdout);

    cin >> n;

    for(int i = 1; i <= n; i++) cin >> a[i];
    f[1] = 0;
    f[2] = abs(a[2] - a[1]);

    for(int i = 3; i <= n; i++)
    {
        f[i] = min(f[i - 1] + abs(a[i] - a[i - 1]), f[i - 2] + abs(a[i] - a[i - 2]));
    }

    cout << f[n];
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int>v(n);
  vector<int>s(n+1);
  for(int i=0;i<n;i++){
    cin>>v[i];
  }
  for(int i=n-1;i>=0;i--){
    s[i]=s[i+1]+v[i];
  }
  long long int ans=0;
  for(int i=0;i<n;i++){
    ans+=v[i]*s[i+1];
  }
  cout<<ans;
  return 0;
}  

Measured memory_bytes: 256
import sys

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

W, H, N = rl()
x_left = 0
x_right = W
y_down = 0
y_up = H

for _ in range(N):
    x, y, a = rl()
    if a == 1:
        x_left = max(x_left, x)
    elif a == 2:
        x_right = min(x_right, x)
    elif a == 3:
        y_down = max(y_down, y)
    else:
        y_up = min(y_up, y)

if x_left < x_right and y_up > y_down:
    answer = (x_right - x_left) * (y_up - y_down)
else:
    answer = 0

print(answer)

Measured memory_bytes: 3064
import queue
N = int(input())
t = [[]for i in range(N)]
for _ in range(N-1):
  u,v,w = map(int,input().split())
  u,v,w = u-1,v-1,w%2
  t[u].append([v,w])
  t[v].append([u,w])
q = queue.Queue()
ans = [-1 for i in range(N)]
ans[0] = 0
q.put(0)
while not q.empty():
  v = q.get()
  for vuw in t[v]:
    u = vuw[0]
    w = vuw[1]
    if ans[u]!=-1:
      continue
    else:
      ans[u]=(ans[v]+w)%2
      q.put(u)
for a in ans:
  print(a)

Measured memory_bytes: 42792
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
typedef long long ll;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,n,a) for(int i=n;i>=a;i--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
#define lla(s) s.rbegin(),s.rend()
#define pcnt(b) __builtin_popcount(b)
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const ll INF = 1e18;

map<int,int> pf(int N){
    map<int,int> ret;
    for(int i=2;i*i<=N;i++){
        while(N%i==0){
            ret[i]++;
            N/=i;
        }
    }
    if(N!=1){ret[N]++;}
    return ret;
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    double n;
    cin>>n;
    int k = (int)ceil((-1+sqrt(1.0+8.0*n))/2);
    int m = k*(k+1)/2;
    vector<bool>b(m+1,1);
    int tmp = m;
    rrep(i,m,1){
        if(tmp-i>=n){
            tmp-=i;b[i]=0;
        }
    }
    rep(i,1,k+1){
        if(b[i]){
            cout<<i<<endl;
        }
    }
}

Measured memory_bytes: 1536
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0; i<int(n); ++i)
#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define maxn 201

int n, m, x, y, H, W;
int a[maxn][maxn];

void solve(){
	cin >> H >> W;
	cin >> n;
	int dir = 1;
	x = 0, y = 0;
	rep(i, n){
		cin >> m;
		rep(j, m){
			a[x][y] = i + 1;
			y += dir;
			if (y < 0 || y >= W){
				y -= dir;
				x++;
				dir = -dir;
			}
		}
	}
	rep(i, H){
		rep(j, W){
			cout << a[i][j];
			if (j < W - 1) cout << ' '; else cout << endl;
		}
	}
	
}

int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(0);
	solve();	
}

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


int main(){
	
	int a,b;
	int ans;
	cin >> a >> b;
	if (a==b){
		cout << a;
	}else if(a<=b){
		cout << a ;

	}else{
		ans = a - 1;
		cout << ans;
	}

	return 0;
}

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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair

typedef pair<int, int> ii;

const int mod = 1e9 + 7;

const int N = 1005;

int n, k;
long long a[N];

long long x;

vector<long long> edge;

bool check(long long x) {
    long long ok = 0;
    for(int i = 0; i < edge.size(); i++) {
        long long ans = (edge[i] & x);
        if(ans == x)
            ok++;
    }
    if(ok >= k) return 1;
    else return 0;
}

int main() {
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    for(int i = 1; i <= n; i++) {
        long long sum = 0;
        for(int j = i; j <= n; j++) {
            sum += a[j];
            edge.pb(sum);
        }
    }
    x = 0;
    for(int i = 60; i >= 0; i--) {
        long long y = (x | (1ll << i));
        if(check(y))
            x = y;
    }
    cout << x;
}



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

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(i, (v).size()) { cout << v[i]; if (i != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	n *= 2;
	vi v(n);
	REP(i, n)cin >> v[i];
	sort(ALL(v), greater<int>());
	int ans = 0;
	REP(i, n) {
		if (i % 2 == 1)ans+=v[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

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

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

// 75 = 3 * 5 * 5;

// p^74;
// p^14 * q^6;
// p^2 * q^24;
// p^2 * q^4 * r^4;

bool is_prime(int n) {
  for (int i = 2; i * i <= n; ++i) {
    if (n % i == 0) return false;
  }
  return true;
}

int main() {
  int n;
  cin >> n;
  vector<int> a;
  for (int i = 2; i < 100; ++i) {
    if (is_prime(i)) a.push_back(i);
  }
  vector<int> b;
  for (auto& p : a) {
    int cnt = 0;
    for (int m = n; m; m /= p) cnt += m / p;
    b.push_back(cnt);
  }
  int m = b.size();
  int ret = 0;
  for (int i = 0; i < m; ++i) {
    if (b[i] >= 74) ++ret;
  }
  for (int i = 0; i < m; ++i) {
    if (b[i] < 14) continue;
    for (int j = 0; j < m; ++j) {
      if (j != i && b[j] >= 4) ++ret;
    }
  }
  for (int i = 0; i < m; ++i) {
    if (b[i] < 2) continue;
    for (int j = 0; j < m; ++j) {
      if (j != i && b[j] >= 24) ++ret;
    }
  }
  for (int i = 0; i < m; ++i) {
    if (b[i] < 2) continue;
    for (int j = 0; j < m; ++j) {
      if (j == i || b[j] < 4) continue;
      for (int k = j + 1; k < m; ++k) {
        if (k != i && b[k] >= 4) {
          // trace(a[i], a[j], a[k], b[i], b[j], b[k]);
          ++ret;
        }
      }
    }
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256