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

#define MAX_LENGTH 102	/* 文字数100個 + 改行 + NULL文字 */

/* stack 定義 (容量が固定だったり char 限定だったり、結構適当) */
typedef struct
{
	char body[MAX_LENGTH];
	int  idx;
} stack_t;

/* stack 実体 */
static stack_t g_stack;

/* -------------------- stack 操作関数郡 ここから --------------------- */
/* stack の中身を消す */
void stack_clear(stack_t* p_stack)
{
	p_stack->idx = 0;
	return;
}

/* stack にpushする */
void stack_push(stack_t* p_stack, char c)
{
	p_stack->body[p_stack->idx] = c;
	p_stack->idx++;
	return;
}

/* stack からpopする (C++ と違って値を返すことに注意.) */
/* stack が空のときには呼び出さないこと. (0 を返すが 0 がpushされていた場合と区別が付かないので注意) */
char stack_pop(stack_t* p_stack)
{
	char c = 0;

	if(p_stack->idx != 0)
	{
		p_stack->idx--;
		c = p_stack->body[p_stack->idx];
	}
	return c;
}

/* stack が空なら true を返す */
bool stack_is_empty(stack_t* p_stack)
{
	return (p_stack->idx == 0) ? true : false;
}
/* -------------------- stack 操作関数郡 ここまで --------------------- */

/* 括弧がバランスしているか判定する (関数名は適当) */
bool solve(char* str)
{
	stack_t* p_stack = &g_stack;

	int i, length;
	char c;
	
	stack_clear( p_stack );
	
	length = strlen(str);
	for (i = 0; i < length; i++)
	{
		c = str[i];
//		printf("c=%c, stack_idx=%d, stack_top=%c\n", c, p_stack->idx, p_stack->idx != 0 ? p_stack->body[p_stack->idx - 1] : ' ');

		if (c == '(' || c == '[')
		{
			stack_push(p_stack, c);
		}
		else if (c == ')')
		{
			if (stack_is_empty(p_stack) || stack_pop(p_stack) != '(')
			{
				return false;
			}
		}
		else if (c == ']')
		{
			if (stack_is_empty(p_stack) || stack_pop(p_stack) != '[')
			{
				return false;
			}
		}
	}
	
	/* バランスしていればstackは空になる */
	return stack_is_empty( p_stack );
}

/* 改行を除いた1行を標準入力から取得する */
void get_line(char* str, char* max_size)
{
	char* cptr;

	fgets(str, max_size, stdin);

	cptr = strchr(str,'\n');
	if(cptr != NULL)
	{
		*cptr='\0';
	}
	
	return;
}

int main(void)
{
	char str[MAX_LENGTH];

	while(1)
	{
		get_line(str, MAX_LENGTH);
		if (strcmp(".", str) == 0)
		{
			break;
		}
		printf("%s\n", solve(str) ? "yes" : "no");
    }
	return 0;
}



Measured memory_bytes: 2044
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  ll ans = 1000 - N % 1000;
  ans %= 1000;
  cout << ans << "\n";
}


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

import static java.lang.Integer.parseInt;

/**
 * Bamboo Blossoms
 */
public class Main {

	static final int MAX = 7368792;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			int m, n;
			m = parseInt(line.substring(0, line.indexOf(' ')));
			n = parseInt(line.substring(line.indexOf(' ') + 1));
			if ((m | n) == 0) break;

			boolean[] years = new boolean[MAX];
			int ans = 0;

			for (int i = 0, j = m; i < n; ) {
				if (!years[j]) {
					for (int k = j; k < MAX; k += j) {
						years[k] = true;
					}
					i++;
				}
				ans = ++j;
			}

			for (int i = ans; i < MAX; i++) {
				if (!years[i]) {
					ans = i;
					break;
				}
			}

			System.out.println(ans);

		} //end while
	} //end main
}

Measured memory_bytes: 55672
#include <stdio.h>

int a,b;

int main () 
{
	scanf("%d %d",&a,&b);
	while (a!=0||b!=0)
	{
		for (int i=1;i<=a;i++)
		{
			for (int j=1;j<=b;j++)
			{
				printf("#");
			}
			printf("\n");
		}
		scanf("%d %d",&a,&b);
		
		printf ("\n");	
		
	}
}


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

int main() {
  int N,K;
  cin >> N >> K;
  vector<int> A(N);
  rep(i,N){
    cin >> A.at(i);
  }
  rep(i,N-K){
    if(A.at(i)<A.at(K+i)){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
}

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

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n, i##_len=(n); i>=0; i--)
#define FOR(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 

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

int N = S.size();
int tmp = 0;
vector<int>ans(N, 0);
REP(j, 2){
REP(i, N){
	if(S.at(i) == 'R') tmp++;
	else {
		ans.at(i) += tmp / 2;
		ans.at(i - 1) += (tmp + 1) / 2;
		tmp = 0;
	}
}

reverse(all(ans));
reverse(all(S));

REP(k, N){
	if(S.at(k) == 'R') S.at(k) = 'L';
	else S.at(k) = 'R';
}
}

REP(i, N){
	cout << ans.at(i) << endl;
}
}


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

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;
 
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;

int main() {
  
  long long n,a,b;
  cin >> n >> a >> b;
  
  long long set,amr;
  
  set = n / ( a + b );
  amr = n % ( a + b );
  
  cout << set * a + min(amr,a) << endl;

}

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

int main(int argc, char const *argv[]) {
    int n;
    int min = 1000001;
    int max = -1000001;
    long long int sum=0;

    cin >> n;

    for (int i = 0; i < n; i++) {
        int a;
        scanf("%d", &a);
        sum += a;
        if (a > max) {
            max = a;
        }
        if (a < min) {
            min = a;
        }
    }

    cout << min << ' ' << max << ' ' << sum << endl;
    return 0;
}



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

int main(){
  char c;
  cin >> c;
  
  if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o'){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
}

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

int main(void){
    int high[10];
	for(int i=0;i<10;i++){
		cin >> high[i];
	}
    
	for(int i=0;i<9;i++){
		int max_index = i;
		for(int j=i+1;j<10;j++){
			if(high[max_index] < high[j]){
				max_index = j;
			}
		}
		swap(high[i],high[max_index]);
	}
	
	for(int i=0;i<3;i++){
	    cout << high[i] <<endl;
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <cmath>
#include <iomanip>
#include <utility>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

long long gcd(int x, int y){
    if ( x == 0 ) return y;

    return gcd(y%x, x);
}

long long lcm(int x, int y){
    if ( y == 0 ){
        return x;
    }

    return x*y/gcd(x, y);
}

int min(int a, int b){
    return a > b ? b : a;
}

int max(int a, int b){
    return a > b ? a : b;
}

int main()
{
    cin.sync_with_stdio( false );
    int n;
    cin>>n;

    int m[15][15];
    for (int i=0;i<15;i++)
        for (int j=0;j<15;j++)
            m[i][j] = 0;

    for (int i=1;i<=n;i++){
        int a = i % 10;
        int b = i;

        while ( b >= 10 ){
            b/=10;
        }

        m[a][b]++;
    }

    int res = 0;
    for (int i=1;i<=n;i++){
        int a = i % 10;
        int b = i;

        while ( b >= 10 ){
            b/=10;
        }

        res+=m[b][a];
    }

    cout<<res<<endl;
}


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

constexpr int si = 1000 * 1001;
int n, di[si], par[si];
vector<int> gr[si], p1, p2;
deque<int> pat;

int cn(vector<int>& tv) {
   int ret = 0;
   while (!tv.empty()) {
      int t = tv.back(); tv.pop_back();
      for (const auto&c : gr[t]) {
         if (0 == di[c]) {
            di[c] = 1;
            ++ret;
            tv.push_back(c);
         }
      }
   }
   return ret;
}
int sol() {
   memset(di, 0, sizeof di);
   int q1 = 0, q2 = 0;
   di[1] = 1; di[n] = 2;
   p1.push_back(1); p2.push_back(n);
   pat.pop_front(); pat.pop_back();

   while (pat.size()) {
      q1 = pat.front(); pat.pop_front();
      if (di[q1]) {
         q1 = q2 = 0; break;
      }
      di[q1] = 1; p1.push_back(q1);

      if (pat.empty() || di[pat.back()]) {
         q2 = 0; break;
      }
      q2 = pat.back(); pat.pop_back();
      di[q2] = 1; p2.push_back(q2);
      q1 = q2 = 0;
   }
   int c1 = cn(p1),
   c2 = cn(p2),
   c3 = min(c1, c2);
   c1 -= c3; c2 -= c3;

   if (q1 && 0 == q2) {
      if (0 == c2)
         return 1;
      --c2;
   }
   if (0 == c1)
      return 0;
   return 1;
}

int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);
   while (cin >> n)
   {
      for (int i = 0; i < si; i++) gr[i].clear(); memset(di, 0, sizeof di);
      pat.clear(); p1.clear(); p2.clear();
      for (int i = 0; i < n-1; i++) {
         int x, y;  cin >> x >>y; gr[x].push_back(y);gr[y].push_back(x);
      }
      //
      {
         queue<int> q; q.push(1);
         di[1] = 1;
         do {
            const int t = q.front(); q.pop();
            for (const auto& c : gr[t]) {
               if (0==di[c]) {
                  di[c] = di[t] + 1; par[c] = t;
                  q.push(c);
               }
            }
         } while (!q.empty());
      }
      {
         int z = n;
         while (1 != z) {
            pat.push_back(z);
            z = par[z];
         }
         pat.push_back(1);
         reverse(pat.begin(), pat.end());
      }
      auto s = sol();
      puts(s? "Fennec" : "Snuke");
   }
  
   return 0;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  string s[H];

  
  for(int h = 0; h<H; h++) 
  {
    cin >> s[h];
    //↓↓これだと改行コードごとに取得するため，最初のH,Wの数字の後の改行コードを読み取ってしまい，s[0]が空白になってしまう．
    //getline(cin, s[h]); //文字列を行ごとに取得
  }
  
  
  for(int h=0; h<H; h++)
  {//行数分ループ
    for(int w=0; w<W; w++)
    {//列数分ループ
      if(s[h].at(w) == '#') continue;//爆弾の場所は数字には変換しないのでスキップ   
      
      int count = 0;
      for(int u=h-1; u<=h+1; u++)
      {
        if(u == -1 || u == H)continue;//比較対象が上下の端を超えているならスキップ
        
        for(int v=w-1; v<=w+1; v++)
        {
          if(v == -1 || v == W) continue;//比較対象が左右の端を超えているならスキップ
          if(u == h && v == w)continue;//比較対象が自分自身ならスキップ
          if(s[u].at(v) == '#')count++;
        }
      }
      
      s[h].at(w) =  '0' + count;//'.'の個数に変換   
    }
  }
  
  for(int h = 0; h<H; h++){
    cout << s[h] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
import numpy as np

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))     

s = np.sum(b)
for i in range(n):
  a[i] = a[i] -1

t = a[0]
for i in range(1, len(a)):
  if (t+1) == a[i]:
    s = s + c[a[i]-1]
  t = a[i]
print(s)

Measured memory_bytes: 18868
//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
//#pragma GCC optimize(4)
//#pragma GCC optimize("unroll-loops")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <bits/extc++.h>
#define fi first
#define se second
#define db double
#define mp make_pair
#define pb push_back
#define mt make_tuple
//#define pi acos(-1.0)
#define ll long long
#define vi vector<int>
#define mod 998244353
#define ld long double
//#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pii pair<int,int>
#define ull unsigned long long
#define bpc __builtin_popcount
#define base 1000000000000000000ll
#define fin freopen("a.txt","r",stdin)
#define fout freopen("a.txt","w",stdout)
#define fio ios::sync_with_stdio(false);cin.tie(0)
#define mr mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline void sub(ll &a,ll b){a-=b;if(a<0)a+=mod;}
inline void add(ll &a,ll b){a+=b;if(a>=mod)a-=mod;}
template<typename T>inline T const& MAX(T const &a,T const &b){return a>b?a:b;}
template<typename T>inline T const& MIN(T const &a,T const &b){return a<b?a:b;}
inline ll mul(ll a,ll b,ll c){return (a*b-(ll)((ld)a*b/c)*c+c)%c;}
inline ll qp(ll a,ll b){ll ans=1;while(b){if(b&1)ans=ans*a%mod;a=a*a%mod,b>>=1;}return ans;}
inline ll qp(ll a,ll b,ll c){ll ans=1;while(b){if(b&1)ans=mul(ans,a,c);a=mul(a,a,c),b>>=1;}return ans;}

using namespace std;
//using namespace __gnu_pbds;

const ld pi = acos(-1);
const ull ba=233;
const db eps=1e-5;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int N=1000000+10,maxn=2000000+10,inf=0x3f3f3f3f;

ll a[N],b[N],c[N];
int main()
{
    int n,ma=0;scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%lld",&a[i]),b[a[i]]++,ma=max(ma,(int)a[i]);
    ll ans=0;
    for(int i=1;i<=ma;i++)c[i]=qp(i,mod-2);
    for(int i=1;i<=ma;i++)
        for(int j=2*i;j<=ma;j+=i)
            sub(c[j],c[i]);
    for(int i=1;i<=ma;i++)
    {
        ll te=0,p=0;
        for(int j=i;j<=ma;j+=i)
            add(te,b[j]*j%mod),add(p,b[j]*j%mod*j%mod);
        te=((te*te-p)%mod+mod)%mod;
        te=te*qp(2,mod-2)%mod;
        add(ans,te*c[i]%mod);
    }
    printf("%lld\n",ans);
    return 0;
}
/********************

********************/


Measured memory_bytes: 18688
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int cnt=0,num,len,k;
ll ans;
void dfs(int x,ll i){
    if(len==x) {cnt++;if(cnt==k) {ans=i;}i/=10;return;}
    int u=i%10;
    for(ll j=u-1;j<=u+1;j++){
        if(j<0 || j>9) continue;
        else{
            len++;
            dfs(x,i*10+j);
            len--;
        }
    }
}
int main(){
    cin>>k;
    for(int j=1;j<=10;j++){
        for(ll i=1;i<=9;i++){
            len=1;
            dfs(j,i);
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <stdio.h>
# include <cmath>
# include <iomanip>
// # include <cstring>
// # include <string>
// # include <cctype>
// # include <algorithm> //transformの関数はaslgorithmライブラリに入っているみたい。
using namespace std;
int main(){
  double x1,y1,x2,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  cout << fixed;
  cout << setprecision(5)<< sqrt(pow((x2-x1),2)+ pow((y2-y1),2));
  return 0;
}


Measured memory_bytes: 3212
#include <stdio.h>
#define N 999999
long prime(long num);
int main(){
	long j,n,ans;
	while(scanf("%ld",&n)!=EOF){
		printf("%ld\n",prime(n));
	}
	return 0;
}
long prime(long num){
	long i,j;
	int k=0;
	char b[N];
	for(i=0;i<N;i++)b[i]=0;
	for(i=2;i<=num;i++){
		if(b[i]==0){
			k++;
			for(j=1;i*j<N;j++)b[j*i]=1;
		}
	}
	return k;
}

Measured memory_bytes: 1380
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int n;
    cin >> n;
    
    for(int i = 1; i <= 9; i++) {
        for(int j = 1; j <= 9; j++) {
            if (i*j == n) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let (a, b) = read!(usize, usize);
    println!("{}", (a - 1) * (b - 1));
}


Measured memory_bytes: 4352
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
int N,A,B;
int main() {
	cin>>N>>A>>B;

	for(int i=1;;i++){
		if(i%2==1){//アリスの番
			if(B-A==1){
				cout<<"Borys"<<endl;
				break;
			}
			A++;
		}
		if(i%2==0){//ボリスの番
			if(B-A==1){
				cout<<"Alice"<<endl;
				break;
			}
			B--;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define _USE_MATH_DEFINES
#include <cmath>
using namespace std;
 
int main(){
  int n =0;
  cin >> n;
  double *a = new double[n];
  double *b = new double[n];
  double ans1 = 0,ans2 = 0, ans3 = 0,ans3_1 = 0, ans4 = 0, ans4_1 = 0;
  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++){
    double c = 0;
    c = a[i] - b[i];
    if(c > 0){
      ans1 += c;
    }else{
      ans1 -= c;
    }
  }
  for(int i = 0;i < n; i++){
    ans2 += (a[i] - b[i])*(a[i] - b[i]);
  }
  ans2 = sqrt(ans2);
  for(int i = 0; i < n; i++){
    ans3_1 = (a[i] - b[i])*(a[i] - b[i])*(a[i] - b[i]);
    ans3 += fabs(ans3_1);
  }
  ans3 = pow(ans3, 1.0/3.0);
  ans4 = fabs(a[0] - b[0]);
  for(int i = 0; i < n; i++){
    ans4_1 = fabs(a[i] - b[i]);
    if(ans4_1 > ans4){
      ans4 = ans4_1;
    }
  }
  printf("%.8lf\n%.8lf\n%.8lf\n%.8lf\n",ans1,ans2,ans3,ans4);
}


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

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int,int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vll>;
using vb = vector<bool>;

const int INF = 2e9+5;
const ll LLINF = (1LL << 60) + 5;

/*
  filippos
  Contest : AtCoder DP contest
  Task : C - Vacation
*/

int main(){
  cin.tie(0), cin.sync_with_stdio(0), cout.tie(0), cout.sync_with_stdio(0);

  int n; cin >> n;

  vvi a(n, vi(3));
  for(vi &v : a)
    for(int &i : v)
      cin >> i;


  function<int(int, int)> solve = [&](int i, int prev){
    static vvi memo(n, vi(3, -1));
    if(i == a.size()) return 0;
    if(i && memo[i][prev] != -1) return memo[i][prev];
    int sol = 0;
    for(int next = 0; next < 3; next++) if(next != prev)
      sol = max(sol, a[i][next] + solve(i + 1, next));
    if(i) memo[i][prev] = sol;
    return sol;
  };

  cout << solve(0, -1);

  return cout << endl, 0;
}

Measured memory_bytes: 20608
p = int(input())
y = list(map(int, input().split()))
t = 0
for h in range(p):
    o = h
    for n in range(h, p):
        if y[n] < y[o]: o = n
    if h != o:
        y[h], y[o] = y[o], y[h]
        t += 1
print(*y)
print(t)

Measured memory_bytes: 7652
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pb push_back
#define inf 1000000000000000000
void checkpoint1()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	*/
}
int main()
{
	checkpoint1();
	ll n,m;
	string s,t;
	cin>>s>>t;
	n=s.length();
	m=t.length();
	ll dp[n+1][m+1];
	for(ll i=0;i<=n;i++)
	{
		for(ll j=0;j<=m;j++)
		{
			if(i==0||j==0)
				dp[i][j]=0;
			else if(s[i-1]==t[j-1])
				dp[i][j]=dp[i-1][j-1]+1;
			else
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	string ans="";
	ll i=n,j=m;
	while(dp[i][j]!=0)
	{
		if(dp[i][j]!=dp[i-1][j]&&dp[i][j]!=dp[i][j-1])
		{
			ans.insert(ans.begin(),s[i-1]);
			i--;
			j--;
		}
		else
		{
			if(dp[i][j]==dp[i-1][j])
				i--;
			else
				j--;
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 70656
#include <stdio.h>

int main (void)
{
	int i;
	int j;
	int k;
	int n;
	int up;
	int down;
	static int prime[100001];
	
	for (i = 1; i <= 100000; i++){
		if (i == 2){
			prime[i] = 1;
		}
		else if (i != 1){
			k = 0;
			for (j = 2; j * j <= i; j++){
				if (i % j == 0){
					k = 1;
					break;
				}
			}
			if (k == 0){
				prime[i] = 1;
			}
		}
	}
	
	while (scanf("%d", &n) != EOF){
		up = n + 1;
		down = n - 1;
		
		while (prime[up] != 1){
			up++;
		}
		
		while (prime[down] != 1){
			down--;
		}
		
		printf("%d %d\n", down, up);
	}
	
	return 0;
}

Measured memory_bytes: 984
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
#include <iomanip>
using namespace std;

int main(void){
    string s, t, c1, c2;
    int count = 0;
    cin >> s; cin >> t;
    int sc[27], tc[27];
    for(int i = 0; i < 27; i++){
        sc[i] = 0; tc[i] = 0;
    }
    for(int i = 0; i < s.size(); i++){
        sc[s[i]-97]++; tc[t[i]-97]++;
    }
    sort(sc, sc+27); sort(tc, tc+27);
    for(int i = 0; i < 27; i++){
        if(sc[i] != tc[i])
            count++;
    }
    if(count == 0)
        cout << "Yes" << endl;
    else if(count != 0)
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 776
n,k=map(int,input().split())
A=list(map(int,input().split()))
high=max(A)
low=0
while high-low>1:
    cnt=0
    now=(low+high)//2
    for a in A:
        cnt+=max((a-1)//now,0)
        if cnt>k:
            break
    if cnt>k:
        low=now
    else:
        high=now
    #print(cnt,low,high)
print(high)

Measured memory_bytes: 30828
#include<iostream>
using namespace std;
int main()
{
    long long int n, k, s;
    cin >>n>>k>>s;
    for (int i = 1; i <= k; ++i)
    {
        cout << s << ' ';
    }
    if (s == 1e9)
    {
        for (int i = 1; i <= n - k; ++i)
            cout << 1 << ' ';
    }
    else
    {
        for (int i = 1; i <= n - k; ++i)
            cout <<s + 1 <<' ';
    }
    return 0;
}


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

int main() {
	long Q, H, S, D, N;
	cin >> Q >> H >> S >> D >> N;
	long ans = N / 2 * min({ 2 * S, 4 * H, 8 * Q, D });
	if (N % 2) ans += min({ 2 * H, 4 * Q, S });
	cout << ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>



#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))

using namespace std;
int n;
int main(){
  cin >> n;
  if(n==1){
    cout << 1 << endl;
    return 0;
  }
  if(n==2){
    cout << 3 << endl;
    return 0;
  }
  long long int a = 2;
  long long int b = 1;
  REP(i,n-1){
    long long int c = a+b;
    a=b;
    b=c;
  }
  cout << b << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <climits>
#include <vector>
#include <cmath>
#include <stack>
#define int long long
using namespace std;

int32_t main()
{
    int N;

    cin >> N;

    vector<int> arr(N);

    for (int &e : arr)
        cin >> e;
    
    vector<int> sum(N + 1);
    for (int i = 0; i < N; i++) {
        sum[i + 1] = sum[i] + arr[i];
    }

    vector<vector<int>> dp(N, vector<int>(N + 1));
    for (int len = 2; len <= N; len++) {
        for (int l = 0; l + len <= N; l++) {
            int r = l + len;
            dp[l][r] = 2e18;
            for (int m = l + 1; m < r; m++) {
                dp[l][r] = min(dp[l][r], dp[l][m] + dp[m][r] + sum[r] - sum[l]);
            }
        }
    }
    cout << dp[0][N] << endl;
}

Measured memory_bytes: 4864
#include<iostream>
#include<fstream>
#include<algorithm>
using namespace std;
string a;
int n=0;
int main()
{
    cin>>a;
    for(int i=0;i<a.size();i++)
    {
    	if(n==0 && a[i]=='C') n++;
    	if(n==1 && a[i]=='F') n++;
    	if(n==2)
    	{
    		cout<<"Yes";
    		return 0;
    	}
    }
    cout<<"No";
    return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
bool is_prime(int n) {
  for(int i=2; i * i <= n; i++) {
    if(n % i == 0) return false;
  }
  return n != 1;
}
int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;

  int nn = n;

  while(!is_prime(nn)) nn++;
  cout << nn << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() 
{
  int n;
  cin>>n;
  int i,a[n],count[n+1]={0};
  for(i=0;i<n-1;i++)
  {
  	cin>>a[i];
  	count[a[i]]++;
  }
  for(i=0;i<n;i++)
  	 cout<<count[i+1]<<"\n";
//  cout<<"\n";
  
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};

vector<tuple<int,int,int,int>> v(50);
int n,m,q;
ll dfs(vector<int> k,int maxi){
  if(k.size() == n){
    ll sum = 0;
    REP(i,q){
      if(k[get<1>(v[i])]-k[get<0>(v[i])] == get<2>(v[i])){
        sum += get<3>(v[i]);
      }
    }
    return sum;
  }
  ll cnt = 0;
  for(int i = maxi;i <= m;i++){
    vector<int> l = k;
    l.push_back(i);
    cnt = max(dfs(l,i),cnt);
  }
  return cnt;
}

int main(){

  
  cin >> n >> m >> q;
  
  REP(i,q)cin >> get<0>(v[i]) >> get<1>(v[i]) >> get<2>(v[i]) >> get<3>(v[i]),get<0>(v[i])--,get<1>(v[i])--;
  ll res = 0;
  for(int i = 1;i <= m;i++){
    vector<int> k(1,i);
    res = max(res,dfs(k,i));
  }
  cout << res << endl;
  

  

  return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);++i)
typedef long long ll;
const ll INF = 1LL<<60;
ll dp[200005][26];

int main(){
    string s, t; cin >> s >> t; 
    int N = s.size();
    int M = t.size();
    s = s + s;
    REP(i,2*N) REP(j,26) dp[i][j] = INF;
    for(int i=2*N-2; i>=0; --i) REP(j,26){
        dp[i][j] = (s[i+1]==(char)('a'+j) ? 1 : min(INF,dp[i+1][j]+1));
    }
    ll now = (s[0]==t[0] ? 0 : dp[0][t[0]-'a']);
    ll ans = now;
    if(ans == INF) ans = -1;
    REP(i,M-1) {
        if(now == INF) { ans = -1; break;}
        ll tmp = min(dp[now][t[i+1]-'a'],dp[(now+N)%(2*N)][t[i+1]-'a']);
      	if(tmp == INF) { ans = -1; break;}
        ans += tmp;
        now = (now + tmp) % (2*N);
    }
    // REP(j,26) {if(j==0 || j==1) {REP(i,2*N) cout << (dp[i][j]==INF?-1:dp[i][j]) << " "; cout << endl;}}
    cout << (ans == -1 ? ans : ans+1) << endl;
    return 0;
}

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

const int MAX = 100000;
int n, a[MAX];
int dp[MAX+1];

//最長増加部分列問題
int lis(){
    dp[0] = a[0];
    int length = 1;

    for(int i = 1; i < n; ++i){
        if(dp[length-1] < a[i]){
            dp[length++] = a[i];
        }
        else{
            *lower_bound(dp, dp+length, a[i]) = a[i];
        }
    }
    return length;
}

int main() {

    cin >> n;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    
    int ans = lis();
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3784
#include <bits/stdc++.h>
#define ll long long 
#define ull unsigned long long 
#define f(i,x,n) for(ll int i=x;i<n;i++) 
#define re(j,x,n) for(ll int j=x;j>=n;j--)
#define f1(k,x,n) for(ll int k=x;k<=n;k++)
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define MAX 1000001
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll int n;
    cin>>n;
    if(n<=9)
    {
      cout<<"Yes";
      return 0;
    }
    f(i,2,10)
    { 
      if(n%i==0){
      if(n/i>=1&&n/i<=9)
      {
      	cout<<"Yes";
      	return 0;
      }
  	  }
    }  
    cout<<"No";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>

#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
#define rep_r(i,s,n)for(int i = n-1;i>=s;i--)
#define rep_re(i,s,n)for(int i = n;i>=s;i--)
using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;
static const ll MAX_M = 100001;

ll a[200001] = {};
ll b[200001] = {};
ll p[200001] = {};
int main() {
	ll n; cin >> n;
	repe(i, 1, n)cin >> p[i];

	repe(i, 1, n) {
		ll s = 30000;
		a[i] = i * s;
		b[i] = (n - i + 1) * s;
	}
	repe(i, 1, n) {
		a[p[i]] += i;
		//if (i < n / 2) {
		//	a[p[i]] -= n - i;
		//}
		//else {
		//	a[p[i]] += i;
		//}
	}

	//ans
	repe(i, 1, n) {
		cout << a[i];
		if (i != n) cout << " ";
	}
	cout << endl;
	repe(i, 1, n) {
		cout << b[i];
		if (i != n) cout << " ";
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

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

int n,x=0;
int cnt[3]={0};
bool ans=0;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n;
    REP(i,n){
        int a;cin>>a;
        if(a%4==0) ++cnt[0];
        else if(a%2==0) ++cnt[1];
        else ++cnt[2];
    }
    if(cnt[0]+cnt[1]==n)ans=1;
    if(cnt[1]>0){
        x = cnt[1] - 1;
        ++cnt[2];
    }
    if(cnt[0]>=cnt[2] && (n-x)%2 == 0) ans=1;
    if(cnt[0] + 1 >= cnt[2] && (n-x) % 2 == 1) ans=1;
    if(ans) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int[] az = new int[26];
                String s = sc.next();
                Arrays.fill(az , 0);
                for(int i = 0 ; i < s.length() ; i++){
                        az[(int)(s.charAt(i) - 97)]++;
                }
                sc.close();
                boolean ebishu = true;
                for(int i = 0 ; i < 26 && ebishu ; i++){
                        if(az[i] >= 2)ebishu = false;
                }
                if(ebishu){
                        System.out.println("yes");
                }else{
                        System.out.println("no");
                }
        }
}//a_97
//鶏になれ


Measured memory_bytes: 35724
#include <stdio.h>

int main(){
	int n;
	scanf("%d", &n);
	long int sum=0;
	for(int i=1;i<=n;i++){
		if(i%3!=0 && i%5!=0){
			sum = sum + i;
		}
	}
	printf("%ld\n", sum);
	return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
#include<list>
#include<algorithm>
#define ll long long int
#define ld long double
#define pb push_back
#define FF first
#define SS second
#define rep(a,b,c) for(a=b;a<c;a++)
#define repr for(i=n-1;i>=0;i--)
#define PLL pair<ll, ll>
#define inf 100000001
#define mod 1000000007
#define LP lower_bound
#define UP upper_bound
#define MP make_pair
#define rep1 for(i=1;i<=n;i++)
#define VLL vector<ll>
#define ef else if
#define all(x) (x).begin(), (x).end()
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define UMP unordered_map
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll myXOR(unsigned long long int x, unsigned long long int y)
{
    return (x|y)&(~x|~y);
}
ll powerLL(ll x, ll n) 
{ 
    ll result = 1; 
    while (n) { 
        if (n & 1) 
            result = result * x % mod; 
        n = n / 2; 
        x = x * x % mod; 
    }
    return result; 
}
int main()
{
    fastio
    ll a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r, t,u,w,x,y,z;
    string str, ss, str1;
    cin>>a>>b>>n;
    if(n>=b)
        n=b-1;
    ll res = ((a*n)/b);
    cout<<res;
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<cstdio>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> P;
typedef long long int ll;
typedef pair<ll,ll> LLP;
#define INF 1000000007

#define ARRAY_MAX 10005


int main(){

    string s;
    cin >> s;
    ll b = 0;
    REP(i,s.length()){
        if(s[i] == 'B'){
            b++;
        }
    }
    ll maxi_index = s.length()-1;
    ll ans = 0;
    for(ll i = s.length()-1;i >= 0;i--){
        if(s[i] == 'B'){
            ans += (maxi_index-i);
            maxi_index--;
        }
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int                 long long
#define FF(i,a,b)           for(int i=a;i<b;i++)
#define BF(i,a,b)           for(int i=a;i>=b;i--)
#define vi                  vector<int>
#define MAP                 map<int,int>
#define pb                  push_back
#define MP                  make_pair
#define F                   first
#define S                   second
#define pi                  pair<int,int>
#define all(v)              v.begin(),v.end()
#define PIE                 3.1415926535897932384626433832795
#define print0(a)           cout<<a<<"\n"
#define print1(a)           cout<<a<<' '
#define print2(a,b)         cout<<a<<" "<<b<<" ";
#define print3(a,b,c)       cout<<a<<" "<<b<<" "<<c<<" ";
#define print4(a,b,c,d)     cout<<a<<" "<<b<<" "<<c<<" "<<d<<" ";
#define FastIO              ios::sync_with_stdio(0); cin.tie(0);cout.tie(0)
/**************************************************************************************/
                       /*Global Variables*/
const int mod = 1e9+7;
const int N = 2e5+10;
const int inf = 3e18;

/**************************************************************************************/
template <typename A>istream& operator>>(istream& input,vector<A>& x) {for(auto& i:x)input>>i;return input;}
template<typename A>ostream& operator<<(ostream& output,vector<A>& x) {for(auto& i:x)output<<i<<' ';return output;}
int add(int a, int b){return (a%mod + b%mod + mod)%mod;}
int sub(int a, int b){return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b){return ((a%mod)*(b%mod) + mod)%mod;}
int Power(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b&1)res*=a;
        a*=a;
        b>>=1;
    }
    return res;
}
signed main()
{
    FastIO;
    // ifstream("a1.in");
    // ofstream("a1.out");
    //freopen("a1.in","r",stdin); freopen("a1.out","w",stdout);
    int T=1;
    //cin>>T;
    for(int t=1;t<=T;t++)
    {
        
        int k;
        cin>>k;
        int a,b;
        cin>>a>>b;
        if((b/k)*k>=a)
        {
            cout<<"OK\n";
        }
        else cout<<"NG\n";
        
    }

}
/*
|| Do what you can with all you have,wherever you are. ||

|| Knowing is not enough, we must apply. Wishing is not enough, we must do. ||

|| A goal is a dream with deadline. ||

|| Whether you think you can or you think you can't, you're right. ||
*/



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

int main() {
  
  string s;
  cin >> s;
  
  if (s.at(0) == s.at(1) && s.at(2) == s.at(3) && s.at(0) != s.at(2))
    cout << "Yes" << endl;
  else if (s.at(0) == s.at(2) && s.at(1) == s.at(3) && s.at(0) != s.at(1))
    cout << "Yes" << endl;
  else if (s.at(0) == s.at(3) && s.at(1) == s.at(2) && s.at(0) != s.at(1))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(){
    std::ios::sync_with_stdio(false);
    int x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;

}

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

int main(){
	ll n;
	cin >> n;
	
	vector<ll> d;
	for(ll i = 1; i * i <= n; ++i){
		if(n % i == 0){
			d.push_back(i);
			if(i * i != n){
				d.push_back(n / i);
			}
		}
	}
	
	ll ans = 0;
	for(int i = 0; i < d.size(); ++i){
		if(d[i] != 1 && n % (d[i] - 1) == n / (d[i] - 1)){
			ans += d[i] - 1;
		}
	}
	
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 384
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
s=0
for i in range(0,n):
  s+=a[i];
s/=(4*m)
c=0
for i in range(0,n):
  if a[i]>=s:
    c+=1;
if c>=m:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#include<iostream>
#include<cmath>
#include<vector>
//#include<string>

using namespace std;

void elem_swap(int &a,int &b){
  int temp=a;
  a=b;
  b=temp;
}
void bubbleSort(vector<int> &vec,vector<char> &cvec,int size){
  bool flag=true;
  char temp;
  for(int i=0;i<size-1;i++){
    for(int j=0;j<size-1-i;j++){
      if(vec.at(j)>vec.at(j+1)){
        elem_swap(vec.at(j),vec.at(j+1));
        temp=cvec.at(j);
        cvec.at(j)=cvec.at(j+1);
        cvec.at(j+1)=temp;
        flag=false;
      }
    }
    if(flag) break;
  }
}
void selectionSort(vector<int> &vec,vector<char> &cvec,int size){
  int min_index;
  char temp;
  for(int i=0;i<size-1;i++){
    min_index=i;
    for(int j=i;j<size;j++){
      if(vec.at(min_index)>vec.at(j)){
        min_index=j;
      }
    }
    if(min_index>i){
      elem_swap(vec.at(i),vec.at(min_index));
      temp=cvec.at(i);
      cvec.at(i)=cvec.at(min_index);
      cvec.at(min_index)=temp;
    }
  }
}

int main(void){
  int size;
  cin>>size;

  vector<int> bub_vec(size);
  vector<int> sel_vec(size);
  vector<char> bub_cvec(size);
  vector<char> sel_cvec(size);
  for(int i=0;i<size;i++){
    cin>>bub_cvec.at(i)>>bub_vec.at(i);
    sel_vec.at(i)=bub_vec.at(i);
    sel_cvec.at(i)=bub_cvec.at(i);
  }
bubbleSort(bub_vec,bub_cvec,size);
selectionSort(sel_vec,sel_cvec,size);

bool judge=true;
for(int i=0;i<size;i++){
  if(bub_cvec.at(i)!=sel_cvec.at(i)) judge=false;
}

for(int i=0;i<size-1;i++){
  cout<<bub_cvec.at(i)<<bub_vec.at(i)<<" ";
}cout<<bub_cvec.at(size-1)<<bub_vec.at(size-1)<<endl;
cout<<"Stable"<<endl;

for(int i=0;i<size-1;i++){
  cout<<sel_cvec.at(i)<<sel_vec.at(i)<<" ";
}cout<<sel_cvec.at(size-1)<<sel_vec.at(size-1)<<endl;
if(judge) cout<<"Stable"<<endl;
else cout<<"Not stable"<<endl;

return 0;

}



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

class RollingHash{
private:
  ll b1=1007,b2=1009;
  ll m1=1e9+9, m2=1e9+7;
  vector<ll> H1,H2,P1,P2;
public:
  RollingHash(string S){
    ll n=(ll)S.size();
    H1.assign(n+1,0); H2.assign(n+1,0); P1.assign(n+1,1); P2.assign(n+1,1);
    rep(i,n){
      H1[i+1]=(H1[i]*b1+S[i])%m1;
      H2[i+1]=(H2[i]*b2+S[i])%m2;
      P1[i+1]=P1[i]*b1%m1;
      P2[i+1]=P2[i]*b2%m2;
    }
  }
  pair<ll,ll> hash(ll l,ll r){
    assert(l<=r);
    ll h1=H1[r]-P1[r-l]*H1[l]%m1;
    ll h2=H2[r]-P2[r-l]*H2[l]%m2;
    return {h1>=0?h1:h1+m1,h2>=0?h2:h2+m2};
  }
};

template<class T,class F>
constexpr T bisection(T l,T r,F f,bool left=true,bool discrete=true){
  T eps=discrete?1:pow(10,-12);
  if((!left)^f(r)) return left?r:r+1;
  if(left^f(l)) return left?l-1:l;
  while(r-l>eps) (((!left)^f((l+r)/2))?l:r)=(l+r)/2;
  return discrete?left?l:r:(l+r)/2;
}

void solve(){
  ll n; cin>>n;
  string S; cin>>S;
  RollingHash rh{S};

  auto check=[&](ll k){
    map<pll,ll> mp;
    rep(i,n-k+1){
      pll h=rh.hash(i,i+k);
      if(mp.count(h)){ // 既に h が存在する場合
        if(i-mp[h]>=k) return true;
      }else{
        mp[h]=i;
      }
    }
    return false;
  };

  cout<<bisection((ll)0,n,check)<<"\n";
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
using namespace std;

int main(){
  int N;
  cin >> N;
  int D[N];
  rep(i, N){
    cin >> D[i];
  }
  int sums = 0;
  rep(i, N){
    sums += D[i];
  }
  int ans = sums * sums;
  rep(i, N){
    ans -= D[i] * D[i];
  }
  cout << ans / 2 << endl;
}


Measured memory_bytes: 3556
#include<iostream>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

int main(){
  int n,p,S[100000],T[100000];
  bool exist;
  cin >> n;
  rep(i,n)cin >> S[i];
  cin >> p;
  rep(i,p)cin >> T[i];

  int count=0;

  rep(i,p){
    int lef=0,rig=n;
    exist = false;
    while(lef < rig){
      int index=(lef+rig)/2;
      if(T[i] == S[index]){
	exist=true;
	break;
      }
      else if(T[i] < S[index]){
	rig=index;
      }
      else {
	lef = index+1;
      }
    }
    if(exist){
      count++;
    }
  }
  cout << count << endl;


}

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

using Lint=long long;

int main()
{
   int N,K,S; cin>>N>>K>>S;
   const int MAXS=1e9;
   vector<int> ans;
   if(S<MAXS){
      for(int i=0;i<K;i++) ans.push_back(S);
      for(int i=0;i<N-K;i++) ans.push_back(S+1);
   }else{
      for(int i=0;i<K;i++) ans.push_back(S);
      for(int i=0;i<N-K;i++) ans.push_back(S-1);
   }
   for(int i=0;i<N;i++) cout<<ans[i]<<(i==N-1? '\n':' ');
   return 0;
}


Measured memory_bytes: 1784
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}
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;
}
int main() {
    ll n;
    ll res = 1000000001;
    ll ans = 0;
    cin >> n;
    rep (i, 0, n) {
        ll a, b;
        cin >> a >> b;
        if (chmin(res, b)) {
            ans = a+b;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7

def factorize(num: int) -> dict:
    """ 素因数分解 """
    from math import sqrt
    from collections import Counter

    d = Counter()
    for i in range(2, int(sqrt(num))+1):
        while num % i == 0:
            num //= i
            d[i] += 1
        if num == 1:
            break
    if num != 1:
        d[num] += 1
    return d

N = INT()

fact = factorize(N)
used = set()
for k in fact.keys():
    cnt = 1
    while fact[k] >= cnt:
        if (k, cnt) not in used:
            used.add((k, cnt))
            fact[k] -= cnt
        cnt += 1
ans = len(used)
print(ans)


Measured memory_bytes: 67952