akhauriyash/Code-Regression huggingface dataset:
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int n;
  cin >> n;

  vi v(n),c(n),a(n);
  rep(i,n) cin >> v[i];
  rep(i,n) cin >> c[i];

  rep(i,n) a[i] = v[i] - c[i];

  int sum = 0;

  rep(i,n)
  {
    if(a[i] > 0)
      sum += a[i];
  }

  cout << sum ;

  return 0;
}
// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353,M=(1<<18)+5;
int a[M],n,m,sum;
typedef long long ll;
int ksm(ll a,int b,int c=1){
	for(;b;b/=2,a=a*a%mod)
		if(b&1)c=c*a%mod;
	return c;
}
void fwt(int*f){
	for(int i=1;i<m;i<<=1)
		for(int j=0;j<m;j+=i<<1){
			int*f1=f+j,*f2=f+j+i;
			for(int k=0;k<i;++k){
				f1[k]+=f2[k]-mod;f1[k]+=f1[k]>>31&mod;
				f2[k]=f1[k]-f2[k]*2;f2[k]+=f2[k]>>31&mod;f2[k]+=f2[k]>>31&mod;
			}
		}
}
int main(){
#ifdef ONLINE_JUDGE
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#endif
	cin>>n;m=1<<n;
	for(int i=0;i<m;++i)cin>>a[i],sum+=a[i];
	sum=ksm(sum,mod-2);
	for(int i=0;i<m;++i)a[i]=(ll)a[i]*sum%mod;
	fwt(a);a[0]=0;
	for(int i=1;i<m;++i)a[i]=ksm((a[i]-1+mod)%mod,mod-2),a[0]=(a[0]-a[i]+mod)%mod;
	fwt(a);
	for(int i=0;i<m;++i)cout<<a[i]<<'\n';
	return 0;
}



Measured memory_bytes: 3840
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;



void solve()
{
    int a, b;
    scanf("%d%d", &a, &b);
    if (a >= 13) {
        printf("%d\n", b);
    }
    else if (a >= 6) {
        printf("%d\n", b / 2);
 
    }
    else {
        printf("0\n");
    }
    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <complex>
#include <string>
#include <sstream>
#include <cstdio>
#define EPS 1e-10
#define EQ(a,b) (abs(a - b) < EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()))

using namespace std;

typedef complex<double> P;

double dot (P a, P b) {
    return (a.real() * b.real() + a.imag() * b.imag());
}

P crossNormalVector (P a, P b, P p) {
    double t = dot(b-a, p-a) / (abs(b-a) * abs(b - a));
    return a + t * (b - a);
}

P rot (P x, P p, double ang) {
    ang = ang / 180.0 * M_PI;
    double p1 = p.real() - x.real();
    double p2 = p.imag() - x.imag();
    return P( p1 * cos(ang) - p2 * sin(ang) + x.real()
             , p1 * sin(ang) + p2 * cos(ang) + x.imag() );
}

int main ()
{
    string str;
    while (cin >> str) {
        double x1, y1, x2, y2, py, px;
        stringstream ss;
        for (int i = 0; i < str.size(); i++)
            if (str[i] == ',') str[i] = ' ';
        ss << str;
        ss >> x1 >> y1 >> x2 >> y2 >> px >> py;
        P a = P(x1, y1), b = P(x2, y2), p = P(px, py);
        P x = crossNormalVector (a, b, p);
        P res = rot (x, p, 180.0);
        printf("%.6f %.6f\n", res.real(),res.imag());
    }

    return 0;
}

Measured memory_bytes: 1280
<?php
$W = fgets(STDIN);
$W = strtolower(trim($W));

$count = 0;
while (false !== ($line = fgets(STDIN))) {
    $line = trim($line);
    if ('END_OF_TEXT' === $line) {
        break;
    }

    $words = preg_split('/\s+/', $line, -1, PREG_SPLIT_NO_EMPTY);
    $count += array_reduce($words, function ($carry, $item) use ($W) { return ($W === strtolower($item)) ? $carry+1 : $carry; }, 0);
}

echo "$count\n";

Measured memory_bytes: 6724
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

mia = sorted([i for i in a if i < 0], reverse=True)
pla = sorted([i for i in a if i >= 0])

cnt = 1
if len(pla) == 0 and k % 2 == 1:
    for i in mia[:k]:
        cnt = cnt * i % mod
    print(cnt)
    exit()

while k > 0:
    if k == 1 or len(mia) <= 1:
        if len(pla) == 0:
            cnt *= mia.pop()
        elif len(pla) > 0:
            cnt *= pla.pop()
        k -= 1
    elif len(pla) <= 1:
        cnt *= mia.pop() * mia.pop()
        k -= 2
    elif pla[-1] * pla[-2] > mia[-1] * mia[-2]:
        cnt *= pla.pop()
        k -= 1
    elif pla[-1] * pla[-2] <= mia[-1] * mia[-2]:
        cnt *= mia.pop() * mia.pop()
        k -= 2
    cnt %= mod
else:
    print(cnt)


Measured memory_bytes: 31532
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> P2;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
int U[100000], R[100000];
long long T[100000];
int find(int x) {
  if (U[x] == x) return x;
  return find(U[x]);
}
long long sum(int x) {
  if (U[x] == x) return T[x];
  return T[x] + sum(U[x]);
}
void unite(int x, int y) {
  x = find(x), y = find(y);
  if (x == y) return;
  if (R[x] < R[y]) swap(x, y);
  U[y] = x;
  R[x] += R[y];
  T[y] -= T[x];
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  rep(i, N) U[i] = i, R[i] = 1;
  vector<P2> edges;
  rep(i, N-1) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    edges.pb(P2(c, P(a, b)));
  }
  sort(all(edges), greater<P2>());
  for (P2 p : edges) {
    int w = p._1, u = p._2._1, v = p._2._2;
    T[find(v)] += 1LL*w*R[find(u)];
    T[find(u)] += 1LL*w*R[find(v)];
    unite(u, v);
  }
  rep(i, N) cout << sum(i) << "\n";
  return 0;
}


Measured memory_bytes: 4596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(unsigned long long x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
template<class T>bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n, k;
    cin >> n >> k;
    if(k == 0){
        cout << n*n << endl;
        return 0;
    }
    ll ans = 0;
    repr(i, k+1, n+1){
        ans += n/i*(i-k);
        dump(i, ans);
        if(n % i >= k){
        dump(i, ans);
            ans += n-(n/i*i+k)+1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int n,k;
    int a=1;
    scanf("%d",&n);
    scanf("%d",&k);
    for(int i=1;i<=n;i++){
        if(a*2<=a+k){
            a=a*2;
        }else{
            a=a+k;
        }
    }
    printf("%d\n",a);
}

Measured memory_bytes: 128
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
 
int gcd(int p,int q){
    if(p%q==0)return q;
    return gcd(q,p%q);
}
 
int main(){
    int K;
    int sum=0;
    int a=1;int b=1;int c=1;
    cin>>K;
    for(int i=0;i<K;i++){
        for(int j=0;j<K;j++){
            for(int k=0;k<K;k++){
        sum+=gcd(a+i,gcd(b+j,c+k));
            }
        }
    }
    cout<<sum;
return 0;
}

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

int main() {
  int fH,fW;
  int sH,sW;
  int fArea,sArea;
  
  cin >> fH >> fW >> sH >> sW;
  
  fArea = fH * fW;
  sArea = sH * sW;
  
  if(fArea >= sArea) cout << fArea;
  else cout << sArea;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
# n = int(input())

# 空白区切り2変数
from queue import Queue
from operator import mul
from functools import reduce
from queue import Queue
from operator import mul
from functools import reduce
from functools import lru_cache

input = sys.stdin.readline

# N個整数
# a, b, c = list(map(int, input().split()))

# 1整数
# n = int(input())

# 空白区切りリスト整数
# h = list(map(int, input().split()))

# 空白区切り文字列
# t, d = input().split()

# 文字列
s = list(input().rstrip())
l = len(s)
ans = [0] * l

# 今いる場所がRの子供についてどこに行くのか数える
##残り移動回数
guu = 0
ki = 0
for i in range(l):
    if s[i] == 'R':
        guu = guu + 1
        guu, ki = ki, guu
    else:
        ans[i - 1] = ans[i - 1] + ki
        ans[i] = ans[i] + guu
        guu = 0
        ki = 0

guu = 0
ki = 0
for i in list(reversed(range(l))):
    if s[i] == 'L':
        guu = guu + 1
        guu, ki = ki, guu
    else:
        ans[i + 1] = ans[i + 1] + ki
        ans[i] = ans[i] + guu
        guu = 0
        ki = 0

print(' '.join(map(str, ans)))


Measured memory_bytes: 12280
#include <bits/stdc++.h>
#define Phuong_ ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define mp make_pair

/// easy access -------------
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<ll,ll> pii;
///-------------------------

int gcd(int x,int y)
{
    while (x%y!=0)
    {
        int t=y;
        y=x%y;
        x=t;
    }
    return y;
}

int main()
{
    Phuong_; /// <3
    int sum =0;
    int k;
    cin >>k;
    for(int a=1; a<=k; ++a)
        for(int b=1; b<=k; ++b)
        for(int c=1; c<=k; ++c)
        sum += gcd(gcd(a,b),c);
    cout << sum;
    return 0;
}



Measured memory_bytes: 3652
n = int(input())
a_l = list(map(int,input().split()))
ia = list(enumerate(a_l))

x_dict = {}
y_dict = {}
for i, a in ia:
    x = i+a
    y = i-a
    if x in x_dict:
        x_dict[x] += 1
    else:
        x_dict[x] = 1
    if y in y_dict:
        y_dict[y] += 1
    else:
        y_dict[y] = 1

count = 0
for xkey in x_dict.keys():
    if xkey in y_dict:
        count += x_dict[xkey] * y_dict[xkey]

print(count)

Measured memory_bytes: 74052
#include <iostream>
#include <fstream>
#include <vector>
#define nmax 100001
#define md 1000000007
using namespace std;
ifstream fin("p.in");
ofstream fout("p.out");

int dp[nmax][2];
vector<long long>v[nmax];
int n;
bool viz[nmax];

void dfs(int nod)
{
    viz[nod]=1;
    dp[nod][0]=dp[nod][1]=1;

    for(int i=0; i<v[nod].size(); i++)
        {
            int son=v[nod][i];

            if(!viz[son])
                {
                    dfs(son);
                    dp[nod][1] = (1LL * dp[nod][1] * dp[son][0])%md;
                    dp[nod][0]=  (1LL * dp[nod][0] * ((dp[son][0]+dp[son][1])%md))%md;
                }
        }
}

int main()
{
    cin>>n;
    if(n==1) {cout<<2; return 0;}
    for(int i=1; i<=n-1; i++)
        {
            int x,y;
            cin>>x>>y;
            v[x].push_back(y);
            v[y].push_back(x);
        }

    /*for(int i=1; i<=n; i++)
        {
            for(int j=0; j<v[i].size(); j++)
                fout<<v[i][j]<<" ";
            fout<<endl;
        }*/
    dfs(1);

    cout<<(dp[1][0]+dp[1][1])%md;

    return 0;
}


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


int main(){

    int K;
    string S;
    cin >> K >> S;

    if(S.length()<=K){
        cout << S << endl;
    }else{
        for(int i=0;i<K;i++){
            cout << S[i];
        }
        cout << "..." << endl;
    }

    return 0;
}


Measured memory_bytes: 3628
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int> > Matrix;

int main(){
    int n;
    cin >> n;
    vector<double> v(n);
    rep(i, n) cin >> v[i];
    
    rep(i, n -1){
        sort(ALL(v));
        double x = (double)(v[0] + v[1]) / 2;
        v.push_back(x);
        v.erase(v.begin(), v.begin()+2);
    }

    sort(ALL(v));
    cout << fixed << setprecision(6) << v[0] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

s64 gcd(s64 x, s64 y)
{
    if (x < y) swap(x, y);
    if (y == 0) return x;

    return gcd(y, x % y);
}

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

    s64 N;
    cin >> N;

    vs64 X(N + 1);
    rep (i, N + 1)
    {
        cin >> X[i];
    }    

    sort(X.begin(), X.end());
    s64 ans = 0;
    rep (i, N)
    {
        ans = gcd(X[i + 1] - X[i], ans);
    }

    cout << ans << "\n";
    return 0;
}



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

using ll = long long;
#define MOD_BIG (ll)(1e9+7)

int main(void){
    ll h,w;
    cin >> h >> w;
    bool s[w][h];
    ll left[w][h];
    ll right[w][h];
    ll up[w][h];
    ll down[w][h];
    ll dist; //障害物からの距離

    for(ll j=0;j<h;j++){
        string ss;
        cin >> ss;

        dist = 0;
        for(ll i=0;i<w;i++){
            s[i][j] = (ss[i]=='#');
            if(s[i][j]){
                dist = 0;
            }else{
                dist++;
            }
            left[i][j] = dist;
        }
        dist = 0;
        for(ll i=w-1;i>=0;i--){
            if(s[i][j]){
                dist = 0;
            }else{
                dist++;
            }
            right[i][j] = dist;
        }
    }

    for(ll i=0;i<w;i++){
        dist = 0;
        for(ll j=0;j<h;j++){
            if(s[i][j]){
                dist = 0;
            }else{
                dist++;
            }
            up[i][j] = dist;
        }
        dist = 0;
        for(ll j=h-1;j>=0;j--){
            if(s[i][j]){
                dist = 0;
            }else{
                dist++;
            }
            down[i][j] = dist;
        }
    }
    
    // puts("up");
    // for(ll j=0;j<h;j++){
    //     for(ll i=0;i<w;i++){
    //         printf("%lld", up[i][j]);
    //     }
    //     puts("");
    // }


    ll ans = 0;
    for(ll i=0;i<w;i++){
        for(ll j=0;j<h;j++){
            if(s[i][j]){
                continue;
            }
            ans = max(ans, right[i][j]+left[i][j]+down[i][j]+up[i][j]-4+1);
            //printf("%lld %lld %lld\n",i,j,ans);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 129152
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        if(A + B >= C) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21972
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int a=0,b=0,wa=0,keta=0;
	while(cin >> a >>b){
		wa=a+b;
		keta=(int)log10(wa)+1;
		cout << keta << endl;
	}
	return 0;
}

		

Measured memory_bytes: 1204
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int    A = sc.nextInt();
    int    B = sc.nextInt();
    int    C = sc.nextInt();
    long   K = sc.nextLong();

    System.out.println( K % 2 == 0 ? A - B  : B - A  );


  }
}


Measured memory_bytes: 21588
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>;
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
 
 
 int main(){
  string s ,t ;
  cin >>s>>t ;
  ll k = s.size() ;
  ll len = t.size() ;
  map<char,vector<ll>> mp ;
  rep(i,k){
    char  a= s[i] ;
    mp[a].pb(i) ;
  }
  ll now=0 ;
  bool ok=0;
  

  rep(i,len){
    ll p= now%k ;
    auto& u= mp[t[i]] ;
    if(u.empty()){
      ok=1 ;
      break ;
    } 
    auto itr = lower_bound(u.begin(),u.end(),p) ;
    if(itr==u.end()){
      now= now-p+u[0]+k+1 ;
    }
    else{
      ll q= itr-u.begin() ;
    now = now-p+u[q]+1 ;
    }
    //cout<<now<<endl ;
  }
   if(ok) cout<<-1<<endl ;
   else cout<<now<<endl ;
  
   return 0 ;
 }



Measured memory_bytes: 4628
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

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

int gcd3(int a, int b, int c) {
	return gcd(gcd(a, b), c);
}

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

	int sum = 0;

	for (int a = 1; a <= K; a++) {
		for (int b = 1; b <= K; b++) {
			for (int c = 1; c <= K; c++) {
				sum += gcd3(a, b, c);
			}
		}
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 3556
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(a):
    return 1110-a

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    return int(line)

def main():
    n = readQuestion()
    answer = solve(n)
    print(answer)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {

		int n;
		List<Integer[]> list = new ArrayList<Integer[]>();


		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));

		while((n = Integer.parseInt(bufferedReader.readLine())) != 0){
			int sum = 0, max = 0, min = 500;
			for(int i = 0; i < n; i++){
				sum = 0;
				String[] valueStrings = bufferedReader.readLine().split(" ");
				for(String s : valueStrings) sum += Integer.parseInt(s);

				max = max < sum ? sum : max;
				min = sum < min ? sum : min;
			}
			list.add(new Integer[]{new Integer(max), new Integer(min)});
		}
		for(Integer[] integer : list) System.out.println(integer[0].intValue()+" "+ integer[1].intValue());

	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <queue>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<pair<int, int>> v;
    for(int i = 0; i < n; i++)
    {
        int a, b; cin >> a >> b;
        v.push_back(make_pair(a, b));
    }
    sort(v.begin(), v.end());
    int ans = 0;
    int cnt = 0;
    priority_queue<int, vector<int>, greater<int>> que;
    for(int i = 0; i < n; i++)
    {
        if(que.size() > 0 and v[i].first > que.top())
        {
            cnt--;
            que.pop();
        }
        que.push(v[i].second);
        cnt++;
        ans = max(cnt, ans);
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 4208
import sys
H, W, K = map(int, sys.stdin.readline().rstrip().split())
grid = [list(sys.stdin.readline().rstrip()) for _ in range(H)]

ans = [[-1] * W for _ in range(H)] 
color = 0
for h in range(H):
    flag = False
    color += 1
    for w in range(W):
        if grid[h][w] == "#":
            if not flag:
                flag = True
            else:
                color += 1
        ans[h][w] = color
    if not flag:
        for w in range(W):
            ans[h][w] = -1
        color -= 1

for w in range(W):
    idx = []
    color = -1
    for h in range(H):
        if ans[h][w] == -1:
            if color != -1:
                ans[h][w] = color
            else:
                idx.append(h)
        else:
            color = ans[h][w]
            if idx:
                for i in idx:
                    ans[i][w] = color
                idx = []

for a in ans:
    print(" ".join(map(str, a)))

Measured memory_bytes: 7924
#include"bits/stdc++.h"
#define ll long long
#define inf 1e9+5
using namespace  std;

int main(){

	ll n,w;
	cin>>n>>w;

	ll sacks[n+1][2];

	for(ll i=1;i<=n;i++){
		cin>>sacks[i][0]>>sacks[i][1];
	}
	ll sumv=0;
	for(ll i=1;i<=n;i++){
		sumv+=sacks[i][1];
	}

	vector<vector<ll>> dp(n+1);
	dp.assign(n+1,vector<ll>(sumv+1));

	for(ll i=0;i<=n;i++){
		for(ll j=0;j<=sumv;j++){
			dp[i][j]=inf;
		}
	}

	for(ll i=0;i<=n;i++){
		dp[i][0]=0;
	}


	for(ll i=1;i<=n;i++){
		for(ll j=1;j<=sumv;j++){
				if(j<sacks[i][1]){
					dp[i][j] = dp[i-1][j];
				}else{
					dp[i][j] = min(sacks[i][0]+dp[i-1][j-sacks[i][1]],dp[i-1][j]);
				}
			}
		}
	

	for(ll i=sumv;i>=0;i--){
		if(dp[n][i]<=w){
			cout<<i<<endl;
			break;
		}
	}
	return 0;
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

struct Data {
    vector<pll> x;
};

Data A[30];

int main() {
    ll N;
    cin >> N;
    REP(i, N) {
        ll a;
        cin >> a;
        REP(j, a) {
            ll x, y;
            cin >> x >> y;
            x--;
            A[i].x.push_back(pll(x, y));
        }
    }

    ll p = pow(2, N);
    ll max = 0;
    REP(n, p) {
        bool exist = true;
        REP(i, N) {
            if (((n >> i) & 1) == 0)
                continue;

            REP(j, A[i].x.size()) {
                pll t = A[i].x[j];
                if (((n >> t.first) & 1) != t.second) {
                    exist = false;
                    break;
                }
            }

            if (!exist)
                break;
        }

        if (!exist)
            continue;

        ll m = 0;
        REP(i, N) {
            m += ((n >> i) & 1);
        }
        max = std::max(max, m);
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 512
<?php
$arr = explode(' ', fgets(STDIN));

$a = (int) $arr[0];
$b = (int) $arr[1];
$c = (int) $arr[2];
$previous = $c;
for ($i = 1; $i <= 10; $i++) {
    $result = $a * $previous - $b;
    echo $result .PHP_EOL;
    $previous = $result;
}

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

using namespace std;
#define ll long long
#define inf 998244353

int main()
{
    string s;
    cin >> s;
    if(s[3]==s[2]&&s[4]==s[5])
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,n1,n2) for(int i=n1;i<n2;i++)
using namespace std;
typedef long long ll;
int psum(int n){
    int num = n;
    int rtn = 0;
    REP(i,6){
        rtn += num%10;
        num = num/10;
    }
    return rtn;
}

int main() {
    int n;
    int res = 100000;
    cin >> n;
    //vector<int> x(n);
    REP2(i,1,n/2+1){
        res = min(res,psum(i)+psum(n-i));
        if(psum(i)+psum(n-i)==1){
            cout << "i:" << i <<endl;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ld double
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define pll pair <ll,ll>
#define nl "\n"
string s,t;
ll dp[3050][3050];
ll fx(ll i, ll j)
{
	if(i == s.length() || j == t.length())
	{
		return dp[i][j]=0;
	}
	if(dp[i][j]!=-10	)
		return dp[i][j];
	if(s[i] == t[j])
	{
		return dp[i][j] = 1 + fx(i+1, j+1);
	}
	else
	{
		return dp[i][j] = max(fx(i+1, j), fx(i, j+1));
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin>>s>>t;
	ll i,j;
	for(i=0;i<s.length()+10;i++)
	{
		for(j=0;j<t.length()+10;j++)
		{
			dp[i][j]=-10;
		}
	}
	fx(0,0);
	i=0, j=0;
	string ans = "";
	while(i<s.length() && j<t.length())
	{
		if(s[i]==t[j])
			ans += s[i], i++, j++;
		else if(dp[i+1][j] == dp[i][j])
			i++;
		else 
			j++;
	}
	cout<<ans<<nl;
	return 0;
}

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

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

    int last = s.size() - 1;
    int cnt = 0;
    for(int i = 0; i < s.size()/2; i++){
        if(s.at(i) != s.at(last)){
            cnt++;
        }
        last -= 1;
    }
    cout << cnt << endl;
}

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

int main() {
    int N, M, P;
    while (cin >> N >> M >> P && (N || M || P)) {
        vector<int> X(N);
        for (int i=0; i<N; ++i) {
            cin >> X[i];
        }
        if (X[M-1] == 0) {
            cout << 0 << endl;
        } else {
            int ret = accumulate(X.begin(), X.end(), 0) * 100 * (1.0 - P / 100.0) / X[M-1] + 1e-9;
            cout << ret << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1196
#include<iostream>
#include<cstring>
using namespace std;
string s;
long dp[11][2][2];
main()
{
	long S;
	while(cin>>S,S)
	{
		long pre=0,ans=0;
		while(1)
		{
			s=to_string(S+=ans-pre);
			pre=ans;
			for(int i=0;i<=s.size();i++)for(int j=0;j<4;j++)dp[i][j/2][j%2]=0;
			dp[0][0][0]=1;
			for(int i=0;i<s.size();i++)
			{
				for(int j=0;j<2;j++)
				{
					for(int k=0;k<2;k++)
					{
						int lim=j?9:s[i]-'0';
						for(int l=0;l<=lim;l++)
						{
							dp[i+1][j||(l<lim)][k||(l==4||l==6)]+=dp[i][j][k];
						}
					}
				}
			}
			ans=dp[s.size()][0][1]+dp[s.size()][1][1];
			if(ans==pre)break;
		}
		cout<<S<<endl;
	}
}



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

int main() {
    double a, b, h, m;
    cin >> a >> b >> h >> m;

    double hang, mang;
    hang = h * 30 + m * 0.5;
    mang = m * 6;

    double ang = max(hang, mang) - min(hang, mang);
    ang = min(ang, 360 - ang);

    double ans = sqrt(a * a + b * b - 2 * a * b * cos(acos(-1) / 180.0 * ang));
    printf("%.15f\n", ans);

    return 0;
}

Measured memory_bytes: 4228
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define int long long int
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define F first
#define S second
#define all(a) a.begin(), a.end()
#define endl '\n'
#define boost                    \
    ios::sync_with_stdio(false); \
    cin.tie(0);                  \
    cout.tie(0);
#define mod 1000000007
#define inf 1e18
#define pf push_front
#define pob pop_back
#define pof pop_front
#define deb(x) cout << #x << " " << x << endl;
#define deb2(x, y) cout << #x << " " << x << " " << #y << " " << y << endl;
#define deb3(x, y, z) cout << #x << " " << x << " " << #y << " " << y << " " << #z << " " << z << endl;
#define file                          \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);

typedef pair<int, int> pi;
typedef pair<int, pair<int, int>> piii;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<vi> vvi;

int32_t main()
{
    // boost
    int t = 1;
    //cin>>t;
    while (t--)
    {
        int n;
        cin >> n;
        int a[n];
        for (int i = 0; i < n; i++)
        {
            cin >> a[i];
        }
        unordered_map<int, int> mp;
        int res = 0;
        for (int i = 0; i < n; i++)
        {
            mp[a[i]]++;
            res = __gcd(res, a[i]);
        }
        assert(res!=0);
        if (res > 1)
        {
            cout << "not coprime" << endl;
            continue;
        }
        int mx = *max_element(a, a + n);
        int flag = 0;
        for (int i = 2; i <=mx; i++)
        {
            int tot = 0;
            for (int j = i; j <=mx; j+=i)
            {
                tot += mp[j];
            }
            if (tot > 1)
            {
                cout << "setwise coprime" << endl;
                flag = 1;
                break;
            }
        }
        if (!flag)
        {
            cout << "pairwise coprime" << endl;
        }
    }
}

Measured memory_bytes: 50308
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
const int INF=INT_MAX;


int main(){
  ll x,y;cin>>x>>y;
  cout<<x+y/2<<endl;
  
}

Measured memory_bytes: 256
//
//  main.cpp
//  adsfdsgsg
//
//  Created by h3037175 on 2017/07/31.
//  Copyright ?? 2017??´ h3037175. All rights reserved.
//

#include <iostream>
#include <cstdio>
#include <math.h>
#include<algorithm>
#include <utility>
#define nan -100000
using namespace std;
int main() {
    int hscore=0,kscore=0,a,b,c,d,k[2],h[2];
    cin>>h[0]>>h[1];
    cin>>k[0]>>k[1];
    cin>>a>>b>>c>>d;
    kscore+=k[0]*a;
    if(k[0]>9){
        kscore+=(k[0]/10)*c;
    }
    kscore+=k[1]*b;
    if(k[1]>19){
        kscore+=(k[1]/20)*d;
    }
    hscore+=h[0]*a;
    if(h[0]>9){
        hscore+=(h[0]/10)*c;
    }
    hscore+=h[1]*b;
    if(h[1]>19){
        hscore+=(h[1]/20)*d;
    }
    if(kscore>hscore){
        cout<<"kenjiro"<<endl;
    }
    else if(kscore<hscore){
        cout<<"hiroshi"<<endl;
    }
    else {
        cout<<"even"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3124
#include "iostream"
using namespace std;
 
int main(){
  
 int a;
  int nl = 0;
  string s;
  
  cin >> a;
  cin >> s;
    
  if(a>=3200){
    cout << s;

  }
  else{
    cout <<"red";
  } 
  
  
  return 0;
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

int main() {
    int K;
    cin >> K;
    vector<ll> a;
    for (int i = 1; i <= 9; i++) a.push_back(i);

    while (true) {
        if (K <= a.size()) {
            cout << a[K - 1] << endl;
            return 0;
        }

        K -= a.size();
        vector<ll> old;
        swap(old, a);
        for (ll x : old) {
            for (int i = -1; i <= 1; i++) {
                int d = x % 10 + i;
                if (d < 0 || 9 < d) continue;
                ll nx = x * 10 + d;
                a.push_back(nx);
            }
        }
    }
}


Measured memory_bytes: 4692
while True:
	n,x = map(int,raw_input().split(" "))
	c = 0
	if n == 0 and x == 0:
		break
	for i in range(1,n-1):
		for j in range(i+1,n):
			for h in range(j+1,n+1):
				if i + j + h == x:
					c += 1
	print c 

Measured memory_bytes: 4212
local n = io.read("*n", "*l")
local a, b, c = {}, {}, {}
local str = io.read()
local i = 1
local tn = tonumber
for val in string.gmatch(str, "%d+") do
  a[i] = tn(val)
  i = i + 1
end
str = io.read()
i = 1
for val in string.gmatch(str, "%d+") do
  b[i] = tn(val)
  i = i + 1
end
str = io.read()
i = 1
for val in string.gmatch(str, "%d+") do
  c[i] = tn(val)
  i = i + 1
end
table.sort(a)
table.sort(b)
table.sort(c)
local ab, bc = {}, {}
local bpos, cpos = 1, 1
local alast, blast = n, n
for j = 1, n do
  local tgt = a[j]
  local found = false
  for k = bpos, n do
    if(tgt < b[k]) then
      ab[j], bpos, found = k, k, true
      break
    end
  end
  if(not found) then
    alast = j - 1
    break
  end
end
for j = 1, n do
  local tgt = b[j]
  local found = false
  for k = cpos, n do
    if(tgt < c[k]) then
      bc[j], cpos, found = (n - k + 1), k, true
      break
    end
  end
  if(not found) then
    blast = j - 1
    break
  end
end
for i = blast + 1, n do
  bc[i] = 0
end
for i = blast - 1, 1, -1 do
  bc[i] = bc[i] + bc[i + 1]
end
local sum = 0
for i = 1, alast do
  sum = sum + bc[ab[i]]
end
print(sum)


Measured memory_bytes: 25260
N, M = list(map(int, input().split()))

bridges = [0 for i in range(N)]
l = [0]*M

for i in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    l[i] = (a, b)

l = sorted(l, key=lambda x:x[1])

current_bridge = l[0]
ans = 1

for relations in l:

    if current_bridge[1] > relations[0]:
        continue

    ans += 1
    current_bridge = relations

print(ans)


Measured memory_bytes: 85684
/*
 * Click `Run` to execute the snippet below!
 */

import java.io.*;
import java.util.*;

/*
 * To execute Java, please define "static void main" on a class
 * named Solution.
 *
 * If you need more classes, simply define them inline.
 */

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    for(int i = 1; i<=N; i++){
      //N = 8
      //0 1 2 3 4 5 6 7
      //1 2 3 4 5 6 7 8
      String s = sc.next();
      if(s.equals("Y")){
        System.out.println("Four");
        System.exit(0);
      }
    }
    System.out.println("Three");
  }
}


Measured memory_bytes: 35700
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main(){
  int n;
  while(true){
    cin >> n;
    if(n == 0)
      break;

    vector<bool> hurui(2*n + 1, true);
    int root = sqrt(2*n) + 1;
    for(int i=2; i<=2*n; i++){
      if(hurui[i] == true){
        for(int j=2*i; j<=2*n; j+=i){
          hurui[j] = false;
        }
      }
    }
    
    int ans = 0;
    for(int i=1; i<=n; i++){
      if(hurui[n+i] == true){
        ans++;
      }
    }
    cout << ans << endl; 
  }
  
  return 0;
}

Measured memory_bytes: 3084
import java.util.*;

class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    String out = "";
    int n = scanner.nextInt();
    scanner.nextLine();
    List<String> a = new ArrayList<String>();
    for (int ii = 0; ii < n; ii++) {
      String line = scanner.nextLine();
      String[] works = line.split(" ");
      works[0] = "00" + works[0];
      works[0] = works[0].substring(works[0].length() - 2);
      works[1] = "000" + works[1];
      works[1] = works[1].substring(works[1].length() - 3);
      a.add(works[1] + " " + works[0]);
      Collections.sort(a);
      Collections.reverse(a);
    }
    List<String>aa = new ArrayList<String>();
    String[] tops = a.get(0).split(" ");
    for (String el : a) {
      String[] works = el.split(" ");
      if (!works[0].equals(tops[0])) {
        break;
      }
      aa.add(works[1] + " " + works[0]);
    }
    Collections.sort(aa);
    System.out.println(Integer.parseInt(aa.get(0).split(" ")[0]) + " " + Integer.parseInt(aa.get(0).split(" ")[1]));
  }
}

Measured memory_bytes: 17320
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)
function root(uf::Array{Int,1},x);s=x;while uf[s]>0;s=uf[s];end;s;end
function same(uf::Array{Int,1},x,y);root(uf,x)==root(uf,y)?true:false;end
function unite(uf::Array{Int,1},x,y);l=root(uf,x);r=root(uf,y);if l<r;uf[l]+=uf[r];uf[r]=l;elseif l>r;uf[r]+=uf[l];uf[l]=r;end;end

function main()
	n,m = readline() |> split |> parseMap
	uf = -ones(Int,n)
	for i in 1:m
		x,y,z = readline() |> split |> parseMap
		unite(uf,x,y)
	end
	k = 0
	for i in 1:n
		if uf[i]<0
			k += 1
		end
	end
	println(k)
end
main()


Measured memory_bytes: 169564
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

typedef long long int ll; 

ll mod=1e9+7;
ll power(ll a,ll b)
{
	if(b==0) return 1;
	else if(b%2==0)
	{
		return power(a*a,b/2);
	}
	else return (a*power(a*a,b/2));

}





int main()
{
	IOS
	
    	  int r,g,b,n;
  cin>>r>>g>>b>>n;
  int count=0;
  for(int i=0;i<=3000;++i)
  {
    for(int j=0;j<=3000;++j)
        {
          int temp=n-i*r-j*g;
          if(temp<0) continue;
          if(temp%b==0)
            count++;
        }
 }
        cout<<count<<endl;




}

Measured memory_bytes: 256
n,m,c=gets.chomp.split(' ').map(&:to_i)
b=gets.chomp.split(' ').map(&:to_i)
a=[]
n.times { a << gets.chomp.split(' ').map(&:to_i) }
count=0
a.each do |aa|
  count+=1 if aa.zip(b).map{|aa|aa[0]*aa[1]}.inject(:+)+c > 0
end
puts count

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

typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define endl "\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

ll const inf = 1e18;
ll const maxn = 1e6+5;
ll const mod = 1e9+7;

// code begins here

vector<ll> v[maxn], parent(maxn, 0);

void bfs(){
    queue<ll> q;
    q.push(1);
    
    while(!q.empty()){
        ll val = q.front();
        q.pop();
        
        for(auto u: v[val]){
            if(!parent[u]){
                parent[u] = val;
                q.push(u);
            }
        }
    }
}

int main(){
    fast;
    
    ll n,m,x,y;
    cin>>n>>m;
    
    for(ll i=0;i<m;i++){
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    
    bfs();

    for(ll i=2;i<=n;i++){
        if(!parent[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    
    cout<<"Yes"<<endl;
    
    for(ll i=2;i<=n;i++)
        cout<<parent[i]<<endl;
    
    return 0;
}

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

int main() {
  string s;
  cin >> s;
  int w=0;
  for(int i=0;i<s.size();i++) {
    if(s[i]=='o') {
      w++;
    }
  }
  if(15-s.size()+w>7) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

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

struct P
{
    int x,y;

    bool operator<(const P &a)const{

        if(y!=a.y) return y>a.y;
        return x>a.x;
    }

};

vector<int> v;

//bitset<4001000> b;
int i,n,d,m,k,a,b,c;

int o[11];
int l[11];
int j[1];
int e;

//int dx[10]={2,2,-2,-2,1,1,-1,-1},dy[10]={1,-1,1,-1,2,-2,2,-2};

int dx[10]={0,1,0,-1,1,1,-1,-1},dy[10]={1,0,-1,0,1,-1,1,-1},dz[10]={0,0,0,0,1,-1};
long long mod=1000000009,mod2=1000000009,mod3=2017;
long long x,z,y;
double pi=3.14159265;
P u[1];
//stack<int> s;
//set<int> se;
//priority_queue<int> q;
//queue<int> q;
string r,r1;
//char r[1];
//2147483647
//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
//map<int,int> p;
/*
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
unordered_map<long long, int, custom_hash> safe_map;
*/
//list<int> l;


//deque<int> de;
//srand((int)time(NULL));




bool as(P a,P b)
{
    return a.x<b.x;
}

int main()
{
    for(int t=1;t<=6;o[c]++,t++)
        scanf("%d",&c);
    for(int t=1;t<=4;t++)
        l[o[t]]++;
    if(l[1]==2&&l[2]==2) puts("YES");
    else puts("NO");
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pair<int, int> > vp;
typedef pair<int, int> pr;
typedef tuple<int, int, int> ti;

#define FOR(i, a, b) for (int i = (a), _b = (b); i < _b; i++)
#define FORD(i, b, a) for (int i = (b), _a = (a); i > _a; i--)
#define pb push_back
#define print(v) cout << v << '\n'
#define pr_vec(v)   for (auto i: v) cout << i << ' '
#define vin(v)  for (auto &i: v)    cin >> i

ld pi = 3.141592653589793238;
ll M = 1e9 + 7;

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

    return gcd(b % a, a);
}

bool is_prime(ll n) {
    if (n == 2) return true;
    if (n < 2) return false;
    if (n % 2 == 0) return false;

    for (int i = 3; i <= sqrt(n); i += 2) {
        if (n % i == 0) return false;
    }

    return true;
}

bool is_palindrome(string s) {
    return equal(s.rbegin(), s.rend(), s.begin());
}

void dfs(int s, vector<bool>& visited, vvi& graph) {
    if (visited[s]) return;
    visited[s] = true;
    print(s);

    for (auto i: graph[s])  dfs(i, visited, graph);
}

vi bfs(int x, vector<bool>& visited, vvi& graph) {
    vi distance(visited.size(), 0);
    queue<int> q;
    visited[x] = true;
    q.push(x);

    while (!q.empty()) {
        int s = q.front();
        q.pop();

        for (auto u: graph[s]) {
            if (visited[u]) continue;
            visited[u] = true;
            distance[u] = distance[s] + 1;
            q.push(u);
        }
    }

    return distance;
}

void add_un_edge(vvi& graph, int a, int b) {
    graph[a].pb(b);
    graph[b].pb(a);
}

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

    ll t, n, m, k, q, x, y;
    string s;
    bool flag;

	ll MOD = 998244353;

    cin >> n >> m;
	vll a(n + 1);
	FOR (i, 1, n + 1)	cin >> a[i];

	vvl dp(n + 1, vll(m + 1, 0));

	dp[0][0] = 1;

	FOR (i, 1, n + 1) {
		FOR (j, 0, m + 1) {
			dp[i][j] = 2ll * dp[i - 1][j];
			if (j >= a[i])	dp[i][j] += dp[i - 1][j - a[i]];
			dp[i][j] %= MOD;
		}
	}

	print(dp[n][m]);

    return 0;
}

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


#include <algorithm>
#include <cassert>
#include <vector>

namespace atcoder {

// Implement (union by size) + (path compression)
// Reference:
// Zvi Galil and Giuseppe F. Italiano,
// Data structures and algorithms for disjoint set union problems
struct dsu {
  public:
    dsu() : _n(0) {}
    dsu(int n) : _n(n), parent_or_size(n, -1) {}

    int merge(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        int x = leader(a), y = leader(b);
        if (x == y) return x;
        if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
        parent_or_size[x] += parent_or_size[y];
        parent_or_size[y] = x;
        return x;
    }

    bool same(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        return leader(a) == leader(b);
    }

    int leader(int a) {
        assert(0 <= a && a < _n);
        if (parent_or_size[a] < 0) return a;
        return parent_or_size[a] = leader(parent_or_size[a]);
    }

    int size(int a) {
        assert(0 <= a && a < _n);
        return -parent_or_size[leader(a)];
    }

    std::vector<std::vector<int>> groups() {
        std::vector<int> leader_buf(_n), group_size(_n);
        for (int i = 0; i < _n; i++) {
            leader_buf[i] = leader(i);
            group_size[leader_buf[i]]++;
        }
        std::vector<std::vector<int>> result(_n);
        for (int i = 0; i < _n; i++) {
            result[i].reserve(group_size[i]);
        }
        for (int i = 0; i < _n; i++) {
            result[leader_buf[i]].push_back(i);
        }
        result.erase(
            std::remove_if(result.begin(), result.end(),
                           [&](const std::vector<int>& v) { return v.empty(); }),
            result.end());
        return result;
    }

  private:
    int _n;
    // root node: -1 * component size
    // otherwise: parent
    std::vector<int> parent_or_size;
};

}  // namespace atcoder

using namespace atcoder;

int main() {
  int n, q;
  cin >> n >> q;
  dsu d(n);
  while (q--) {
    int t, u, v;
    cin >> t >> u >> v;
    if (t == 0) {
      d.merge(u, v);
    } else {
      cout << (int)d.same(u, v) << endl;
    }
  }
}

Measured memory_bytes: 3988
#include <iostream>

int main(){
  char c[3];

  std::cin >> c[0] >> c[1] >> c[2];

  if(c[0] == '7' || c[1] == '7' || c[2] == '7'){
    std::cout << "Yes" << std::endl;
    return 0;
  }

  std::cout << "No" << std::endl;

  return 0;
}


Measured memory_bytes: 3672
a,b,k=map(int,input().split())
for i in range(1,k+1):
    if (i % 2) == 1:
        if (a % 2) == 1:
            a -= 1
            a /= 2
            b += a
        else:
            a /= 2
            b += a
    else:
        if (b % 2) == 1:
            b -= 1
            b /= 2
            a += b
        else:
            b /= 2
            a += b
print(str(int(a))+" "+str(int(b)))


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

int main()
{
    int n, k;
    cin >> n >> k;
    vector<double> p(n);
    rep(i, n) cin >> p[i];
    double kitai = 0;
    for (int i = 0; i < k; i++) {
        kitai += (p[i] + 1.0) / 2.0; 
    }
    double ans = kitai;
    for (int i = 1; i <= n - k; i++) {
        kitai -= (p[i-1] + 1.0) / 2.0;
        kitai += (p[i+k-1] + 1.0) / 2.0;
        ans = max(ans, kitai);
    }
    printf("%.12f\n", ans);

    return 0;
}

Measured memory_bytes: 4784