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

#define M  1000
#define M_1 10000


int n, A[M], s;
int b[M], T[M_1 + 1];


int partition(int A[], int l, int r){
  int i, j;
  int t, x;
  x = A[r];
  i = l - 1;

  for( j = l ; j < r ; j++ ){
    if(A[j] <= x){
      i++;
      t = A[i];
      A[i] = A[j];
      A[j] = t;
    }
  }

  t = A[i + 1];
  A[i + 1] = A[r];
  A[r] = t;

  return i + 1;
}
void quickSort(int A[], int l, int r){
  int q;
  if(l < r){
    q = partition(A, l, r);
    quickSort(A, l, q - 1);
    quickSort(A, q + 1, r);
  }
}


int solve(){
  int i, cur, S, m, an, v,   ans = 0 ;

  int V[M];
  for(i = 0 ; i < n ; i++){
    b[i] = A[i];
    V[i] = 0;
  }

  quickSort(b, 0, n - 1);

  for(i = 0 ; i < n ; i++) T[b[i]] = i;
  for(i = 0 ; i < n ; i++){
    if(V[i]) continue;
    cur = i;
    S = 0;
    m = M_1;
    an = 0;
    while(1){
      V[cur] = 1;
      an++;
      v = A[cur];

      if(v < m) m = v;

      S += v;
      cur = T[v];
      if(V[cur]) break;
    }
    if(S + (an -2) * m < m + S + (an + 1) * s) ans += S + (an -2) * m;
    else ans +=  m + S + (an + 1) * s;
  }
  return ans;
}



int main(){
  int i;

  scanf("%d", &n);
  s = M_1;
  for(i = 0 ; i < n ; i++){
    scanf("%d", &A[i]);
    if(A[i] < s) s = A[i];
  }

  int ans = solve();
  printf("%d\n", ans);

  return 0;
}



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

#define ll long long
#define ld long double
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define IOS ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define MOD 1000000007
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl

ll frog(vector<ll> &v,vector<ll> &dp,ll i)
{
    if(i==0)
        return 0;
    if(i==1)
        return abs(v[i]-v[i-1]);

    if(dp[i]!=-1)
        return dp[i];

    return dp[i] = min(abs(v[i]-v[i-1])+frog(v,dp,i-1),abs(v[i]-v[i-2])+frog(v,dp,i-2));
}

int main(){

    IOS;

    ll t,n,k,m;
    t=1;
    while(t--)
    {
        cin >> n;
        vector<ll> v(n);
        vector<ll> dp(n,-1);
        for(ll i=0;i<n;i++)
            cin >> v[i];

        ll ans = frog(v,dp,n-1);
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 4992
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(long long i=(a);i<(b);++i)
#define per(i,a,b) for(long long i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

int main() {
  ll n;
  cin>>n;
  vector<ll> v;
  ll total = 0;
  rep(i,0,n){
    ll a;
    cin>>a;
    v.pb(a);
    total += a;
  }
  ll a = 0;
  ll b = total;
  ll mn = 1000000000000000000LL;
  rep(i,0,v.sz-1){
    a += v[i];
    b -= v[i];
    mn = min(mn,abs(a-b));
  }
  printf("%lld\n",mn);
  return 0;
}

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

int main(){
  long A,B,K;cin>>A>>B>>K;
  long Ao,Taka;
  if(K<=A){
    Ao=A-K;
    Taka=B;
  }
  else if(K<=A+B){
    Ao=0;
    Taka=A+B-K;
  }
  else{
    Ao=0;
    Taka=0;
  }
  cout<<Ao<<" "<<Taka<<endl;
}


Measured memory_bytes: 3572
#include <cstdio>
#include <algorithm>
using namespace std;

int N, a[105];
int gray, brown, green, cyan, blue, yellow, orange, red, self;
int mini, maxi;

int main() {
    scanf("%d", &N);
    for (int i = 0; i != N; ++i) scanf("%d", &a[i]);
    for (int i = 0; i != N; ++i) {
        if (a[i] >= 3200) ++self;
        else if (2800 <= a[i] && a[i] < 3200) ++red;
        else if (2400 <= a[i] && a[i] < 2800) ++orange;
        else if (2000 <= a[i] && a[i] < 2400) ++yellow;
        else if (1600 <= a[i] && a[i] < 2000) ++blue;
        else if (1200 <= a[i] && a[i] < 1600) ++cyan;
        else if (800 <= a[i] && a[i] < 1200) ++green;
        else if (400 <= a[i] && a[i] < 800) ++brown;
        else if (1 <= a[i] && a[i] < 400) ++gray;
    }
    if (gray) ++mini, ++maxi;
    if (brown) ++mini, ++maxi;
    if (green) ++mini, ++maxi;
    if (cyan) ++mini, ++maxi;
    if (blue) ++mini, ++maxi;
    if (yellow) ++mini, ++maxi;
    if (orange) ++mini, ++maxi;
    if (red) ++mini, ++maxi;
    mini = max(mini, (int)!!self); maxi += self;
    printf("%d %d\n", mini, maxi);
    return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  string s;
  cin >> s;

  int r = 0;
  F0R(i, s.size() / 2) {
    if (s[i] != s[s.size() - i - 1]) r++;
  }
  cout << r;
}
#endif


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
S = [0]
for i in range(N):
	S.append(S[i] + A[i])
S.sort()
cont = 0
ans = 0
for i in range(N + 1):
	if i >= 1 and S[i] != S[i - 1]:
		cont = 0
	ans += cont
	cont += 1
print(ans)

Measured memory_bytes: 26000
#include <bits/stdc++.h>
//#include <cmath>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mod 1000000007
//#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define bs(yup,x) binary_search(yup.begin(),yup.end(),x) //it will return bollean value
#define lb(yup,x) lower_bound(yup.begin(),yup.end(),x)  //it will return the adress of the number which is equal to or just greater than x ,and if it is equal to yup.end() than their in no such number exist
#define ub(yup,x) upper_bound(yup.begin(),yup.end(),x)
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
using namespace std;
const long long N=1000001, INF=2000000000000000000;
const long double EPS= 0.000000000001;
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }
vi prime;
bool isprime[N];
void pre()
{
    for(int i=2;i<N;i++)
    {
        if(isprime[i])
        {
            for(int j=i*i;j<N;j+=i)
            isprime[j]=false;
            prime.pb(i);
        }
    }
    return;
}

bool isPerfectSquare(long double x) 
{   
  // Find floating point value of  
  // square root of x. 
  long double sr = sqrt(x); 
  
  // If square root is an integer 
  return ((sr - floor(sr)) == 0); 
} 
// Function to count divisors 
int countDivisors(int n) 
{ 
    int ans=1;
    int sz=prime.size();
    for(int i=0;i<sz;i++)
    {
        if(pow(prime[i],3)>n) break;
        int count=1;
        while(n%prime[i]==0)
        {
            n/=prime[i];
            count++;
        }
        ans*=count;
    }
    long double qwer=n;
    if(binary_search(all(prime),n))
        {
            ans*=2;
        }
        else if(isPerfectSquare(qwer)&&binary_search(all(prime),sqrt(n)))
        {
            ans*=3;
        }
        else if(n!=1) ans*=4;
    return ans;
} 

 
int32_t main()
{
    
    IOS;
    fill(isprime, true);
    pre();
   int n;
   cin>>n;
   int ans=0;
   for(int i=1;i<n;i++)
   {
       int w=n-i;
       ans+=countDivisors(w);
   }
   cout<<ans;
 
}




Measured memory_bytes: 5216
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,n,i;
	int min=0x7fffffff,max=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a);
		if(min>a)
			min=a;
		if(max<a)
			max=a;
	}
	printf("%d",max-min);
	return 0;
}

Measured memory_bytes: 256
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())


N = I()

# 反時計まわりに45度回転させて考える

A,B = [],[]
for i in range(N):
    x,y = MI()
    if i == 0:
        A.append(x-y)
        B.append(x+y)
        r = (x-y) % 2
    else:
        if (x-y) % 2 != r:
            print(-1)
            exit()
        A.append(x-y)
        B.append(x+y)

if r == 1:
    ANS = [[''] * 31 for _ in range(N)]
    for i in range(N):
        a, b = A[i], B[i]
        for j in range(30, -1, -1):
            if a > 0 and b > 0:
                a -= 2 ** j
                b -= 2 ** j
                ANS[i][j] = 'R'
            elif a > 0 and b < 0:
                a -= 2 ** j
                b += 2 ** j
                ANS[i][j] = 'D'
            elif a < 0 and b > 0:
                a += 2 ** j
                b -= 2 ** j
                ANS[i][j] = 'U'
            else:
                a += 2 ** j
                b += 2 ** j
                ANS[i][j] = 'L'
    print(31)
    print(*[2 ** i for i in range(31)])
    for i in range(N):
        print(''.join(ANS[i]))

else:
    ANS = [[''] * 31 + ['R'] for _ in range(N)]
    for i in range(N):
        a, b = A[i] - 1, B[i] - 1
        for j in range(30, -1, -1):
            if a > 0 and b > 0:
                a -= 2 ** j
                b -= 2 ** j
                ANS[i][j] = 'R'
            elif a > 0 and b < 0:
                a -= 2 ** j
                b += 2 ** j
                ANS[i][j] = 'D'
            elif a < 0 and b > 0:
                a += 2 ** j
                b -= 2 ** j
                ANS[i][j] = 'U'
            else:
                a += 2 ** j
                b += 2 ** j
                ANS[i][j] = 'L'
    print(32)
    print(*([2 ** i for i in range(31)] + [1]))
    for i in range(N):
        print(''.join(ANS[i]))


Measured memory_bytes: 74728
while True:	
	a, op, b = input(). split()
	a = int(a)
	b = int(b)
	if op == "+":
		print(a + b)
	elif op == "-":
		print(a - b)
	elif op == "*":
		print(a * b)
	elif op == "/":
		print(a // b)
	elif op == "?":
		break

Measured memory_bytes: 7604
x, y = map(int, input().split())
a = [1,3,5,7,8,10,12]
b = [4, 6, 9, 11]
c = [2]

r = 'No'
if x in a and y in a:
  r = 'Yes'
if x in b and y in b:
  r = 'Yes'
if x in c and y in c:
  r = 'Yes'
  
print(r)

Measured memory_bytes: 3060
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}

int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	set<int>S;
	for(int i=0;i<c;i++){
		if(a+i<=b)S.insert(a+i);
		if(b-i>=a)S.insert(b-i);
	}
	for(set<int>::iterator it=S.begin();it!=S.end();it++){
		printf("%d\n",*it);
	}
}

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

using namespace std;

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

vector<bool> D(10, false);

bool checkNum(int i) {
  while (i != 0) {
    if (D[i % 10]) {
      return false;
    }
    
    i /= 10;
  }
  
  return true;
}

int main() {
  int N, K;
  
  cin >> N >> K;
  
  REPEAT(i, K) {
    int d;
    
    cin >> d;
    
    D[d] = true;
  }
  
  int ans = 0;
  
  for (int i = N; i <= 10 * N; i++) {
    if (checkNum(i)) {
      ans = i;
      break;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res

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)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n = I()

    return

#B
def B():
    n = I()

    return

#C
def C():
    n,m = LI()
    a = LI()
    for i in range(n):
        a[i] -= 1
    b = [0]*(m+10)
    ans = 0
    f = [0]*(m+10)
    for i in range(n-1):
        r = (a[i+1]-a[i])%m
        ans += r
        if r < 2:
            continue
        if a[i+1] >= (a[i]+2)%m:
            f[(a[i]+2)%m] += 1
            b[(a[i]+2)%m] += 1
            b[a[i+1]+1] -= 1
            f[a[i+1]+1] -= r
        else:
            b[0] += 1
            f[0] += (-a[i]-1)%m
            b[a[i+1]+1] -= 1
            f[a[i+1]+1] -= r
            b[a[i]+2] += 1
            f[a[i]+2] += 1
            b[m] -= 1
    for i in range(m-1):
        b[i+1] += b[i]
    for i in range(m-1):
        f[i+1] += f[i]+b[i]
    print(ans-max(f))
    return

#D
def D():
    n = I()

    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return

#Solve
if __name__ == "__main__":
    C()


Measured memory_bytes: 53344
n,x=map(int,input().split())
xx=list(map(int,input().split()))
xx.append(x)
xx.sort()
y=[]
from fractions import gcd

for i in range(n):
    y.append(xx[i+1]-xx[i])
w=y[0]
for i in y[1:]:
    w=gcd(w,i)
print(w)

Measured memory_bytes: 86676
#![allow(unused_imports, unused_variables, dead_code)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

trait InputValue {
    fn parse(s: &str) -> Self;
}

fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

fn main() {
    let (x, y): (i64, i64) = read();
    if (x-y).abs() <= 1 {
        println!("Brown");
    } else {
        println!("Alice");
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#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 REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> m(h + 2, vector<char>(w + 2, '.'));
    REP1(i, h) REP1(j, w) cin >> m[i][j];

    vector<int> x{-1, 0, 1, 0};
    vector<int> y{0, 1, 0, -1};

    deque<pair<int, int>> q;
    q.emplace_back(1, 1);
    m[1][1] = '.';
    int r, c;
    while (!q.empty()) {
        tie(r, c) = q.front(); q.pop_front();
        int d = 0;
        REP(k, 4) {
            if (k == 0 || k == 3) {
                if (m[r + x[k]][c + y[k]] == '#') {
                    cout << "Impossible" << endl;
                    return;
                }
            }
            if (m[r + x[k]][c + y[k]] == '#') {
                d++;
                q.emplace_back(r + x[k], c + y[k]);
                m[r + x[k]][c + y[k]] = '.';
            }
        }
        if (d > 1) {
            cout << "Impossible" << endl;
            return;
        }
    }
    cout << "Possible" << endl;
}



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

using namespace std;

bool possible(long long longestLog, const vector<long long>& A, long long K) {
    long long N = A.size();
    long long numOfLongestLogs = 0;
    for (long long i = 0; i < N; ++i) {
        numOfLongestLogs += A[i] / longestLog;
        if (A[i] % longestLog == 0) {
            --numOfLongestLogs;
        }
    }
    return (numOfLongestLogs <= K);
}

void Main() {
    long long N, K;
    cin >> N >> K;
    vector<long long> A(N, 0LL);
    for (long long i = 0; i < N; ++i) {
        cin >> A[i];
    }
    sort(A.begin(), A.end(), greater<long long>());

    long long ub = A.front();
    long long lb = 1LL;
    while (ub - lb > 1LL) {
        long long mid = (ub + lb) / 2LL;
        if (possible(mid, A, K)) {
            ub = mid;
        }
        else {
            lb = mid;
        }
    }
    bool test = possible(lb, A, K);
    if (test) {
        cout << lb << endl;
    }
    else {
        cout << ub << endl;
    }
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 4796
while True:
    h, w = map(int, input().split())
    ans = []
    if h == 0 & w == 0:
        break
    else:
        for i in range(h):
            for j in range(w):
                if i == 0 or j == 0 or i == h - 1 or j == w -1:
                    print("#", end="")
                else:
                    print(".",end="")
            print("")
        print("")


Measured memory_bytes: 7016
#include <iostream>

using namespace std;

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

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;
 
signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
 
  int N, M;
  cin >> N >> M;
  pair<int, string> P[M];
  rep(i,M){
    cin >> P[i].first >> P[i].second;
    --P[i].first;
  }
  bool ok[N]{};
  int pen[N]{};
  int pena = 0, AC = 0;
  rep(i,M){
    if(!ok[P[i].first]){
      if(P[i].second == "WA") pen[P[i].first]++;
      if(P[i].second == "AC"){
        ok[P[i].first] = true;
        pena += pen[P[i].first];
        AC++;
      }
    }
  }
  cout << AC << ' ' << pena << endl;
}

Measured memory_bytes: 7424
#include <algorithm>
#include <iostream>

int main(int argc, char *argv[]) {
  std::string s;
  std::cin >> s;
  std::sort(s.begin(), s.end());
  char x = 'A';
  for (auto &c : s) {
    if (c == x) {
      std::cout << "no" << std::endl;
      return 0;
    }
    x = c;
  }
  std::cout << "yes" << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    string in; cin >> in;
    int n = in.size();

    string T1 = in.substr(0, n / 2);
    string T2 = in.substr(n / 2 + 1);

    bool ok = true;
    for(auto S : {in, T1, T2}){
        string rev = S; reverse(_all(rev));
        ok &= (S == rev);
    }

    cout << (ok ? "Yes":"No") << endl;

    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=1;i<=(n);++i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define DUMP(x) cout<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;

const int INF = (int)1e9;
struct edge{int to, cap, rev;};

int used[205];
vector<edge> G[205];

void add_edge(int from, int to, int cap){
    G[from].pb({to, cap, (int)G[to].size()});
    G[to].pb({from, cap, (int)G[from].size()-1});
}

int dfs(int v, int t, int f){
    if(v==t) return f;
    used[v] = 1;
    for(auto &e : G[v]){
        if(!used[e.to] and e.cap>0){
            int d = dfs(e.to, t, min(f, e.cap));
            if(d>0){
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

int max_flow(int s, int t){
    int flow = 0;
    while(true){
        memset(used, 0, sizeof(used));
        int f = dfs(s, t, INF);
        if(f==0) return flow;
        flow += f;
    }
}

class FLotusLeaves {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ios_base::sync_with_stdio(false);
	    int H, W;
	    in>>H>>W;
	    RREP(i, H){
	        RREP(j, W){
	            char c;
	            in>>c;
	            if(c=='S') add_edge(0, i, INF), add_edge(0, H+j, INF);
	            else if(c=='T') add_edge(i, H+W+1, INF), add_edge(H+j, H+W+1, INF);
	            else if(c=='o') add_edge(i, H+j, 1);
	        }
	    }
	    int ans = max_flow(0, H+W+1);
	    if(ans>=INF) out<<"-1\n";
	    else out<<ans<<'\n';
	}
};


int main() {
	FLotusLeaves solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n; cin >> n;
  ll ans = 0;
  ll m = n;
  while(m > 0) {
    ans += m%10;
    m /= 10;
  }
  cout << (n%ans==0 ? "Yes" : "No") << "\n";
  return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e18)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))




int main(){
	
	ll N;
	cin >> N;
	vector<double> v(N);
	FOR(i,0,N)cin >> v[i];
	SORT(v);
	FOR(i,1,N){
		v[i] = (v[i]+v[i-1])/2.0;
	}
	out(10) << v[N-1] << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int week = scan.nextInt();
		double num = 100000;
		double n=1000.0;
		int i;
		
		for(i=0;i<week;i++){
			num *= 1.05;
			num = Math.ceil(num / n) * n;
		}
		System.out.println((int)num);
		scan.close();
	}
}

Measured memory_bytes: 17168
a,b=map(int,input().split())
s=input()
flag = True
for i in range(a+b+1):
  if i == a:
    if s[i]!='-':
      flag=False
      break
  else:
    if not '0'<=s[i]<='9':
      flag=False
      break
print('Yes' if flag else 'No')  

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		String out = "No";
		
		if (a < b && a < c && b < c) {
			out = "Yes";
		}
		System.out.println(out);
	}	
}

Measured memory_bytes: 26204
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m,a,b;
    string s,t;
    cin>>n;
    if(n==3||n==5||n==7){cout<<"YES";}
    else{cout<<"NO";}
}

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define PI (acos(-1))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

#define MAXN 1123456
#define MOD 1000000007

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vii;
typedef vector<vi> vvi;

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

    string s;
    cin >> s;

    ll n= sz(s);

    vvi dp(n+5, vi(15, 0));

    dp[0][0] = 1;
    rep(i,0,n) {
      rep(j,0,13) {
        if (dp[i][j] == 0) continue;
        rep(k, 0, 10) {
          if (s[i] == '?' || (s[i]-'0' == k)) {
            ll cur = dp[i+1][(j*10+k)%13];
            if (cur == 0) {
              dp[i+1][(j*10+k)%13] = dp[i][j];
            } else {
              dp[i+1][(j*10+k)%13] += dp[i][j];
            }
            dp[i+1][(j*10+k)%13] %= MOD;
          }
        }
      }
    }

    cout << dp[n][5]%MOD << endl;
}


Measured memory_bytes: 15184
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ln(a) cout << (a) << endl
#define debug(a, n) rep(hoge, n) printf("%lld%c", a[hoge], hoge == (n) - 1? '\n' : ' ');
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define EPS 0.00000001

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

signed main() {
    int n, m;
    cin >> n >> m;
    cout << (n == m? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>


using namespace std;

/* cout << fixed << setprecision(5); */



int main()
{
	int H, W;

	while (cin >> H >> W)
	{
		if (H == 0 && W == 0)
		{
			break;
		}


		for (int j = 0; j < H / 2; j++)
		{


			for (int i = 0; i < W / 2; i++)
			{
				cout << "#.";
			}

			if (W % 2 == 1)
			{
				cout << "#";
			}

			cout << endl;



			for (int i = 0; i < W / 2; i++)
			{
				cout << ".#";
			}

			if (W % 2 == 1)
			{
				cout << ".";
			}

			cout << endl;


		}



		if (H % 2 == 1)
		{
			for (int i = 0; i < W / 2; i++)
			{
				cout << "#.";
			}


			if (W % 2 == 1)
			{
				cout << "#";

			}


			cout << endl;

		}


		cout << endl;


	}
		
	
	return 0;
	

}

Measured memory_bytes: 1156
#include <iostream>
#include <array>
#include <vector>
#include <unordered_map>

using std::cin;
using std::cout;
using std::endl;

#define ForIndex(N) for (size_t index = 0; index < (N); index++)

// ポインタの参照渡し
// -> 呼び出し元のポインタアドレスを書き換える
template<typename T>
void input1DArray(T*& outArray, size_t size)
{
    outArray = new T[size];

    for (size_t index = 0; index < size; index++)
    {
        cin >> outArray[index];
    }
}

template<typename T>
void input2DArray(T**& outArray, size_t xsize, size_t ysize)
{
    outArray = new T*[xsize];

    for (size_t index = 0; index < xsize; index++)
    {
        outArray[index] = new T[ysize];
        cin >> outArray[index];
    }
}

template<typename T>
void delete1DArray(T*& array)
{
    delete [] array;
}

template<typename T>
void delete2DArray(T**& array, size_t size)
{
    for (size_t index = 0; index < size; index++)
    {
        delete [] array[index];
    }

    delete [] array;
}

bool isBeginWithMarch(char* s)
{
    char b = s[0];
    return (b == 'M' || b == 'A' || b == 'R' || b == 'C' || b == 'H');
}

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

    char** s;
    input2DArray(s, N, 10);

    std::unordered_map<char, uint64_t> c;
    c['M'] = 0;
    c['A'] = 0;
    c['R'] = 0;
    c['C'] = 0;
    c['H'] = 0;

    ForIndex(N)
    {
        if (isBeginWithMarch(s[index]))
        {
            char begin = s[index][0];
            c[begin] += 1;
        }
    }

    uint64_t result = 0;

    {
        result += c['M'] * c['A'] * c['R'];
        result += c['M'] * c['A'] * c['C'];
        result += c['M'] * c['A'] * c['H'];
        result += c['M'] * c['R'] * c['C'];
        result += c['M'] * c['R'] * c['H'];
        result += c['M'] * c['C'] * c['H'];
        result += c['A'] * c['R'] * c['C'];
        result += c['A'] * c['R'] * c['H'];
        result += c['A'] * c['C'] * c['H'];
        result += c['R'] * c['C'] * c['H'];
    }

    cout << result << endl;

    delete2DArray(s, N);
    return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define inf 1000000000
using namespace std;

void show(int n, vector<vector<int>> A)
{
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            cout << A[i][j] << " ";
        }
        cout << endl;
    } 
}

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

    vector<vector<int>> K(30, vector<int>(30));
    int a, b, c, d;
    string str;

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            K[i][j] = inf;
        }
    }

    REP(i, m) {
        scanf("%d,%d,%d,%d", &a, &b, &c, &d);

        K[a][b] = c;
        K[b][a] = d;
    }

    int s, g, V, P;
    scanf("%d,%d,%d,%d", &s, &g, &V, &P);

    for (int k = 1; k <= n; k++) {
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                if (K[i][j] > K[i][k] + K[k][j])
                    K[i][j] = K[i][k] + K[k][j];
            }
        }
    }

    cout << V - K[s][g] - K[g][s] - P << endl;
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexed昇順

int main()
{
  int N;
  cin >> N;
  int x = N * 800;
  int y = N / 15 * 200;
  cout << x - y << endl;
}

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

using namespace std;
int main() {
	int N;
	cin >> N;
	map<string, int> mp;
	vector<set<string>>V(200005);
	int vmax = 0;
	for (int n = 0;n<N;++n) {
		string str;
		cin >> str; 
		map<string, int>::iterator itr = mp.find(str);
		if (itr != mp.end()) {
			int n = itr->second; 
			mp[str]++;
			V[n].erase(str);
			V[n + 1].insert(str); 
			vmax = max(vmax, n + 1);
		}
		else {
			mp[str] = 1; 
			V[1].insert(str);
			vmax = max(1,vmax);
		}
	}
	int num = 1;
	for (auto itr = V[vmax].begin(); itr != V[vmax].end();itr++) {
		cout << *itr<<endl;
	}
	return 0;
}


Measured memory_bytes: 43912
#include<stdio.h>
char v[6]="aeiou",c;
int ans=0;
int main(){
	scanf("%c",&c);
	for(int i=0;i<=4;i++){
			if(v[i]==c)
			ans=1;
	}
	if(ans==1)
		printf("vowel");
	else
		printf("consonant");
			
}


Measured memory_bytes: 128
#include <iostream>
#include <cmath>

using namespace std;

int main(){
    int A, B;
    cin >> A >> B;

    int a = 1, b = 1;
    int price = 1;
    while(true){
        if(a > A || b > B) break;
        a = price * 0.08;
        b = price * 0.1;
        // cout << a << " " << b << endl;
        if(a == A && b == B){
            cout << price << endl;
            return 0;
        }else{
            price++;
        }

    }
    cout << -1 << endl;


    return 0;
}

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

#define endl '\n'
#define db(x) cerr << #x << " == " << x << endl
#define dbs(x) cerr << x << endl
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3f

typedef long long ll;
typedef pair <int, int> pii;
typedef vector<ll> vll;
const int N = 405;

ll v[N], dp[N][N];

// every union comes from an finite set of operations inside a contigous segment
// you have to decide "i" position to join both sides

ll f(int l, int r){
  if(~dp[l][r]) return dp[l][r];
  if(l==r) return 0;
  ll ans=linf;
  for(int i=l; i<r; i++){
    ans=min(ans, f(l, i)+f(i+1, r));
  }
  return dp[l][r]=ans+v[r]-v[l-1];
}

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

  memset(dp, -1, sizeof(dp));
  int n;
  cin >> n;
  for(int i=1; i<=n; i++) cin >> v[i], v[i]+=v[i-1];

  cout << f(1,n) << endl;
}

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

int main(){
    // 制約見て！！！デカかったらlong longにすること！
    int a,b,c,k;
    cin >> a>>b>>c>>k;
    int m = std::max(a,b);
    m = std::max(m,c);

    int ans = 0;
    if (a==m){
        ans += b + c;
    }else if(b==m){
        ans+= a+c;
    }else if(c==m){
        ans += a+b;
    }
    
    for(int i =0;i<k;i++){
        m = 2*m;
    }

    ans += m;

    cout << ans <<endl;
}

Measured memory_bytes: 3608
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){

    ll n,m;
    cin >> n >> m;

    if(n > m)swap(n,m);

    if(n == 1){
	if(m == 1){
	    P(1);
	}else{
	    P(m-2);
	}
    }else{
	P((n-2)*(m-2));
    }
    
    return  0;
}


Measured memory_bytes: 256
x = int(input())
if x >= 1800:
    print(1)
elif x >= 1600: 
    print(2)
elif x>=1400:
    print(3)
elif x>=1200:
    print(4)
elif x>=1000:
    print(5)
elif x>=800:
    print(6)
elif x>=600:
    print(7)
else:
    print(8)


Measured memory_bytes: 9076
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005, SIGMA = 26;

int n, f[MAXN], nxt[MAXN][SIGMA];
char str[MAXN];

int main(){
	int i, j;
	scanf("%s", str + 1);
	n = strlen(str + 1), f[n] = 1;
	for(i = 0; i < SIGMA; ++ i)
		nxt[n][i] = n + 1;
	for(i = n - 1; i >= 0; -- i){
		memcpy(nxt[i], nxt[i + 1], sizeof(nxt[i]));
		nxt[i][str[i + 1] - 'a'] = i + 1;
		for(f[i] = f[nxt[i][0]], j = 1; j < SIGMA; ++ j)
			f[i] = min(f[i], f[nxt[i][j]]);
		++ f[i];
	}
	for(i = 0; i <= n; i = nxt[i][j]){
		for(j = 0; j < SIGMA; ++ j)
			if(f[i] == f[nxt[i][j]] + 1)
				break;
		putchar(j + 'a');
	} return 0;
}

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, n, m) for (int i = n; i < m; i++)
#define ll long long int

using namespace std;

int main() {
  int n;
  int v[20], c[20];
  cin >> n;
  REP(i,n) {
    cin >> v[i];
  }
  REP(i,n) {
    cin >> c[i];
  }

  int result = 0;

  REP(i,n) {
    result += max(v[i] - c[i], 0);
  }

  cout << result << endl;

}


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

a = list(map(int,input().split()))

for i in range(n):
    v = a[i]
    j = i-1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j = j-1
        a[j+1] = v
    for k in range(n):
        if k == n-1:
            print(a[k],end='')
        else:
            print(a[k],end=' ')
    print()

Measured memory_bytes: 8088
#include <iostream>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2+2], R[MAX/2+2];
int cnt;

void merge(int A[], int n, int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    for (int i = 0; i < n1; i++) L[i] = A[left + i];
    for (int i = 0; i < n2; i++) R[i] = A[mid + i];
    L[n1] = R[n2] = SENTINEL;
    int i = 0, j = 0;
    for (int k = left; k < right; k++) {
        cnt++;
        if(L[i] <= R[j])
            A[k] = L[i++];
        else
            A[k] = R[j++];
    }
}

void mergeSort(int A[], int n, int left, int right) {
    if(left+1 < right) {
        int mid = (left + right) / 2;
        mergeSort(A, n, left, mid);
        mergeSort(A, n, mid, right);
        merge(A, n, left, mid, right);
    }
}

int main() {
    int A[MAX], n;
    cnt = 0;

    cin >> n;
    for (int i = 0; i < n; i++) cin >> A[i];

    mergeSort(A, n, 0, n);

    for (int i = 0; i < n; i++) {
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 6920
N = int(input())
A =[int(a) for a in input().split()]
AL=[]
for i,a in enumerate(A):
    AL.append([i+1,a])
AL.sort(key=lambda x:x[1])
AL = [a[0]for a in AL]
ans =""
for a in AL:
    ans+=str(a)+" "
print(ans)

Measured memory_bytes: 22312
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	initialBufSize = 1e4
	maxBufSize     = 1e8
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func sum(x []int) int {
	s := x[0]
	for i := 1; i < len(x); i++ {
		s += x[i]
	}
	return s
}

func max(x []int) int {
	m := x[0]
	for i := 1; i < len(x); i++ {
		if m < x[i] {
			m = x[i]
		}
	}
	return m
}

func main() {
	N := nextInt()
	p := make([]int, N)
	for i := 0; i < N; i++ {
		p[i] = nextInt()
	}
	fmt.Println(sum(p) - max(p)/2)
}


Measured memory_bytes: 1772
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    int n,p[200000];
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>p[i];
    int ans=0,tmp=mod;
    for(int i=0;i<n;i++){
        if(p[i]<=tmp)
            ans++;
        tmp=min(p[i],tmp);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define maxn 200005
#define vi vector<int>
#define vl vector<ll>
#define mii map<int,int>
#define mli map<ll,int>
#define lc '\n'
#define forit(it,v) for(auto it=v.begin();it!=v.end();++it)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
struct raj
{
    int l;
    int r;
    int id;
};
raj rj[500001];
bool comp(raj &p,raj &q)
{
    return p.r<q.r;
}
int N=500001;
vector<int> bit(N,0);
ll last[500001];
void update(int x,int i,int n)
{
    for (; i <= n; i=i+(i & -i))
    {
        bit[i]+=x;
    }
}
int query(int i)
{
    int sum=0;
    for (; i > 0; i=i-(i & -i))
    {
        sum+=bit[i];
    }
    return sum;
}
void solve()
{
    int n,k;
    cin>>n>>k;
    memset(last,-1,sizeof(last));
    vl a(n),ans(k);
    for (int i = 0; i < n; ++i)
    {
        cin>>a[i];
    }
    for (int i = 0; i < k; ++i)
    {
        cin>>rj[i].l>>rj[i].r;
        rj[i].id=i;
    }
    sort(rj,rj+k,comp);
    int p=0;
    for (int i = 0; i < n; ++i)
    {
        if (last[a[i]]!=-1)
        {
            update(-1,last[a[i]]+1,n);
        }
        last[a[i]]=i;
        update(1,i+1,n);
        while(p<k && rj[p].r==i+1)
        {
            ans[rj[p].id]=query(rj[p].r)-query(rj[p].l-1);
            p++;
        }
    }
    for (int i = 0; i < k; ++i)
    {
        cout<<ans[i]<<lc;
    }
}
    int main()
    {
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
        fastIO;
        // sieve();
        int t=1;
        // int t;
        // cin>>t;
        while(t--)
        {
            solve();
        }
        return 0;
    }

Measured memory_bytes: 23260
fun main(args:Array<String>) {
    val num = readLine()!!.replace(" ", "").toInt()
    for(i in (0..num)) {
        val tmp = i*i
        if(tmp == num) {
            println("Yes")
            return
        }
        if(tmp > num) {
            break
        }
    }
    println("No")
}




Measured memory_bytes: 36064
#include <stdio.h>

int main(void) {

  int n;
  scanf("%d", &n);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int sum = 0;
  int square = 0;
  for (int i = 0; i < n; i++) {
    sum += a[i];
    square += a[i]*a[i];
  }
  int min = -1;
  int cost;
  for (int m = -100; m <= 100; m++) {
    cost = square+m*m*n-2*sum*m;
    if (min == -1 || cost < min) {
      min = cost;
    }
  }
  printf("%d\n", min);

  return 0;
}

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

using namespace std;
using LL = long long;
using P = pair<int,int>;

class UnionFind {
public:
    vector <LL> par;
    vector <LL> siz;

    UnionFind(LL sz_): par(sz_), siz(sz_, 1LL) {
        for (LL i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(LL sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (LL i = 0; i < sz_; ++i) par[i] = i;
    }

    LL root(LL x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }

    bool unite(LL x, LL y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool same(LL x, LL y) {
        return root(x) == root(y);
    }

    LL size(LL x) {
        return siz[root(x)];
    }
};

int main(){
	int N, M;
	cin >> N >> M;
	vector<int> p(N);
	rep(i,N) cin >> p[i];
	rep(i,N) p[i]--;
	UnionFind uf(N);
	rep(i,M){
		int x, y;
		cin >> x >> y;
		x--; y--;
		if(!uf.same(x,y)) uf.unite(x,y);
	}
	int ans=0;
	rep(i,N) if(uf.same(i,p[i])) ans++;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5024
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define cool ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll unsigned long long
#define MAX 1000001
#define mod 1000000007
#define pie 3.14159265358979323846
void solve()
{
	ll int a,d=100;
	cin>>a;
	double b;
	cin>>b;
	b*=100;
	ll int c=floor(b+0.01);
	cout<<((a*c)/d);
}
int main()
{ 
    cool;
    int t;
    //cin>>t;
    t=1;
    while(t--){
    	solve();
	}
    return 0;
}


Measured memory_bytes: 3736