akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <queue>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

#define ll long long

int main(){
    
    int n;
    cin >> n;
    int cnt = 0;
    int building[12][10] = {{0}};

    int b, f, r, v;
    int left, right = 0;
    for(int i=0; i<n; i++){
        cin >> b >> f >> r >> v;
        left = (b-1)*3 + f-1;
        right = r-1;
        building[left][right] += v;
    }

    for(int i=0; i<12; i++){
        for(int j=0; j<10; j++){
            cout <<" " <<  building[i][j];
        }
        cout << endl;
        if( (i%3 == 2) && (cnt<3)){
            cout << "####################" << endl;
            cnt++;
        }
    }
    return 0;
}

Measured memory_bytes: 3076
import java.util.Scanner;
public class Main {
	static Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) {
		//try(Scanner sc = new Scanner(System.in)) {
			int t = sc.nextInt();
			double max = 0;
			for(int i=0; i<t; ++i) {
				max = Math.max(max, cal());
			}
			System.out.println(max > cal()+0.0000001 ? "YES":"NO");
		//}
	}
	
	static double cal() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		double hope = 0;
		double rr = 0;
		for(int i=0; i<m; ++i) {
			int v = sc.nextInt();
			double r = sc.nextDouble();
			hope += v*r;
			rr += r;
		}
		return hope/rr;
		
	}
}






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

class Program {
    fun solve() {
        val sc = MyScanner()
        val n = sc.nextInt()
        if (n == 1) {
            println(1)
            return
        }

        val prime = mutableListOf<Int>()
        val cnt = mutableListOf<Int>()
        prime.add(2)
        cnt.add(0)
        for (i in 2..n) {
            var t = i
            for (j in prime.indices) {
                while (t % prime[j] == 0) {
                    t /= prime[j]
                    cnt[j]++
                }
            }
            if (t != 1) {
                prime.add(t)
                cnt.add(1)
            }
        }

        var ans = ModInt(1)
        cnt.forEach {
            ans *= (it + 1)
        }

        println(ans)
    }
}

class ModInt(_num: Number) : Number() {
    companion object {
        const val mod: Long = 1000000007L
    }

    private val num: Long = if (_num.toLong() < 0) (_num.toLong() % mod) + mod else _num.toLong() % mod
    operator fun plus(right: Number) = ModInt(num + (right.toLong() % mod))
    operator fun minus(right: Number) = ModInt(num - (right.toLong() % mod))
    operator fun times(right: Number) = ModInt(num * (right.toLong() % mod))

    // modが素数の時のみ
    operator fun div(right: Number) = this * ModInt(right).inverse()

    fun power(n: Number): ModInt {
        var a = this
        var result = ModInt(1)
        var tmp = n.toLong()
        while (tmp > 0) {
            if (tmp % 2 == 1L) {
                result *= a
            }
            tmp /= 2
            a *= a
        }
        return result
    }

    // modが素数のときのみ 逆元
    fun inverse(): ModInt {
        return power(mod - 2L)
    }

    override fun toString() = num.toString()
    override fun toInt() = num.toInt()
    override fun toLong() = num
    override fun toByte() = num.toByte()
    override fun toChar() = num.toChar()
    override fun toDouble() = num.toDouble()
    override fun toFloat() = num.toFloat()
    override fun toShort() = num.toShort()
}

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

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

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

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

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

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


Measured memory_bytes: 36988
#include<cstdio>
const int N=2005;
int n,he[N],to[N*2],nx[N*2],s[N],f[N],g[N],ans=1e9;char c[N];
inline void wk(int w,int x,int y)
{to[w]=y,nx[w]=he[x],he[x]=w;}
inline int mn(int x,int y){return x<y?x:y;}
void dfs(int x,int fa)
{
	s[x]=c[x]&1,g[x]=0;int a=0;
	for(int i=he[x],y;i;i=nx[i])if((y=to[i])!=fa)
		dfs(y,x),s[x]+=s[y],g[y]+=s[y],f[y]+=s[y],g[x]+=g[y],g[y]>g[a]&&(a=y);
	if(f[a]<=g[x]-g[a])f[x]=g[x]&1;else f[x]=f[a]-(g[x]-g[a]);
}
int main()
{
	scanf("%d%s",&n,c+1);
	for(int i=1,x,y;i<n;++i)
		scanf("%d%d",&x,&y),wk(i*2,x,y),wk(i*2+1,y,x);
	for(int i=1;i<=n;++i)
		dfs(i,0),!f[i]&&(ans=mn(ans,g[i]>>1));
	return printf("%d",ans==1e9?-1:ans),0;
}

Measured memory_bytes: 1892
#include<cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<queue>
#define MAX_N 262144
#define INF 1000000000000000
typedef long long ll;
using namespace std;

int used[MAX_N];
ll n,d,a[MAX_N],ans=0,two[20];
pair<ll,ll> p[MAX_N],t[2*MAX_N][2];
vector<pair<ll,ll> > g[MAX_N];
void init(){
    for(ll i=0;i<2*MAX_N;i++){
        t[i][0]=t[i][1]=make_pair(INF,i);
    }
    two[0]=1;
    for(int i=1;i<20;i++){
        two[i]=two[i-1]*2;
    }
}
void change(ll i){
    ll y=p[i].second+MAX_N;
    t[y][0].first=d*(y-MAX_N)+p[i].first;
    t[y][1].first=d*(n-1-y+MAX_N)+p[i].first;
    y/=2;
    while(y>0){
        t[y][0]=min(t[2*y][0],t[2*y+1][0]);
        t[y][1]=min(t[2*y][1],t[2*y+1][1]);
        y/=2;
    }
}
pair<ll,ll> smq(ll l,ll r,int y){
    ll cnt=1,x=l;
    if(l==r){
        return t[l][y];
    }
    while(x>0){
        if(x/2*two[cnt]==l&&(x/2+1LL)*two[cnt]-(1LL)==r){
            return t[x/2][y];
        }
        else if(x/2*two[cnt]<l||(x/2+1LL)*two[cnt]-(1LL)>r){
            return min(t[x][y],smq((x+1LL)*two[cnt-1],r,y));
        }
        x/=2;
        cnt++;
    }
    return t[x][y];
}
int main(){
    pair<ll,ll> x;
    priority_queue<pair<ll,ll> ,vector<pair<ll,ll>>, greater<pair<ll,ll>>> q;
    scanf("%lld %lld",&n,&d);
    for(ll i=0;i<n;i++){
        scanf("%lld",&a[i]);
        p[i]=make_pair(a[i],i);
    }
    init();
    sort(p,p+n);
    change(0);
    for(ll i=1;i<n;i++){
        x=smq(p[i].second+MAX_N,n-1+MAX_N,0);
        if(x.first<INF){
            g[p[i].second].push_back(make_pair(x.first-d*p[i].second+p[i].first,x.second-MAX_N));
            g[x.second-MAX_N].push_back(make_pair(x.first-d*p[i].second+p[i].first,p[i].second));
        }
        x=smq(MAX_N,p[i].second+MAX_N,1);
        if(x.first<INF){
            g[p[i].second].push_back(make_pair(x.first-d*(n-1-p[i].second)+p[i].first,x.second-MAX_N));
            g[x.second-MAX_N].push_back(make_pair(x.first-d*(n-1-p[i].second)+p[i].first,p[i].second));
        }
        change(i);
    }
    used[p[n-1].second]=1;
    for(int i=0;i<g[p[n-1].second].size();i++){
        q.push(g[p[n-1].second][i]);
    }
    while(!q.empty()){
        x=q.top();
        q.pop();
        if(used[x.second]==0){
            ans+=x.first;
            for(int i=0;i<g[x.second].size();i++){
                q.push(g[x.second][i]);
            }
            used[x.second]=1;
        }
    }
    printf("%lld\n",ans);
}

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

int main() {
  long long k, a, b;
  cin >> k >> a >> b;
  long long result = 0;
  if (a + 1 >= b || k <= a) {
    result = k + 1;
  } else {
    result += a;
    k -= a - 1;
    result += ((b - a) * (k / 2));
    result += (k + 0) % 2;
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define FAST                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define all(v) v.begin(), v.end()
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define um unordered_multiset
#define us unordered_set
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define cc continue
#define bb break
#define rem 1000000007
#define debug(n1) cout << "debug... " << n1 << "\n"
//fflush(stdin);
// do {
// // process permutation
// } while (next_permutation(permutation.begin(),permutation.end()));
ll train(ve<ll> A, ve<ll> F, ll n, ll k, ll x, ll &c)
{
    ll ans = 0;
    rep(i, 0, n)
    {
        ll b = A[i];
        A[i] = min(A[i], x / F[i]);
        ans += b - A[i];
        c=max(c,A[i]*F[i]);
    }
    return ans;
}
int main()
{
    FAST
        // freopen("input1.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
        /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
        ll n,
        k;
    cin >> n >> k;
    ve<ll> A(n), F(n);
    rep(i, 0, n)
    {
        cin >> A[i];
    }
    rep(i, 0, n)
    {
        cin >> F[i];
    }
    sort(all(A));
    sort(all(F));
    reverse(all(A));
    ll start = 0;
    ll end = 0;
    rep(i, 0, n)
    {
        end = max(end, A[i] * F[i]);
    }
    ll mid = 0;
    ll c=0;
    while (start < end)
    {
        mid = (start + end) / 2;
        ll sum = train(A, F, n, k, mid,c);
        if (k>=sum)
        {
            end=mid;
        }
        else
        {
            start=mid+1;
        }
    }
    c=0;
    train(A, F, n, k, start,c);
    cout<<c<<"\n";
}


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

int main() {

  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  int dx = tx - sx;
  int dy = ty - sy;

  for (int i = 0; i < dy; i++) {
    cout << "U";
  }

  for (int i = 0; i < dx; i++) {
    cout << "R";
  }

  for (int i = 0; i < dy; i++) {
    cout << "D";
  }

  for (int i = 0; i < dx; i++) {
    cout << "L";
  }

  cout << "L";

  for (int i = 0; i < dy + 1; i++) {
    cout << "U";
  }

  for (int i = 0; i < dx + 1; i++) {
    cout << "R";
  }

  cout << "D";

  cout << "R";

  for (int i = 0; i < dy + 1; i++) {
    cout << "D";
  }

  for (int i = 0; i < dx + 1; i++) {
    cout << "L";
  }

  cout << "U" << endl;
  

  return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VL = vector<LL>;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define FILL(a, b) memset(a, b, sizeof(a))

void dout() { cerr << endl; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin >> s;
    if (s.back() == 's')
        s += "es";
    else
        s += 's';
    cout << s;
    return 0;
}

Measured memory_bytes: 3672
#include<stdio.h>
#include<limits.h>
#include<algorithm>
int memo[100][100];
int t[100],b[100];
int n;
int F(int l,int r)
{
	if(memo[l][r])return memo[l][r];
	if(l==r)return 0;
	int a=INT_MAX,i;
	for(i=l;i+1<=r;++i)a=std::min(a,t[l]*b[i]*t[i+1]*b[r]+F(l,i)+F(i+1,r));
	return memo[l][r]=a;
}
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;++i)scanf("%d%d",&t[i],&b[i]);
	printf("%d\n",F(0,n-1));
	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <stack>
#include <vector>
#include <climits>
#include <map>
#include <math.h>
using namespace std;

int main(void)
{
    string ABCD;

    cin >> ABCD;
    int A = ABCD[0] - '0';
    int B = ABCD[1] - '0';
    int C = ABCD[2] - '0';
    int D = ABCD[3] - '0';

    if (A + B + C + D == 7)
    {
        cout << A << '+' << B << '+' << C << '+' << D << '=' << 7 << endl;
    }
    else if (A - B + C + D == 7)
    {
        cout << A << '-' << B << '+' << C << '+' << D << '=' << 7 << endl;
    }
    else if (A + B - C + D == 7)
    {
        cout << A << '+' << B << '-' << C << '+' << D << '=' << 7 << endl;
    }
    else if (A + B + C - D == 7)
    {
        cout << A << '+' << B << '+' << C << '-' << D << '=' << 7 << endl;
    }
    else if (A - B - C + D == 7)
    {
        cout << A << '-' << B << '-' << C << '+' << D << '=' << 7 << endl;
    }
    else if (A - B + C - D == 7)
    {
        cout << A << '-' << B << '+' << C << '-' << D << '=' << 7 << endl;
    }
    else if (A + B - C - D == 7)
    {
        cout << A << '+' << B << '-' << C << '-' << D << '=' << 7 << endl;
    }
    else if (A - B - C - D == 7)
    {
        cout << A << '-' << B << '-' << C << '-' << D << '=' << 7 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <algorithm>
#include <set>
using namespace std;

struct Map {
public:
    int i, j;
    int distance;
    
    Map(int i, int j, int distance) : i(i), j(j), distance(distance) {}

};

int main() {

    int h, w;
    char mapData[30][30];
    set<pair<int, int>> doneRoot;

    int firstI = 0;
    int firstJ = 0;

    cin >> h >> w;

    for(int i = 1; i <= h; ++i) {
        mapData[i][0] = '#';
        mapData[i][w + 1] = '#';
        for(int j = 1; j <= w; ++j) {

            cin >> mapData[i][j];

        }
    }

    for(int i = 0; i <= w + 1; ++i) {
        mapData[0][i] = '#';
        mapData[h + 1][i] = '#';
    }


    int maxDistance = 0;
    for(int a = 1; a <= h; a++) {

        for(int b = 1; b <= w; b++) {
            if(mapData[a][b] == '#')
                continue;

    
      queue<Map> que;
      que.push(Map(a, b, 0));
      doneRoot.emplace(make_pair(a, b));
      auto lastPos = que.front();

      while(!que.empty()) {

          auto nowPos = que.front();
          que.pop();

          int i = nowPos.i;
          int j = nowPos.j;
          int d = nowPos.distance;

          if(mapData[i - 1][j] != '#' && doneRoot.find(pair<int, int>(i - 1, j)) == doneRoot.end()) {
              que.push(Map(i - 1, j, d + 1));
              doneRoot.emplace(make_pair(i - 1, j));
          }

          if(mapData[i + 1][j] != '#' && doneRoot.find(pair<int ,int>(i + 1, j)) == doneRoot.end()) {
              que.push(Map(i + 1, j, d + 1));
              doneRoot.emplace(make_pair(i + 1, j));

          }

          if(mapData[i][j - 1] != '#' && doneRoot.find(pair<int ,int>(i, j - 1)) == doneRoot.end()) {
              que.push(Map(i, j - 1, d + 1));
              doneRoot.emplace(make_pair(i, j - 1));
          }

          if(mapData[i][j + 1] != '#' && doneRoot.find(pair<int ,int>(i, j + 1)) == doneRoot.end()) {
              que.push(Map(i, j + 1, d + 1));
              doneRoot.emplace(make_pair(i, j + 1));
          }


          // cout << i << " " << j << " " << d << endl;

          lastPos = nowPos;

      }

        doneRoot.clear();
        maxDistance = max(lastPos.distance, maxDistance);
        }
    }


    cout << maxDistance << endl;

    return 0;

}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int A[3][3],N,b[10],i,j,k,c[3][3]={0};
  
  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      scanf("%d",&A[i][j]);
    }
  }
  
  scanf("%d",&N);
  
  for(i=0;i<N;i++)
    scanf("%d",&b[i]);
  
  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      for(k=0;k<N;k++){
        if(A[i][j]==b[k]){
          c[i][j]=1;
        }
      }
    }
  }
  
  if(c[0][0]+c[1][1]+c[2][2]==3||c[0][2]+c[1][1]+c[2][0]==3){
    puts("Yes");
    return 0;
  }
    
  for(i=0;i<3;i++){
    if(c[i][0]+c[i][1]+c[i][2]==3||c[0][i]+c[1][i]+c[2][i]==3){
      puts("Yes");
      return 0;
    }
  }
  
  puts("No");
  return 0;
}

Measured memory_bytes: 1664
#include <stdio.h>

int main (){
	int A, B;
	scanf("%d %d", &A, &B);
	if(A == 1 && B == 2){
		printf ("3");
} else if (A == 1 && B == 3){
	printf("2");
}else if (A == 2 && B == 3){
	printf("1");
}else if (A == 2 && B == 1){
	printf("3");
}else if (A == 3 && B == 1){
	printf("2");
}else if (A == 3 && B == 2){
	printf("1");
}
	return 0;
}

Measured memory_bytes: 1640
def gcd (a,b):
    if b == 0:
        return a
    return gcd(b , a % b)

def lcm (a, b):
    return a * b // gcd(a, b)

from functools import reduce

n = int(input())
t=[]
for _ in range(n):
    t.append(int(input()))

print(reduce(lcm,t))

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

int main(){
	int N,K;//N=ボールの数、K=ロボットBのx座標、x=ボールのx座標
	int i;//ループ用
	cin>>N;
	int res_tmp[N],res=0;//答え
	cin>>K;
	int x[N];

	/*for(i=0;i<N;i++){
		res_tmp[i]=0;
	}*/

	for(i=0;i<N;i++){
		cin>>x[i];
	}
	for(i=0;i<N;i++){
		if(x[i]*2<(K-x[i])*2){
			res_tmp[i]=x[i]*2;
		}else{
			res_tmp[i]=(K-x[i])*2;
		}
		res+=res_tmp[i];
	}
	cout<<res<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,a,num;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a;
		if(a%2==0){
			while(a%2==0){
				a=a/2;
				num++;
			}
		}
	}
	cout<<num;
} 

Measured memory_bytes: 256
#これが一番できたやつ

import sys
N, A, B, C, D = map(int, input().split())
S = str(input())

if D > C:
    if '##' in S[B:D] or '##' in S[A:C]:
        print('No')
    else:
        print('Yes')
elif C > D:
    if '...' in S[B - 2: D + 1] and '##' not in S[A: C]:
        print('Yes')
    else:
        print('No')
        


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

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  int a, b;
  cin >> a >> b;

  // 解答
  cout << (a - 1) * (b - 1) << endl;
  return 0;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/12  Problem: ABC 085 D / Link: http://abc085.contest.atcoder.jp/tasks/abc085_d  ----- */


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

	LL N, H; cin >> N >> H;
	vector<LL> a(N), b(N);
	for (int i = 0; i < N; ++i) {
		cin >> a[i] >> b[i];
	}

	LL ans = 0LL;
	vector<PLL>x;
	FOR(i, 0, N) {
		x.push_back(PLL(a[i], 0));
		x.push_back(PLL(b[i], 1));
	}
	RSORT(x);
	for (auto it : x) {
		if (H <= 0)break;
		if (it.second) {
			H -= it.first;
			ans++;
		}
		else {
			LL k = (H - 1 + it.first) / it.first;
			ans += k;
			H -= k * it.first;
		}
	}
	
	
	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 7792
#include <string>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stdlib.h>
#include <algorithm>
#include <list>
#include <math.h>

using namespace std;

int main(void){
	int i,j,k;
	char s[13];
	scanf("%s" ,s);
	for(i=0;i<4;i++)	printf("%c" ,s[i]);
	printf(" ");
	for(i=i;i<12;i++)	printf("%c" ,s[i]);
	printf("\n");
	
	return 0;
}

Measured memory_bytes: 384
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ret = 0
bef = -1
for i in a:
  ret += b[i-1]
  if bef == i - 1:
    ret += c[bef - 1]
  bef = i
print(ret)

Measured memory_bytes: 3064
data = {
    'AC': 0,
    'WA': 0,
    'TLE': 0,
    'RE': 0,
}

n = int(input())
for i in range(n):
    s = input()
    data[s] += 1

for k, v in data.items():
    print(k + ' x ' + str(v))


Measured memory_bytes: 8992
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 

 class Main{
             
     
    static boolean[] notPrime=new boolean[51000];
    static int[] primes=new int[50000];
    static int primeNum=0;
    
    static void setP(){notPrime[0]=true;notPrime[1]=true;
        int count=0;
        for(int i=2;i<51000;i++){
            if(!notPrime[i]){primes[count]=i;count++;}
            for(int j=2;j*i<5100;j++){
                notPrime[i*j]=true;
            }
        }primeNum=count;
    }
    static boolean isPrime(int n){
        return !notPrime[n];
    }
     
     public static void main(String args[]){
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         
         try{
             String line;
             setP();
             while((line=br.readLine())!= null){if(line.isEmpty())break;
                String[] spl=line.split(" ");
                int a=Integer.parseInt(spl[0]);
                if(a==0)break;
                // System.out.println(a);
                int cnt=2;
                for(int i=2;i<=a;i++){
                    cnt+=1;
                    cnt+=i-1;
                }
                 System.out.println(cnt);
                
             }br.close();
             
         }catch(Exception e){e.printStackTrace();}         
     }
   
 }

Measured memory_bytes: 19312
n,t,e = map(int,input().split())
x = list(map(int,input().split()))

ans=-1
for i in range(n):
    for j in range(x[i],10000000,x[i]):
        if t-e<=j and j<=t+e:
            ans = i+1
            
        elif j > t+e:
            break
print(ans)


Measured memory_bytes: 5596
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main( ) {
    // freopen("A.01.in","r",stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    // scanf("%s",&s);
    cin >> s;
    map<char,int> m;
    rep(i, 0, 3){
        // cout << s[i];
        if(s[i]=='a' or s[i]=='b' or s[i]=='c'){
            m[s[i]]++;
        }
    }
    // trav(it, m){
    //     printf("%c",it.first);
    // }
    // (sz(m)==3)?printf("%s","Yes")printf("%s","No")
    if(sz(m)==3){
        printf("%s","Yes");
    }
    else
    {
        printf("%s","No");
    }
    
    return 0;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

string day[7] =  {"Sunny", "Cloudy", "Rainy"};

int main(){
    string S;
    cin >> S;
    if(S <= "2019/04/30"){
        cout << "Heisei" << endl;
    }else{
        cout << "TBD" << endl;
    }
}


Measured memory_bytes: 384
def deep(d,i,s)
  if d == $n
    $ans.push(s.join)
    return 
  end
  (0..i).each do |j|
    s.push($t[j])
    deep(d+1,[i,j+1].max,s)
    s.pop
  end
end
$ans = []
$t = "abcdefghijkllm".split("")
$n = gets.to_i
deep(0,0,[])
puts $ans.sort


Measured memory_bytes: 30000
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
using pis = pair<int, string>;
#define all(x) (x).begin(), (x).end()
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007ll

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(15)
  string s;
  cin >> s;
  cout << s << (s[s.size()-1] == 's' ? "es" : "s") << endl;

}


Measured memory_bytes: 3656
#include <stdio.h>

int main(void){
    int i,n;
    scanf("%d",&n);
    for(i = 1;i <= n;i++){
        if(i % 10 == 3||i % 100 / 10 == 3){
            printf(" %d",i);
        }else if(i % 1000 / 100 == 3||i % 10000 / 1000 == 3){
            printf(" %d",i);
        }else if(i % 3 == 0){
            printf(" %d",i);
        }
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 596
n, m = map(int, input().strip().split())
grid = []
for i in range(n):
    grid.append(input())
dp = [[None]*m for _ in range(n)]
dp[n-1][m-1] = 1
for i in range(n-2, -1, -1):
    if grid[i][m-1] == '.':
        dp[i][m-1] = dp[i+1][m-1]
    else:
        dp[i][m-1] = 0
for j in range(m-2, -1, -1):
    if grid[n-1][j] == '.':
        dp[n-1][j] = dp[n-1][j+1]
    else:
        dp[n-1][j] = 0
for i in range(n-2, -1, -1):
    for j in range(m-2, -1, -1):
        if grid[i][j] == '.':
            dp[i][j] = (dp[i+1][j] + dp[i][j+1])%(10**9 + 7)
        else:
            dp[i][j] = 0
print(dp[0][0])

Measured memory_bytes: 61916
n = int(input())

ansl = []
def dfs(s, max_s):
    if len(s) == n:
        ansl.append(s)
        return
    ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
    for i in range(max_s+1):
        dfs(s+ascii_lowercase[i], max(i+1, max_s))

dfs("", 0)
for a in ansl:
    print(a)

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

int main(void)
{
	map<int, int> m;
	char c;
	bool ok = true;
	while((c = getchar()) != '\n') m[c]++;
	for(auto it = m.begin(); it != m.end(); it++) {
		if(it->second != 2) ok = false;
	}
	cout << (ok ? "Yes" : "No") << endl;
	return 0;
}

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


int main()
{
  ll a, b;
  cin >> a >> b;
  ll a2 = a, b2 = b;
  ll ans = 1;
  ll d = 2;
  while (d * d <= a || d * d <= b)
  {
    if (a2 % d == 0 && b2 % d == 0)
      ans++;
    while (a2 % d == 0)
      a2 /= d;
    while (b2 % d == 0)
      b2 /= d;
    d++;
  }
  if (min(a2, b2) != 1 && max(a2, b2) % min(a2, b2) == 0)
    ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

void print(const std::vector<int>& v)
{
  std::for_each(v.begin(), v.end(), [](int x) {
    std::cout << x << " ";
  });
  std::cout << std::endl;
}

int main ()
{
  int ini = 0;
  string S;cin>>S;
  for(int i = 0; i<S.size();i++){
    if(S[i]=='+') ini++;
    else ini--;
  }
	cout<<ini<<endl;
  return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N;
P ps[100100];
std::set<int> s1, s2;

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

  std::cin >> N;

  for(int i=0;i<N;++i){
      int j;
      std::cin >> j;

      ps[i] = std::make_tuple(j, i);
  }

  std::sort(ps, ps + N);
  std::reverse(ps, ps + N);

  ll res = 0;

  for(int i=0;i<N;++i){
      int j, k;
      std::tie(k, j) = ps[i];

      int l1 = -1, l2 = -1, r1 = N, r2 = N;

      {
          auto it = s1.lower_bound(-j);

          if(it != s1.end()){
              l1 = -*it;

              std::advance(it, 1);

              if(it != s1.end()){
                  l2 = -*it;
              }
          }
      }

      {
          auto it = s2.lower_bound(j);

          if(it != s2.end()){
              r1 = *it;

              std::advance(it, 1);

              if(it != s2.end()){
                  r2 = *it;
              }
          }
      }

      // std::cout << k << ", " << j << ", " << l1 << ", " << l2 << ", " << r1 << ", " << r2 << std::endl;

      res += 1ll * k * (l1 - l2) * (r1 - j) + 1ll * k * (j - l1) * (r2 - r1);

      // std::cout << res << std::endl;

      s1.emplace(-j);
      s2.emplace(j);
  }

  std::cout << res << std::endl;
}


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

ll inf=1ll<<60;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n,i,a[100000],t=0,s=1;
	bool vis[100000];
	fill(vis,vis+100000,false);
	cin>>n;
	for (i=0;i<n;i++){
		cin>>a[i];
	}
	for (;;){
		if (a[t]==2){
			break;
		}
		else if (vis[t]==false){
			vis[t]=true;
			t=a[t];
			t--;
			s++;
		}
		else if (vis[t]==true){
			s=-1;
			break;
		}
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };



void solve() {
    ll a, b, c, d, e , m, n, k, x, y, l,r, h, w;
    string s, t;
    ll ans = 0;
    double dans = 0;
    string sans = "Yes";
    vector<ll> ar;
    vector<string> sr;
    vector<vector<char>> arr;

    cin >> n;
    ll _n=n;
    ll sum = 0;
    while(1){
        sum += _n%10;
        _n /= 10;
        if(_n==0)break;

    }

    if(n%sum==0)sans="Yes";
    else sans="No";

    // std::cout << ans << endl;

    std::cout << sans << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
    long long N;
    cin >> N;
    long long answer = N;
    for( long long i=1; i<=sqrt(N); i++){
        if(N%i!=0)
            continue;
        long long pair = N/i;
        long long tmp = (i-1) + (pair-1);
        answer = min(answer, tmp);
    }

    cout << answer << endl;
    return 0;
}

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

x = [0]*30
for a in A:
    for i in range(30):
        if (a>>i) & 1:
            x[i] += 1

f = 0
for i in range(30):
    if x[i]%2 == 1:
        f ^= (1<<i)

for i in range(N):
    A[i] ^= f

print(" ".join([str(a) for a in A]))

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

int cost[200][200];
int a[8];
signed main() {
	memset(cost, 0x3f, sizeof(cost));
	int n, m, r; cin >> n >> m >> r;
	for (int i = 0; i < r; i++) { cin >> a[i]; a[i]--; }
	sort(a, a + r);
	for (int i = 0; i < m; i++) {
		int b, c, d; cin >> b >> c >> d;
		b--; c--;
		cost[b][c] = cost[c][b] = d;
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 0; k < n; k++) {
				cost[j][k] = min(cost[j][k], cost[j][i] + cost[i][k]);
			}
		}
	}
	int ans = 1 << 29;
	do {
		int sum = 0;
		for (int i = 1; i < r; i++) {
			sum += cost[a[i - 1]][a[i]];
		}
		ans = min(ans, sum);
	} while (next_permutation(a, a + r));
	cout << ans << endl;
}


Measured memory_bytes: 512
from math import sqrt
def f(x,y,z):
  return x**2+y**2+z**2+x*y+y*z+z*x

N=int(input())
n = int(sqrt(N))+5
count = [0 for i in range(N+1)]
for i in range(1,n):
  for j in range(1,n):
    for k in range(1,n):
      out = f(i,j,k)
      if out <= N:count[out] += 1
for i in range(1,N+1):
  print(count[i])

Measured memory_bytes: 9128
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

import math

H=one_int()

beki = int(math.log2(H))+1

print(2**beki -1 )

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <functional>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long llong;

int main() {
    llong n;
    llong a, b;
    llong ans = 0;

    b = 1ll << 60ll;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a;
        if (a > b) ans++;
        b = a;
    }

    cout << ans << endl;

    return 0;
}


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

vector<int> tsort_Kahn(const vector<vector<int>>& g) {
    const int V = g.size();

    vector<int> indeg(V,0);
    stack<int>  S;

    // ??¨???????????????????????????????????\?¬???°????¨????
    for(auto& u_out_edges : g)
	for(auto& v : u_out_edges)
	    indeg[v]++;

    // ??\?¬???° == 0 ?????????????¨????
    for(int i=0; i<V; ++i) 
	if( indeg[i] == 0 )
	    S.push(i);

    vector<int> ans;
    while( S.size() > 0 ) {
	int u = S.top(); S.pop();
	ans.emplace_back(u);
	for(auto& v : g[u]) {
	    indeg[v]--;
	    if( indeg[v] == 0 ) S.push(v);
	}
    }
    if( ans.size() == V )
	return ans;
    else
	return vector<int>();
}

void visit(const vector<vector<int>>& g, int u, vector<bool>&used, vector<int>& ans) {

    if( used[u] == false ) {
	used[u] = true;
	for(auto& v : g[u]) {
	    visit(g, v, used, ans);
	}
	ans.emplace_back(u);
    }
}

vector<int> tsort_Tarjan(const vector<vector<int>>& g) {
    const int V = g.size();

    vector<bool> used(V,false);
    vector<int> ans;
    for (int u=0; u<V; ++u) {
	visit(g, u, used, ans);
    }
    reverse(ans.begin(), ans.end());
    return ans;
}

// tsort_Kahn??¨???????????????
vector<int> tsort_BFS(const vector<vector<int>>& g) {
    const int V = g.size();

    vector<int> indeg(V,0);
    queue<int>  Q;

    // ??¨???????????????????????????????????\?¬???°????¨????
    for(auto& u_out_edges : g)
	for(auto& v : u_out_edges)
	    indeg[v]++;

    // ??\?¬???° == 0 ?????????????¨????
    for(int i=0; i<V; ++i) 
	if( indeg[i] == 0 )
	    Q.push(i);
    
    vector<int> ans;
    while( Q.size() ) {
	int u = Q.front(); Q.pop();
	ans.emplace_back(u);
	for(auto& v : g[u]) {
	    indeg[v]--;
	    if( indeg[v] == 0 ) Q.push(v);
	}
    }
    return ans;
}


int main () {

    int V,E;
    cin >> V >> E;

    vector<vector<int>> g(V);
    for (int i=0; i<E; ++i) {
	int s,t;
	cin >> s >> t;
	g[s].emplace_back(t);
    }

    vector<int> ans = tsort_Kahn(g);
    if( ans.size() == 0 )
	cout << 1 << endl;
    else
	cout << 0 << endl;
    return 0;
}

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

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

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

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

int main(){
	int n;
	cin>>n;
	vi a(n),b(n),c(n);
	for (int i = 0; i < n; i++){
		cin>>a[i];
	}
	for (int i = 0; i < n; i++){
		cin>>b[i];
	}
	for (int i = 0; i < n; i++){
		c[i]=i+1;
	}

	int x=0,y=0,cnt=0;
	do{
		cnt++;
		if(a[0]==c[0]){
			bool flag=true;
			for (int i = 0; i < n; i++){
				if(a[i]!=c[i]){
					flag=false;
				}
			}
			if(flag)x=cnt;
		}
		if(b[0]==c[0]){
			bool flag=true;
			for (int j = 0; j < n; j++){
				if(b[j]!=c[j]){
					flag=false;
				}
			}
			if(flag)y=cnt;
		}
	}while(next_permutation(all(c)));

	cout<<abs(x-y)<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <math.h>
using namespace std;

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

    int res = n;
    vector<int> vprime;
    int sqr = int(sqrt(n));

    for (int i = 2; i <= sqr; ++i) {
        while (res % i == 0) {
            res /= i;
            vprime.push_back(i);
        }
        if (n == 1) {
            break;
        }
    }
    if (res > sqr) {
        vprime.push_back(res);
    }

    cout << n << ":";
    
    for (size_t i = 0; i < vprime.size(); ++i) {
        cout << " " << vprime[i];
    }
    cout << endl;

    return 0;
}


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

int main() {
  int s;
  cin >> s;
  int N = 1000000;
  int check;
  
  if(s==4){cout << 4 << endl;}
  if(s==3){cout << 9 << endl;}
  if(s==2){cout << 4 << endl;}
   if(s==1){cout << 4 << endl;}
  
  if(s>4){
  for (int i = 0; i < N; i++){
    if(s%2 == 0){
      s /= 2;
    } else {
      s = 3*s + 1;
    }
    if(s == 4){
      check = i;
      break;}
  }
  
  cout << check + 5 << endl;}
  
}

Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = new int[n + 2];
        var t = 0L;
        for (int i = 0; i < n; i++)
        {
            a[i + 1] = int.Parse(line[i]);
            t += Math.Abs(a[i] - a[i + 1]);
        }
        t += Math.Abs(a[n] - a[n + 1]);
        for (int i = 1; i <= n; i++)
        {
            var ret = t - Math.Abs(a[i - 1] - a[i]) - Math.Abs(a[i] - a[i + 1]) + Math.Abs(a[i - 1] - a[i + 1]);
            Console.WriteLine(ret);
        }
    }
}


Measured memory_bytes: 26844
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#define FOR(i,j,n) for(int i=(j);i<=((int)n);++i)
#define N 1000005
#define MOD 1000000007
#define all(c) (c).begin(),(c).end()
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define pb push_back
typedef long long int ll;
typedef std::vector< int > vi;
typedef std::vector< vi > vvi;
typedef std::pair< int,int > ii;
using namespace std;

vector <int>g[N];
void init()
{
	for(int i = 0; i < N; i++) {
		g[i].clear();
	}
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin>>s>>t;
    int x=0;
    FOR(i,0,2)
    {
    	if (s[i]==t[i])
    	x++;
	}
    cout<<x<<endl;
    

}





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

using namespace std;

#define OnlineJudge1

#define loop(x,a,n) for(int x = a;x < n;x++)
#define NumofDigits(n) ((int)log10(n)+1)
#define CountofNumber(array,n,x)  (upper_bound(array, array+n, x)-lower_bound(array, array+n, x))
#define readline(s) getline(cin,s)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define EPS 1e-7
#define modulo ll (1e9 + 7)
const long double PI = 3.141592653589793238L;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,ll> pill;
typedef pair<ll,ll> pll;

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)

#define time__(d) \
    for ( \
        auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
        blockTime.second; \
        debug("%s: %lld ms\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false \
    )


void init(){
    cin.tie(0);
    ios::sync_with_stdio(0);
#ifdef OnlineJudge
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
#endif
}


const int N = 1e5 + 5, M = 1e6 + 6, OO = 0x3f3f3f3f;


int main(){
    init();

    int n, k;   cin >> n;
    string s;   cin >> s;
    cin >> k;   k--;

    for(int i = 0;i < n;i++)
        if(s[i] != s[k])    s[i] = '*';

    cout << s;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <vector>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define in insert
#define er erase
#define fi first
#define se second
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int) x.size()
using namespace std;
typedef vector <int> vi;
typedef vector <vector<int>> vii;
typedef pair<int,int> pii;
typedef double db;
typedef long long ll;
typedef long double ld;

const long double PI=3.141592653589793238462643383279502884;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int main(){
    fast;
    ll n;
    cin>>n;
    ll d=n%10;
    if (d==3){
        cout<<"bon";
        return 0;
    }
    if (d==2||d==4||d==5||d==7||d==9){
        cout<<"hon";
    }
    if (d==0||d==1||d==6||d==8){
        cout<<"pon";
    }
    return 0;
}





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

using namespace std;

typedef long long ll;
typedef long double ld;

int main() {
#ifdef AZINO777
 //   freopen("in", "r", stdin);
#endif
    int n, a, b;
    cin >> n >> a >> b;
    if ((b - a) % 2 == 0) {
        cout << "Alice" << endl;
    } else {
        cout << "Borys" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,ans;
int main(){
	cin>>n;
	repn(i,n){
		int j=i,cnt=0;
		while(j){cnt++;j/=10;}
		if(cnt%2==1)ans++;
	}cout<<ans<<endl;
	}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  vector<int> arr(n);
  for(int i=0;i<n;++i)cin>>arr[i];
  vector<int> temp(arr);
  sort(arr.begin(),arr.end());
  
  int ct=0;
  for(int i=0;i<n;++i){
    if(arr[i]!=temp[i])ct++;
  }
  
  if(ct<=2){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

static const int MAX = 500;
static const int IN = (1<<21);

int main(){
  int num,i,j,ei,sum;
  int Ma[MAX][MAX];
  int x,y;
  int Minv;
  int D[MAX];
  int P[MAX];
  int Vis[MAX];

  scanf("%d",&num);

  for(i=0;i<num;i++){
    for(j=0;j<num;j++){
      scanf("%d",&ei);
      Ma[i][j] = (ei ==-1)?IN:ei;
    }
  }

  for(i=0;i<num;i++){
    D[i] = IN;
    P[i] = -1;
    Vis[i]=0;
  }
  D[0] = 0;

  while(1){
    Minv = IN;
    x=-1;
    for(i=0;i<num;i++){
      if(Minv > D[i] && !Vis[i]){
	x=i;
	Minv=D[i];
      }
    }
    if(x==-1){
      break;
    }
    Vis[x] = 1;
    for(y=0;y<num;y++){
      if(!Vis[y] && Ma[x][y] != IN){
	if(D[y] > Ma[x][y]){
	  D[y] = Ma[x][y];
	  P[y] = x;
	}
      }
    }
  }
  sum = 0;
  for(i=0;i<num;i++){
    if(P[i] != -1){
      sum +=Ma[i][P[i]];
    }
  }
  printf("%d\n",sum);

  return 0;
}



Measured memory_bytes: 2060