akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;

    int cnt=0;
    REP(i,N){
        int a; cin>>a;
        if(a%2==1) cnt++;
    }

    if(cnt%2==0)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
    
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
	char w[16],t[1024];
	int cnt,flag,i,j,tmp;
	scanf("%s",w);
	cnt=0;
	while(1){
		scanf("%s",t);
		if(!strcmp(t,"END_OF_TEXT"))break;
		i=0;
		for(i=0;i<strlen(t);i++)if('A'<=t[i]&&t[i]<='Z')t[i]+='a'-'A';
		tmp=strlen(t)-strlen(w)+1;
		for(i=0;i<tmp;i++){
			if(i==0||t[i]==' '){
				if(i==0)i--;
				if(!strncmp(t+i+1,w,strlen(w))&&(t[i+1+strlen(w)]==' '||t[i+1+strlen(w)]=='\0'))cnt++;
				if(i==-1)i++;
			}	
		}
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 552
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  map<int,int> A;
  uint32_t B=0;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    A[a]++;
    B^=(uint32_t)a;
  }
  if(A.size()==3){
    int j=-1;
    uint32_t B=0;
    for(pair<int,int> p:A){
      if(j==-1)j=p.second;
      else if(j!=p.second){
        puts("No");
        return 0;
      }
      B^=(uint32_t)p.first;
    }
    if(B==0)puts("Yes");
    else puts("No");
  }else if(A.size()==2){
    if(A[0]==N/3)puts("Yes");
    else puts("No");
  }else if(A.size()==1){
    if(A.count(0))puts("Yes");
    else puts("No");
  }else puts("No");
}

Measured memory_bytes: 7252
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
    string s;cin>>s;
    int n = s.size();
    rep(i,n){
        if(s[i] == '9')s.replace(i,1,"1");
        else if(s[i] == '1')s.replace(i,1,"9");
    }
    cout<<s;
}



Measured memory_bytes: 256
r,c = gets.split(" ").map(&:to_i)
rs = Array.new(r+1).map{Array.new(c+1,0)}
r.times do |i|
  ti = gets.split(" ").map(&:to_i)
  rs[i][0,c] = ti
  rs[i][c] = ti.inject(:+)
end
rs[r] = rs.transpose.map{|j| j.inject(:+)}
(r + 1).times do |k|
  puts rs[k].join(" ")
end

Measured memory_bytes: 9024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int A,B; cin >> A >> B;
    char c[100][100];
    rep(i,50){
        rep(j,100){
            c[i][j]='#';
        }
    }
    rng(i,50,100){
        rep(j,100){
            c[i][j]='.';
        }
    }
    int cnt=A-1;
    for(int i=1;i<50;i+=2){
        for(int j=1;j<100;j+=2){
            if(cnt==0) break;
            c[i][j]='.';
            cnt--;
        }
        if(cnt==0) break;
    }
    cnt=B-1;
    for(int i=51;i<100;i+=2){
        for(int j=1;j<100;j+=2){
            if(cnt==0) break;
            c[i][j]='#';
            cnt--;
        }
        if(cnt==0) break;
    }
    cout << 100 << " " << 100 << endl;
    rep(i,100) {
        rep(j,100){
            cout << c[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
using namespace std;
#define N (1000000000+7)
typedef pair<int,int> P;
typedef long long ll;
int d[100010][3];
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
char board[1010][1010];

struct edge{
    int to,cost;
};

int a[105];


vector<edge>graph[100010];

int main(void){
    int n;
    while(true){
        cin>>n;
        if(n==0)break;
        int suma=0,sumb=0;
        for(int i=0;i<n;i++){
            cin>>a[i];
        }
        int ans=(int)abs(a[0]-a[1]);
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                if(i==j)continue;
                if(ans>(int)abs(a[i]-a[j]))ans=(int)abs(a[i]-a[j]);
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 5448
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mondai0066
{
	class Program
	{
		static void Main(string[] args)
		{
			var	s	= "";
			while( (s = Console.ReadLine()) != null ) {
				var	masu	= new char[ 3, 3 ];
				for( int i = 0; i < 9; i++ ) {
					masu[ i / 3, i % 3 ]	= s[ i ];
				}
				
				/*Console.WriteLine( "{0}{1}{2}", masu[ 0, 0 ], masu[ 0, 1 ], masu[ 0, 2 ] );
				Console.WriteLine( "{0}{1}{2}", masu[ 1, 0 ], masu[ 1, 1 ], masu[ 1, 2 ] );
				Console.WriteLine( "{0}{1}{2}", masu[ 2, 0 ], masu[ 2, 1 ], masu[ 2, 2 ] );*/

				Console.WriteLine( judge( masu ) );
			}
		}


		static char judge( char[,] masu )
		{
			// 横
			for( int i = 0; i < 3; i++ ) {
				var	m	= masu[ i, 0 ];
				if( (m == 'o') || (m == 'x') ) {
					if( (m == masu[ i, 1 ]) && (m == masu[ i, 2 ]) ) {
						return( m );
					}
				}
			}
			// 縦
			for( int i = 0; i < 3; i++ ) {
				var	m	= masu[ 0, i ];
				if( (m == 'o') || (m == 'x') ) {
					if( (m == masu[ 1, i ]) && (m == masu[ 2, i ]) ) {
						return( m );
					}
				}
			}
			// 斜め
			{
				var	m	= masu[ 0, 0 ];
				if( (m == 'o') || (m == 'x') ) {
					if( (m == masu[ 1, 1 ]) && (m == masu[ 2, 2 ]) ) {
						return( m );
					}
				}
			}
			{
				var	m	= masu[ 0, 2 ];
				if( (m == 'o') || (m == 'x') ) {
					if( (m == masu[ 1, 1 ]) && (m == masu[ 2, 0 ]) ) {
						return( m );
					}
				}
			}			
			
			return( 'd' );
		}
	}
}

Measured memory_bytes: 5228
#include<iostream>
#include<string>

int main(){
  std::string str;
  std::cin>>str;
  
  for(int i=0;i<3;i++){
    if(str[i]==str[i+1]){
      std::cout<<"Bad"<<std::endl;
      return 0;
    }
  }
  
  std::cout<<"Good"<<std::endl;
  
  return 0;
}

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

ll p = pow(10,9)+7;

// a^{p-2} = a{-1} (mod p)

ll H,W,A,B; 
ll kaijo[200010];
ll inv[200010];

ll expo(ll a,ll b){
  if(b==0){ return 1;}
  if(b%2==0){ ll d = expo(a,b/2); return (d*d)%p; }
  else{ return ( a * expo(a,b-1))%p; }
}
void cal_kaijo(){
  kaijo[0] = 1;
  inv[0] = 1;
  for(int i=1;i<=H+W;++i){
    kaijo[i] = (kaijo[i-1]*i)%p;
    inv[i] = expo(kaijo[i],p-2);
  }
}
ll comb(ll a,ll b){
  ll x = kaijo[a];
  x = (x*inv[b])%p;
  x = (x*inv[a-b])%p;
  return x;
}

int main(){
  cin>>H>>W>>A>>B;
  cal_kaijo();
  ll ans = 0;
  for(int i=A;i<=H-1;++i){
    ll x1,y1,x2,y2;
    x1 = B-1;
    y1 = H-i-1;
    x2 = W-B-1;
    y2 = i;
    ans += comb(x1+y1,x1)*comb(x2+y2,x2);
    ans %= p;
  }
  cout << ans <<"\n";
}


Measured memory_bytes: 3456
#include <iostream>
#include <algorithm>
#include <cstring>
#include <sstream>
using namespace std;
const int N = 300000;
int n,w[N],e[N],ans=N+1;
string s;
int main() {
	cin >> n >> s;
	for (int i = 0; i < n-1; i++) {
		if (s[i] == 'W')w[i + 1] = w[i] + 1;
		else w[i + 1] = w[i];
	}
	for (int i = n - 1; i > 0; i--) {
		if (s[i] == 'E')e[i - 1] = e[i] + 1;
		else e[i - 1] = e[i];
	}
	for (int i = 0; i < n; i++) {
		ans = min(ans, e[i] + w[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3076
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;


int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    ll ans=0;
    for(int i=0;i<n;i++){
        ll A,B;
        cin>>A>>B;
        ans+=A;
        a[i]=B+A;
    }
    sort(a.begin(),a.end(),greater<ll>());
    for(int i=1;i<n;i+=2){
        ans-=a[i];
    }
    cout<<ans<<endl;
    
    
    
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <unordered_map>
#include <vector>
#define ll long long int
using namespace std;

unordered_map<ll, ll> mp_itr;
vector<ll> destination(200005);
int main()
{

  ll n;
  ll k;
  cin >> n >> k;
  vector<ll> arr(n);
  for (ll i = 0; i < n; i++)
  {
    cin >> arr[i];
    arr[i]--;
  }

  ll h = 0, l = 0;
  ll itr = 1;
  ll start = 0;
  destination[0] = 0;
  mp_itr[0] = 0;
  for (ll i = 0; i <= n; i++)
  {

    destination[itr] = arr[start];
    if (mp_itr.count(destination[itr]))
    {
      l = mp_itr[destination[itr]];
      h = itr;
      break;
    }
    else
    {
      mp_itr[destination[itr]] = itr;
    }
    start = arr[start];
    itr++;
  }

  if (k < h)
  {
    cout << destination[k] + 1;
  }
  else
  {
    k = k - l;
    ll loop = h - l;
    k = k % loop;
    cout << destination[l + k] + 1;
  }

  return 0;
}

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

int main() {
int A,B,K;
cin >>A>>B>>K;
int c=min(A,B);
int cnt =0;
for (int i = c; i >=1 ; i--)
{
  if(A%i==0 && B%i==0) cnt++;
  if(cnt==K)
  {
    cout << i <<endl;
    break;
  }
}

  return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val ls0 = in(0).split(' ').map(_.toInt)
  val ls1 = in(1).split(' ').map(_.toInt)
  val T = in(2)//.split(' ').map(_.toInt)
  val K = ls0(1)
  val R = ls1(0)
  val S = ls1(1)
  val P = ls1(2)
  val N = T.size
  
  val t = (0 until N).map(_ => ' ').toArray
  
  var sum = 0
  (0 until N).foreach{ i =>
    val pt = T(i) match {
      case 'r' => P
      case 's' => R
      case 'p' => S
    }
    //println(pt, sum)
    if( i-K < 0 || (0 <= (i-K) && t(i-K) != T(i))){
      sum += pt
      t(i) = T(i)
    }
    //sum += pt
  }
  println(sum)
}



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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


void solve() {
    int i,j,k,l,r,x,y; string s;
    bool exit = false;
    int N,T;
    vector<int> c,t;
    cin>>N>>T;
    FOR(i,N){
        int input;
        cin>>input;
        c.push_back(input);
        cin>>input;
        if(input>T){
            c.erase(c.begin()+c.size()-1);//erase last
        }
    }
    if(c.size()==0){
        cout<<"TLE"<<endl;
        return;
    }
    sort(ALL(c));
    cout<<c[0]<<endl;

    /*cin>>N;
    vector<ll> V;
    FOR(x,N+1) {
            FOR(y,N+1) {
                    ll ret=1;
                    FOR(i,x) ret*=2;
                    FOR(i,y) ret*=5;
                    V.push_back(ret);
            }
    }
    sort(ALL(V));
    FORR(v,V) cout<<v<<endl;*/
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}



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

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let mut div = vec![1; N+1];
    let mut sieve  = vec![true; N+1];
    sieve[1] = false;
    let mut rem: Vec<usize> = (0..=N).collect();
    for i in 2..=N {
        if !sieve[i] {
            continue;
        }
        for j in (2*i..=N).step_by(i) {
            sieve[j] = false;
            let mut exp = 0;
            while rem[j] % i == 0 {
                rem[j] /= i;
                exp += 1;
            }
            div[j] *= exp+1;
        }
    }
    let mut ans = 0;
    for k in 1..=N {
        let fk = if k == 1 {
            1
        } else if div[k] == 1 {
            2
        } else {
            div[k]
        };
        ans += k * fk;
    }
    println!("{}", ans);
}


Measured memory_bytes: 168064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
  
int main(){
    ll mod=998244353;
    ll n,s;
    cin>>n>>s;
    vector<ll> a(n);
    rep(i,n)cin>>a[i];
    

    ll dp[3030][3030][3];
    dp[0][0][0]=1;
    rep(i,n){
        rep(j,s+1){
            (dp[i+1][j][0]+=dp[i][j][0])%=mod;
            (dp[i+1][j][1] += dp[i][j][0] + dp[i][j][1]) %= mod;
            (dp[i+1][j][2] += dp[i][j][0] + dp[i][j][1] + dp[i][j][2]) %= mod;
            if(j + a[i] <= s){
                (dp[i+1][j+a[i]][1] += dp[i][j][0] + dp[i][j][1]) %= mod;
                (dp[i+1][j+a[i]][2] += dp[i][j][0] + dp[i][j][1]) %= mod;
            }
        }
    }
    cout<<dp[n][s][2]<<endl;

    
    return 0;
}

Measured memory_bytes: 214912
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer tokenizer = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(tokenizer.nextToken());
        int k = Integer.parseInt(tokenizer.nextToken());
        long ans = 0;
        long num = n / k;
        ans = num * num * num;
        if (k % 2 == 0) {
            num = n / (k / 2) - num;
            ans += num * num * num;
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 24532
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
sa = sum(a)
sb = sum(b)
counta = 0
countb = 0
for i,j in zip(a,b):
    if j > i:
        if (j-i)%2:
            countb += 1
        counta += (j-i+1)//2
    elif i > j:
        countb += i-j
if counta <= sb-sa and countb <= sb-sa:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 10380
a_, b_, m = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
xyc = [[int(i) for i in input().split()] for _ in range(m)]
ans = 100000000
for x, y, c in xyc:
    ans = min(a[x-1] + b[y-1] - c, ans)
ans = min(min(a) + min(b), ans)
print(ans)

Measured memory_bytes: 32228
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int solve(){
    ll n;
    cin >>n;

    for(int i=30; i>=0; --i){
        ll x = (1<<i) - 1;
        if(x<=n) return i;
    }
}

int main(){
    cout << solve() << endl;
    return 0;
}



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

int main(){
	int n;
	scanf("%d",&n);
	int a[n],b[n];
	for(int i = 0;i < n;i++){
		scanf("%d",&a[i]);
		b[i] = a[i];
	}
	sort(a,a+n);
	int h = 1;
	int f = 0;
	for(int i = 0;i < n;i++){
		if(a[i]!=b[i]) f++;
		if(f > 2) h = 0;
	}
	if(h) printf("YES");
	else printf("NO");
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    A = LI()
    A = deque(sorted(A)[::-1])

    q = deque([A.popleft()])

    ans = 0
    while A:
        ans += q.popleft()
        a = A.popleft()
        q.extend([a, a])
    print(ans)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 32520
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cctype>
#include <cstdio>
#include <math.h>
using f32 = float;
using f64 = double;
using f80 = __float80;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vs = vector<string>;
using vl = vector<LL>;
using vvl = vector<vl>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
#define REP(i, n) for (LL i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
int main()
{
    int n,a=0,b,c;
    string A,B,C;
    cin >>n ;
    vector<int>p(n);
    REP(i,n)cin>>p[i];
  for(int j=n-1;0<j;j--){
      REP(i,j){
    if(p[i]>p[j]){
      swap(p[i],p[j]);
        a++;
    }
    if(a>=2){
        cout <<"NO";
        return 0;
       }
    }
  }
    cout << "YES";
    return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <set>
#include <deque>
#include <queue>
#include <bitset>
#include <stack>

#define mod 1000000007
#define INF2 9999999999
#define INF (1<<30)
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = __int64_t;

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

int n, res=0;
int h[25];

bool ok(int x){
  for(int i = 0; i < x; i++){
    if(h[x] < h[i]){
      return false;
    }
  }
  return true;
}

void solve(){
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> h[i];
  }
  for(int i = 0; i < n; i++){
    if(ok(i)){
      res++;
    }
  }
  cout << res << endl;
}

int main(){
  solve();
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int r = sc.nextInt();
		if(n >=10) {
			System.out.println(r);
		}else {
			System.out.println(100 *(10 -n) + r);
		}


	}
}

Measured memory_bytes: 22352
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
// #define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const int INF = (1LL<<30);
#else
const ll INF = (1LL<<60);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

int a[105], cnt[105];
signed main(void)
{
  int n;
  cin >> n;
  int ma = 0;
  REP(i, n) {
    int a;
    cin >> a;
    cnt[a]++;
    chmax(ma, a);
  }

  if(ma%2==0) {
    for(int i=ma; i>=0; --i) {
      if(i > ma/2) {
        if(cnt[i] < 2) {
          cout << "Impossible" << endl;
          return 0;
        }
      } else if(i == ma/2) {
        if(cnt[i] != 1) {
          cout << "Impossible" << endl;
          return 0;
        }
      } else {
        if(cnt[i]) {
          cout << "Impossible" << endl;
          return 0;
        }
      }
    }
  } else {
    for(int i=ma; i>=0; --i) {
      if(i > ma/2+1) {
        if(cnt[i] < 2) {
          cout << "Impossible" << endl;
          return 0;
        }
      } else if(i == ma/2+1) {
        if(cnt[i] != 2) {
          cout << "Impossible" << endl;
          return 0;
        }
      } else {
        if(cnt[i]) {
          cout << "Impossible" << endl;
          return 0;
        }
      }
    }
  }
  cout << "Possible" << endl;

  return 0;
}


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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;i++)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;i++)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

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


#define int ll

const int inf = 1ll<<62;
const int mod = 1e9+7;

main(){
  int n,x; cin >> n >> x;
  vi m(n); rep(i,n) cin >> m[i];
  sort(all(m));
  int ans = n;
  x -= SUM(m);
  ans += x / m[0];
  cout << ans << endl;
}

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;

const ll MAX = 300000;
const ll MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  // 前処理
  COMinit();
  
  ll n,a,b;
  cin >> n >> a >> b;
  // 2^n 計算
  ll nn = n;
  ll n2 = 1;
  ll tmp = 2;
  while(nn) {
    if (nn&1) n2 = n2 * tmp % MOD;
    tmp = tmp * tmp % MOD;
    nn /= 2;
  }
  ll ans = n2 - 1;
  if (ans < 0) ans += MOD;
  // COM(n,a)
  ll nca = 1;
  REP(i,a) {
    nca = nca * (n-i) % MOD;
  }
  nca = nca * finv[a] % MOD;
  // COM(n,b)
  ll ncb = 1;
  REP(i,b) {
    ncb = ncb * (n-i) % MOD;
  }
  ncb = ncb * finv[b] % MOD;
  ans -= nca;
  if ( ans<0) ans += MOD;
  ans -= ncb;
  if ( ans<0) ans += MOD;
  cout << ans << endl;
//  cout << n2 << " " << nca << " " << ncb << endl;
}


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

int main()
{
	int n;
	cin >> n;
	vector<vector<int> > gain(n, vector<int> (3));
	for(int i=0;i<n;i++)
	{
		cin >> gain[i][0] >> gain[i][1] >> gain[i][2];
	} 
	vector<vector<int> > dp(n, vector<int> (3));
	dp[0][0] = gain[0][0];
	dp[0][1] = gain[0][1];
	dp[0][2] = gain[0][2];
	for(int i=1;i<n;i++)
	{
		dp[i][0] = gain[i][0] + max(dp[i-1][1], dp[i-1][2]);
		dp[i][1] = gain[i][1] + max(dp[i-1][0], dp[i-1][2]);
		dp[i][2] = gain[i][2] + max(dp[i-1][0], dp[i-1][1]);
	}
	cout << max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2])) << endl;
	return 0; 
}


Measured memory_bytes: 11136
import java.util.*;

public class Main {
    static int A = 0;
    static int C = 1;
    static int G = 2;
    static int T = 3;
    static long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        // A => 0, C => 1, G => 2, T => 3
        // AGC, ACG, GAC
        // 021, 012, 201

        // dp[n][i][i - 1][i - 2]

        long[][][][] dp = new long[N][4][4][4];

        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                for (int k = 0; k < 4; k++) {
                    if ((i == 0 && j == 2 && k == 1) || (i == 0 && j == 1 && k == 2) || (i == 2 && j == 0 && k == 1)) {
                        dp[2][k][j][i] = 0;
                    } else {
                        dp[2][k][j][i] = 1;
                    }
                }
            }
        }


        // A => 0, C => 1, G => 2, T => 3
        // おしり <- CGA, GCA, CAG
        //          120, 210, 102

        // dp[n][i][i - 1][i - 2]

        for (int n = 3; n < N; n++) {
            for (int i = 0; i < 4; i++) {
                for (int j = 0; j < 4; j++) {
                    for (int k = 0; k < 4; k++) {
                        for (int l = 0; l < 4; l++) {
//                            System.out.println((isValid(i, j, k, l) ? "isValid" : "isNotValid") + ".... i:" + i + " ,j:" + j + " , k:" + k + ", l:" + l);

                            if (isValid(k, j, i, l)) {
                                dp[n][k][j][i] += dp[n - 1][j][i][l];
                                dp[n][k][j][i] %= MOD;
                            }
                        }
                    }
                }
            }
        }

        long count = 0;
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                for (int k = 0; k < 4; k++) {
                    count += dp[N - 1][k][j][i];
                    count %= MOD;
                }
            }
        }

        System.out.println(count);
    }

    static boolean isValid(int k, int j, int i, int l) {
        // AGC, ACG, GAC
        if ((i == A && j == G && k == C)
                || (i == A && j == C && k == G)
                || (i == G && j == A && k == C)
        ) {
            return false;
        } else if ((k == C && j == G && l == A) || (k == C && i == G && l == A)) {
            // 4文字
            return false;
        } else {
            return true;
        }
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
const auto start_time = std::chrono::high_resolution_clock::now();
void timecalculater(){
    #ifndef ONLINE_JUDGE
    auto end_time = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
    #endif
}
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a,v) memset(a, v, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll p=1e9+7;
const int N=2e5+5;
int main() {
   
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int T=1;
    // cin>>T;
    while(T--){
        ll x;cin>>x;
        ll ans=1;
        double a,b;
        a=101;
        b=100;
        double u=a/b;
        ll s=100;
        while(1){
            ll val=s*u;
            // u=u*101;
            // u=u/100;
            s=val;
            if(val>=x){
                cout<<ans;return 0;
            }
            ans++;
        }
    }   
    timecalculater();
    return 0;   
} 

Measured memory_bytes: 3656
// コイン問題
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cassert>

#include<vector>
#include<queue>
#include<set>

using namespace std;

const int INF = 100000;
const int MAX_N = 50000;
const int MAX_M = 20;

// コインの額面を保持する配列
// １を開始とする配列
int C[MAX_N + 1];
// コインの枚数を保持する配列
int T[MAX_M + 1][MAX_N + 1];

int n, m;

int CoinProblem();

int main(void)
{
    int coin;

    // 配列の初期化
    for(int i = 0; i < MAX_M + 1; i++)
    {
        for(int j = 0; j < MAX_N + 1; j++)
        {
            if( j == 0 )
            {
                T[i][j] = 0;
            }
            else
            {
                // 初期値の設定
                T[i][j] = INF;
            }
        }
    }

    cin >> n >> m;

    for(int i = 1; i <= m; i++)
    {
        // 要素数：１からコインの要素を入れていく
        cin >> coin;
        C[i] = coin;
    }

    // 動的計画法の実施
    CoinProblem();

    int min = INF;

    for( int i = 1; i <= m; i++)
    {
        if( min > T[i][n] )
        {
            min = T[i][n];
        }
    }

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

    return 0;
}

// コイン問題を解く関数
int CoinProblem()
{
    for(int j = 0; j <= n; j++)
    {
        for(int i = 1; i <= m; i++)
        {
            int num = j - C[i];

            if( num >= 0 )
            {
                // i番目のコインを使う時
                T[i][j] = T[i][num] + 1;
            }
            else
            {
                // i番目のコインを使わない時
                T[i][j] = T[i - 1][j];
            }

            // コインの枚数が少ない方を設定する
            T[i][j] = min(T[i - 1][j], T[i][j]);
        }
    }

    return 0;
}



Measured memory_bytes: 7320
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
using namespace std;
namespace Solve
{
	int N,R;
	void work()
	{
		scanf("%d%d",&N,&R);
		if(N>=10) printf("%d\n",R);
		else printf("%d\n",R+100*(10-N));
		return;
	}
}
int main()
{
	#ifdef LOCAL
	freopen("00test.in","r",stdin);
	freopen("00test.out","w",stdout);
	#endif
	Solve::work(); 
	return 0;
}

Measured memory_bytes: 256
var input = require( 'fs' ).readFileSync( '/dev/stdin' ).toString();
  var data = input.split( " " ).map( Number );
  var a = data[0];
  var b = data[1];
  var C = data[2]*(Math.PI/180);
  var h = Math.sin( C )*b;
  var S = (a*h)/2;
  var ta = (a-Math.cos( C )*b);
  var L = a+b+Math.sqrt( Math.pow( ta,2 )+Math.pow( h, 2) );
  console.log( S+'\n'+L+'\n'+h );

Measured memory_bytes: 15588
#include <stdio.h>
#include <string.h>

int main(void)
{
	int i;
	int n;
	char b[3];
	int bt[4] = {};
	
	while(scanf("%d,%s", &n, &b) != EOF) {
		switch(b[0]) {
			case 'A': {
				if(strlen(b) == 1) bt[0]++;
				else bt[2]++;
			} break;
			case 'B': bt[1]++; break;
			case 'O': bt[3]++; break;
		}
	}
	for(i = 0; i < 4; i++) {
		printf("%d\n", bt[i]);
	}
	
	return 0;
}


Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
#define eprintf(...) fprintf(stderr,__VA_ARGS__)

const int N=int(1e5)+5;

int n;

ll ans,a[N],b[N];

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld%lld",&a[i],&b[i]);
	ll d=0;
	for(int i=n;i>=1;i--)
		d+=(b[i]-(a[i]+d)%b[i])%b[i];
	printf("%lld\n",d);
}


Measured memory_bytes: 1792
#include "stdio.h"

int main(void){
    int n, i;
    scanf("%d", &n);
    int a[] = {111,222,333,444,555,666,777,888,999};
    for(i=0; i<9; i++)
        if(n<=a[i]){
            printf("%d", a[i]);break;}
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll p=pow(10,9)+7;
ll phi(ll n) {
    ll result = n;
    for (ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            while(n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if(n > 1)
        result -= result / n;
    return result;
}
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      
    x = x % p;  
   while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
} 
 
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
}
 
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,n,k,i,j,m,a,b;
    char arr[6];
    for(i=0;i<6;i++)
    cin>>arr[i];
    if(arr[2]==arr[3]&&arr[4]==arr[5])
    cout<<"Yes";
    else
    cout<<"No";
    
    return 0;
 
    
}
    


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    ll maxi = 0;
    rep(i, N) {
        cin >> A[i];
        maxi = max(maxi, A[i]);
    }
    ll l = 1, r = maxi;
    do {
        ll key = (l + r) / 2;
        ll temp = 0;
        iter(i, A) temp += i / key + !!(i % key) - 1;
        if(temp <= K) r = key - 1;
        else l = key + 1;
    } while(l <= r);
    cout << l << endl;
    return 0;
}


Measured memory_bytes: 4764
#include <algorithm>
#include <iostream>
#include <string.h>
#include <vector>
#include <queue>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define lb long double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

const int N=1<<19;

int n;
int a[N],mx[N];
PII val[N];

PII merge(PII x,PII y) {
    vector<PII> vec;
    if (x.first>-1) vec.pb(mp(a[x.first],x.first));
    if (x.second>-1) vec.pb(mp(a[x.second],x.second));
    if (y.first>-1) vec.pb(mp(a[y.first],y.first));
    if (y.second>-1) vec.pb(mp(a[y.second],y.second));
    sort(vec.begin(),vec.end());
    vec.assign(vec.begin(),unique(vec.begin(),vec.end()));
    reverse(vec.begin(),vec.end());
    PII ret=mp(vec[0].second,vec[1].second);
    return ret;
}

int main()
{
    scanf("%d",&n);
    for (int i=0;i<(1<<n);i++) {
        scanf("%d",a+i);
        val[i].first=i;
    }
    for (int i=0;i<n;i++) {
        for (int j=0;j<(1<<n);j++) {
            val[j|(1<<i)]=merge(val[j],val[j|(1<<i)]);
        }
    }
    for (int i=1;i<(1<<n);i++) {
        mx[i]=a[val[i].first]+a[val[i].second];
        if (i>0) mx[i]=max(mx[i],mx[i-1]);
        printf("%d\n",mx[i]);
    }
}

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

using namespace std;
typedef long long ll;

int main(){
  int N;
  cin >> N;
  int a = N % 10;
  string ret = "hon";
  switch(a){
    case 0:
    case 1:
    case 6:
    case 8:
      ret = "pon";
      break;
    case 3:
      ret = "bon";
      break;
  }
  
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>
int main(void){
    // Your code here!
    char ch;
    int x,c[26]={};
    while(scanf("%c",&ch)!=EOF){
        if(ch >= 'A' && ch <= 'Z'){
            x = ch - 'A';
            c[x]+=1;
        }
        else if(ch >= 'a' && ch <= 'z'){
            x = ch - 'a';
            c[x]+=1;
        }
    }
    for(x=0,ch='a'; x<26; x++,ch++){
        printf("%c : %d\n",ch,c[x]);
    }
}



Measured memory_bytes: 2144
#include <iostream>
#include <string>

using namespace std;
int main (){
    string sa,sb,sc;
    cin >> sa >> sb >> sc;

    int na=sa.size();
    int nb=sb.size();
    int nc=sc.size();
    int ia=0;
    int ib=0;
    int ic=0;
    int turn=0;
    while(true){
        if(turn==0){
            ia++;
            if(ia==na+1){
                cout << "A\n";
                return 0;
            }
            turn=sa[ia-1]-'a';
        }
        else if(turn==1){
            ib++;
            if(ib==nb+1){
                cout << "B\n";
                return 0;
            }
            turn=sb[ib-1]-'a';
        }
        else{
            ic++;
            if(ic==nc+1){
                cout << "C\n";
                return 0;
            }
            turn=sc[ic-1]-'a';
        }
    }


}

Measured memory_bytes: 256
/*
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>

#include<stdio.h>
#include<stdlib.h>

#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}

using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

ll factor(ll x) {
	ll ret = 1;
	ll tmp = 0;
	for (ll p = 2;;p++) {
		if (x == 1) {
			ret *= tmp + 1;
			break;
		}
		if (x % p == 0) {
			tmp += 1;
			x /= p;
			p--;
			continue;
		}
		ret *= tmp + 1;
		tmp = 0;
	}
	return ret;
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start

	ll N;
	cin >> N;
	ll ans = 0;

	for (ll i = 1; i <= N; i++) {
		ll ret = factor(i);
		ll tmp = ret;
		ans += i * tmp;
	}

	cout << ans << endl;



EndPoint:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG

	return 0;
}


*/

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>

#include<stdio.h>
#include<stdlib.h>

#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}

using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	char c;
	cin >> c;

	if ('a' <= c) {

		cout << "a" << endl;
	}
	else {
		cout << "A" << endl;
	}


EndPoint:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG

	return 0;
}




Measured memory_bytes: 3076
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int sum(int n);

int main()
{
	int n;
	
	cin >> n;
	
	vector<int> x(n), y(n);
	double ans = 0;

	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];

		for (int j = 0; j < i; j++) {
			ans += sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
		}
	}
	
	if (n == 2) {
		printf("%.10f\n", ans);
	}
	else {
		printf("%.10f\n", ans * (n - 1) / (double)sum(n-1));
	}

	return 0;
}

int sum(int n)
{
	return (int)(n * (n + 1) * 0.5);
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main(){
  long n,a,b,l,r;
  scanf("%ld %ld %ld",&n,&a,&b);
  if(n==1&&a!=b||a>b){
    printf("0\n");
  }
  else if(n==1)
    printf("1\n");
  else{
    l=a*(n-1)+b;
    r=b*(n-1)+a;
    printf("%ld\n",r-l+1);
  }
  
}

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

int main(){
  int N,M;
  cin >> N >> M ;
    
  vector<int> p(N);
  
  for (int j=0;j<M;j++){
    int m=0;
    cin >> m;
    int d = 0;
    //vector<int> v(m);
    for (int i=0;i<m;i++){
      cin >> d;
      //v.push_back(d)
      p[d-1]=1;
    }
  }
  int out=0;
  for(int x :p){
    if (x==0){
      out+=1;
    }
  }
  cout << out << endl;  
  return 0;
}

 


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

using namespace std;
#define sf(n) scanf("%d", &n)
#define pd(n) printf("%.12lf", n)
#define pf(n) printf("%d", n)
#define p() printf("\n")
#define ps() printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define mod 1000 * 1000 * 1000 + 7
#define pi 3.1415926536
#define ex 1e18
#define dbl 2e09
#define qu(q) queue<int> q
#define pqu(q) priority_queue<int> q
#define len(s) s.length()
#define sz(x) int(x.size())
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fir first
#define sec second

const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

int a[100005], l[100005], r[100005];

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

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    l[0] = a[0];
    for (int i = 1; i < n; ++i)
        l[i] = gcd(a[i], l[i - 1]);
    r[n - 1] = a[n - 1];
    for (int i = n - 2; i >= 0; --i)
        r[i] = gcd(a[i], r[i + 1]);

    int ans = 1;
    for (int i = 0; i < n; ++i)
    {
        if (i == 0)
            ans = max(ans, r[i + 1]);
        else if (i == n - 1)
            ans = max(ans, l[i - 1]);
        else
            ans = max(ans, gcd(l[i - 1], r[i + 1]));
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main()
{
    string s;
    cin>>s;
    int ctr=0;
    int ans=0;
    for(int i=0;i<s.size();++i){
        if(s[i]=='R') ctr++;
        else{
            ans = max(ans, ctr);
            ctr=0;
        }
    }
    ans = max(ctr, ans);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3596
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
from operator import mul


sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

s = S()
t = S()
if t[:-1] == s:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 81172