akhauriyash/Code-Regression huggingface dataset:
module Main where

import           Control.Monad
import           Debug.Trace
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM
import qualified Data.Vector.Generic.Mutable   as VGM
import           Data.List
import qualified Data.ByteString               as BS
import qualified Data.ByteString.Char8         as BSC8
import           Data.Char
import           Data.Maybe
import           Data.Ord
--import           Data.Vector.Algorithms.Search
import qualified Data.Array                    as A
import qualified Data.Array.Unboxed            as AU
import qualified Data.Array.IO                 as AIO
import qualified Data.Set                      as S

getVUIL :: IO (VU.Vector Int)
getVUIL = VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine
readI :: BSC8.ByteString -> Int
readI = fst . fromJust . BSC8.readInt
readIL :: BSC8.ByteString -> [Int]
readIL = map readI . BSC8.words
readIT2 :: BSC8.ByteString -> (Int, Int)
readIT2 bs =
    let words = BSC8.words bs in (readI $ head words, readI $ last words)
getI :: IO Int
getI = readI <$> BSC8.getLine
getIL :: IO [Int]
getIL = readIL <$> BSC8.getLine
getIT2 :: IO (Int, Int)
getIT2 = readIT2 <$> BSC8.getLine

getNIS :: Int -> IO [(Int, BSC8.ByteString)]
getNIS 0 = return []
getNIS n = do
    [aFst, aSnd] <- BSC8.words <$> BSC8.getLine
    next         <- (getNIS (n - 1))
    return ((readI aFst, aSnd) : next)

il2ss :: [Int] -> String
il2ss = unwords . map show

il2sn :: [Int] -> String
il2sn = unlines . map show

modNum = 10 ^ 9 + 7
newtype Mint = M Int
instance Num Mint where
    (M a) + (M b) = M $ mod (a + b) modNum
    (M a) - (M b) = M (a - b)
    (M a) * (M b) = M $ mod (a * b) modNum
    fromInteger a = M $ mod (fromInteger a) modNum
    abs (M a) = M $ abs a
    signum (M a) = M $ signum a
instance Show Mint where
    show (M a) = show (mod a modNum)

int2MInt :: Int -> Mint
int2MInt a = M (mod a modNum)

main = do
    aN <- getI


    let ret = if odd aN then 0 else let test = div aN 2 in div5 test

    print ret

div5 x | x < 5     = 0
       | otherwise = let test = div x 5 in test + div5 test


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

#define int long long
using P = pair<int, int>;

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

  int n, m;
  cin >> n >> m;

  vector<P> xy(m);
  for ( int i = 0; i < m; i++ ) {
    cin >> xy[i].first >> xy[i].second;
    xy[i].second--;    
  }

  sort(xy.begin(), xy.end());  

  vector<int> cntl(n, 0), cntr(n, 0);
  for ( int i = 0; i < m; i++ ) {
    int j = xy[i].second;    
    cntl[j+1] = cntl[j]+1;
    cntr[j] = cntr[j+1]+1;    
  }

  for ( int i = 0; i < n; i++ ) {
    if ( i ) cout << " ";
    cout << cntl[i]+cntr[i]+1;    
  }

  cout << endl;
  
  return 0;
}



Measured memory_bytes: 7564
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(998244353)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ll gcd(ll a,ll b){if(!b)return a;else return gcd(b,a%b);}
ll d[302][302];
ll ans[302][302];
int main()
{
	owo
	ll n,m,l;
	cin>>n>>m>>l;
	for(int i=0;i<n;i++)
	  for(int j=0;j<n;j++)
		  ans[i][j] = d[i][j] = INF;
	 
	     
	while(m--)
	{
		int a,b,c;
		cin>>a>>b>>c;
		a--;b--;
		d[a][b] = c;
		d[b][a] = c;
	}
	for(int k=0;k<n;k++)
		for(int i=0;i<n;i++)
			for(int j=0;j<n;j++)
				d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
				
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			if(i!=j && d[i][j] <= l){ans[i][j] = ans[j][i] = 1;}
			
	for(int k=0;k<n;k++)
		for(int i=0;i<n;i++)
		   for(int j=0;j<n;j++)
			   if(i!=j)ans[i][j] = min(ans[i][j],ans[i][k]+ans[k][j]);
			   
    int q;
    cin>>q;
    while(q--)
    {
		int a,b;
		cin>>a>>b;
		a--;b--;
		cout<<(ans[a][b]==INF?-1:ans[a][b]-1)<<'\n';
	}
			
	
}





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

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(1){
        c-=b;
        if(c<=0){
            cout<<"Yes"<<endl;
            break;
        }
        a-=d;
        if(a<=0){
            cout<<"No"<<endl;
            break;
        }
    }
    return 0;
}

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

using namespace std;



int main(){
    
    int N;
    cin >> N;
    
    vector<long long> A(5, 0);
    
    for (int i = 0; i < N; i++) {
        
        string s;
        cin >> s;
        if(s[0] == 'M') A[0] += 1;
        if(s[0] == 'A') A[1] += 1;
        if(s[0] == 'R') A[2] += 1;
        if(s[0] == 'C') A[3] += 1;
        if(s[0] == 'H') A[4] += 1;
   
    }
    
    long long ans = 0;
    
    for (int i = 0; i < 3; i++) {
        for (int j = i+1; j < 4; j++) {
            for (int k = j+1; k < 5; k++) {
                ans += A[i] * A[j] * A[k];
                
            }
        }
    }
    
    cout << ans << endl;
    
}


Measured memory_bytes: 256
package main

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

// input scanner
var sc = bufio.NewScanner(os.Stdin)

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

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

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) int {
	ans := l[0]
	for _, n := range l {
		if n > ans {
			ans = n
		}
	}
	return ans
}

func min(l []int) int {
	ans := l[0]
	for _, n := range l {
		if n < ans {
			ans = n
		}
	}
	return ans
}

// main
func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	m := nextInt()
	wal := make([]int, n, n)
	acl := make([]bool, n, n)
	var acc int
	var wac int
	for i := 0; i < m; i++ {
		pi := nextInt()
		si := next()
		if si == "WA" {
			wal[pi-1]++
		}
		if si == "AC" && !acl[pi-1] {
			acc++
			wac += wal[pi-1]
			acl[pi-1] = true
		}
	}
	fmt.Println(acc, wac)
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define debug(...)
#include <complex.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;


int32_t main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n , k;
    cin >> n >> k;
    const int inf = (int)1e6;
    int l = max(-inf , k - n + 1 );
    int r = min(inf , k + n - 1);
    for(int i = l; i <= r; i++){
        cout << i << " \n"[i == r];
    }



    return 0;
}













Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <algorithm>
#define ll long long
#include <unordered_map>
using namespace std;
 
int main() {
  ll n;
  bool blank = 0;
  cin >> n;
  string S;
  vector<ll> A(26, 0), B(26, 0);
  for(ll i = 0; i < n; i++) {
    cin >> S;
    vector<ll> B(26, 0);
    if(i == 0) {
      for(ll j = 0; j < S.size(); j++) {
        A.at(S.at(j) - 97)++;
      }
    }
    else {
      for(ll j = 0; j < S.size(); j++) {
        B.at(S.at(j) - 97)++;
      }
      for(ll j = 0; j < 26; j++) {
        A.at(j) = min(A.at(j), B.at(j));
      }
    }
  }
  for(ll i = 0; i < 26; i++) {
    if(A.at(i) != 0) break;
    if(i == 25) blank = 1;
  }
  if(blank == 1) cout << endl;
  else {
    for(ll i = 0; i < 26; i++) {
      for(ll j = 0; j < A.at(i); j++) cout << char(i + 97);
    }
  }
}

Measured memory_bytes: 3596
//知りたい値はjより左側

#include <iostream>
#include <algorithm>

using namespace std;

static const int MAX = 200000;

int main(){
  int R[MAX], n;

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

  int maxv = -2000000000; //十分小さな値を設定
  int minv = R[0];//最小値は最初の値を保存しておく

  for(int i = 1; i < n; i++){
    maxv = max(maxv, R[i] - minv);//最大値を更新
    minv = min(minv, R[i]); //ここまでの最小値を保持しておく
  }

  cout << maxv << endl;

}


Measured memory_bytes: 3892
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
from fractions  import gcd
#input=sys.stdin.readline
import bisect
n=int(input())
a=list(map(int,input().split()))

Mod=10**9+7
M=10**6+2 #書き換え
fac=[0]*M
finv=[0]*M
inv=[0]*M

#finvに逆元、facに階乗のmod
def COMinit():
  fac[0]=fac[1]=1
  finv[0]=finv[1]=1
  inv[1]=1
  for i in range(2,M):
    fac[i]=(fac[i-1]*i%Mod)%Mod
    inv[i]=Mod-inv[Mod%i]*(Mod//i) %Mod
    finv[i]=(finv[i-1]*inv[i]%Mod)%Mod
def COM(n,k):
  if n<k:
    return 0
  if n<0 or k<0:
    return 0
  return (fac[n]*(finv[k]*finv[n-k]%Mod)%Mod)%Mod

COMinit()

def factorize(n):
    fct={}
    temp=n
    if temp<4:
        fct[temp]=1
    else:
        e=0
        while temp%2==0:
            temp=temp//2
            e+=1
        if e>0:
            fct[2]=e
    
    for b in range(3,int(n**0.5)+1,2):
        e=0
        while temp%b == 0:
            temp=temp//b
            e+=1
        if e>0:
            fct[b]=e
    if temp!=1:
        fct[temp]=1
    return fct

res={}
for i in a:
    f=factorize(i)
    for j in f:
        if j not in res:
            res[j]=f[j]
        else:
            res[j]=max(res[j],f[j])
c=1
ans=0
for i in res:
    c*=pow(i,res[i],Mod)
    c%=Mod
for i in a:
    ans+=c*inv[i]
    ans%=Mod
print(ans)


Measured memory_bytes: 103412
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  long long b[n+1],c[n+1];
  b[0]=0;
  c[n]=0;
  vector<int> a(n*3);
  priority_queue<int,vector<int>,greater<int>> qb;
  priority_queue<int> qc;
  for(int i=0;i<n*3;i++){
    cin>>a[i];
    if(i<n){
      b[0]+=a[i];
      qb.push(a[i]);
    }else if(i>=n*2){
      c[n]+=a[i];
      qc.push(a[i]);
    }
  }
  for(int i=n;i<n*2;i++){
    qb.push(a[i]);
    b[i-n+1]=b[i-n]+a[i]-qb.top();
    qb.pop();
  }
  for(int i=n*2-1;i>=n;i--){
    qc.push(a[i]);
    c[i-n]=c[i-n+1]+a[i]-qc.top();
    qc.pop();
  }
  long long ma=-100000000000000000;
  for(int i=0;i<=n;i++){
    ma=max(ma,b[i]-c[i]);
  }
  cout<<ma;
}
      
    

Measured memory_bytes: 3832
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<functional>
#include<queue>
using namespace std;
long long n, l, r, s;
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) { cin >> l >> r; s += (r - l + 1); }
	cout << s << endl;
	return 0;
}

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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args&&... args) {
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#define pi 3.141592653589
#define MOD 1000000007
#define to() int t; cin>>t; while(t--)
#define pb push_back
#define in insert
#define mp make_pair
#define ff first
#define ss second
#define si(s) s.size()
#define fori(it,v) for(it=v.begin();it!=v.end(); it++) 
#define for1(low,high,k) for(int i=low;i<high;i+=k)
#define for11(low,high,k) for(int j=low;j<high;j+=k)
#define for2(low,high,k) for(int i=low;i<=high;i+=k)
#define rev(high,low,k)  for(int i=high;i>=low ;i-=k)
#define all(x) x.begin(), x.end()
#define fil(x,i) memset(x,i,sizeof(x));
#define setbits(x) __builtin_popcount(x)
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout) 
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;


int main()
{
	boost;
	int n,x,t; cin>>n>>x>>t;
	int ans=((n+x-1)/x)*t;
	cout<<ans<<endl;
	
return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, M;
    cin >> N >> M;
    string S;
    cin >> S;
    int now = N;
    deque<int> seg;
    seg.push_back(now);
    while (now > 0) {
        int next = max(0, now - M);
        int zero_pos = -1;
        REP(i, next, now) {
            if (S[i] == '0') {
                zero_pos = i;
                break;
            }
        }
        if (zero_pos == -1) {
            cout << -1 << endl;
            return 0;
        }
        now = zero_pos;
        seg.push_front(now);
       // cout << now << endl;
    }
    rep(i, seg.size() - 1) {
        cout << seg[i + 1] - seg[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 4032
K, N = map(int, input().split())
A = list(map(int, input().split()))
max_ = 0
for i in range(N-1):
    tmp = A[i+1] - A[i]
    if tmp > max_:
        max_ = tmp
if max_ > A[0]+(K-A[-1]):
    print(K-(max_))
else:
    print(K-(A[0]+(K-A[-1])))

Measured memory_bytes: 26436
#include <iostream>
#include <string>
#define DEBUG(x) std::cout << #x << " is" << (x) << std::endl

long long pow(long long x, long long y) {
	long long ret = 1;
	while(y != 0) {
		if(y % 2 == 1) {
			ret *= x;
		}
		x *= x;
		y >>= 1;
	}
	return ret;
}

long long binomial(long long n, long long k) {
  	if(n < k) return 0;
	long long ret = 1;
	for(int i = 0;i < k;i++) {
		ret = ret * (n - i) / (i + 1);
	}
	return ret;
}

long long count(std::string str, int k){
	int size = str.size();
	if(k == 0 || k > size) {
		return 0;
	}
	long long ret = 0;
	
	if(size > k) ret += binomial(size - 1, k) * pow(9, k);
	ret += (str[0] - '0' - 1) * binomial(size - 1, k - 1) * pow(9, k - 1);
  	if(k == 1) ret++;
  	//DEBUG(ret);
	int index = 1;
	while(index < size && str[index] == '0') index++;
	if(index != size) ret += count(str.substr(index), k - 1);
	
	return ret;
}

int main() {
	std::string n;
	std::cin >> n;
	
	int k;
	std::cin >> k;
	
	std::cout << count(n, k) << std::endl;
	return 0;
}

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


int main()
{
    int h, w;
    cin >> h >> w;
    string s[h];
    rep(i, h) cin >> s[i];

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

    Graph G(h * w);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j] != '.') continue;
            for (int k = 0; k < 4; k++) {
                if (i + dy[k] >= 0 && i + dy[k] < h && j + dx[k] >= 0 && j + dx[k] < w) {
                    if (s[i+dy[k]][j+dx[k]] == '.') {
                        G.at(i * w + j).push_back((i + dy[k]) * w + j + dx[k]);
                        G.at((i + dy[k]) * w + j + dx[k]).push_back(i * w + j);
                    }
                }
            }
        }
    }

    int res = 0;

    for (int i = 0; i < h * w; i++) {
        vector<int> dist(h * w, -1);
        queue<int> que;

        dist[i] = 0;
        que.push(i);
    
        while(!que.empty()) {
            int v = que.front();
            que.pop();

            for (int nv : G[v]) {
                if (dist[nv] != -1) continue;
                dist[nv] = dist[v] + 1;
                res = max(dist[nv], res);
                que.push(nv);
            }
        }
    }

    cout << res << endl; 

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
#include <queue>
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;


ll mod = 1000000000 + 7;

int main(){
    int N, K;
    cin >> N >> K;
    vi p(N);
    vector<long double> E(N), S(N+1);
    for (int i = 0; i < N; ++i) {
        cin >> p.at(i);
        E.at(i) = (double)(1+p.at(i))/2 ;
    }
    S.at(0) = 0;
    for(int i=0; i<N; i++){
        S.at(i+1) = S.at(i) +E.at(i);
    }
    long double max = 0;
    long double ans;
    for(int i=0; i<N-K+1; i++){
        ans = S.at(i+K) - S.at(i);
        if(max <= ans){
            max = ans;
        }
    }
    cout << fixed << setprecision(12) << max << endl;
}


Measured memory_bytes: 7296
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Tenka1._2019Beginner
{
    class B
    {
        static void Solve()
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            int k = int.Parse(Console.ReadLine());

            char c = s[k-1];
            var ans = s.Select(x => x == c ? c : '*');
            foreach(var a in ans)
                Console.Write(a);

            Console.WriteLine();
        }

        static void Main(string[] args)
        {
            Solve();
        }
    }
}


Measured memory_bytes: 13268
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int S = scan.nextInt();
		//????????§?§???°??\???
		int h = S / 3600;
		int m = S % 3600 / 60;
		int s = S % 60;

		System.out.print(h);
		System.out.print(":");
		System.out.print(m);
		System.out.print(":");
		System.out.println(s);
	}
}

Measured memory_bytes: 26380
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

ans = [0]
for i in s:
    in_s = s.count(i)
    in_t = t.count(i)
    ans.append(in_s-in_t)
print(max(ans))

    


Measured memory_bytes: 3060
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) for(ll i=0;i<(n);++i)
#define REPR(i,n) for(ll i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int a,b; cin>>a>>b;
    if (a >= 13) {
        cout << b << '\n';
    }
    else if (a >= 6) {
        cout << b/2 << '\n';
    }
    else {
        cout << 0 << '\n';
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

//Princess's Marriage
public class Main{

	class P implements Comparable<P>{
		int d, p;
		public P(int d, int p) {
			this.d = d;
			this.p = p;
		}
		public int compareTo(P o) {
			return o.p-p;
		}
	}

	int n, m;
	P[] p;

	void run(){
		Scanner sc = new Scanner(System.in);
		while(true){
			n = sc.nextInt();
			m = sc.nextInt();
			if((n|m)==0)break;
			p = new P[n];
			int s = 0;
			for(int i=0;i<n;i++){
				p[i]=new P(sc.nextInt(), sc.nextInt());
				s += p[i].d*p[i].p;
			}
			Arrays.sort(p);
			int r = 0;
			int i = 0;
			while(m>0 && i<n){
				int min = Math.min(m, p[i].d);
				r += min*p[i].p;
				i++;
				m-=min;
			}
			System.out.println(s-r);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 14000
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  VI a(n);
  REP(i, 0, n) {
    cin >> a[i];
  }
  int inc = 1;
  int dec = 1;
  int tmp = 1;
  bool inc_p = false;
  REP(i, 1, n) {
    if (a[i] == a[i - 1]) {
      continue;
    }
    bool asc = a[i - 1] < a[i];
    if (inc_p != asc) {
      if (inc_p) {
	inc = max(inc, tmp);
      } else {
	dec = max(dec, tmp);
      }
      inc_p = asc;
      tmp = 1;
    }
    tmp += 1;
  }
  if (inc_p) {
    inc = max(inc, tmp);
  } else {
    dec = max(dec, tmp);
  }
  cout << max(inc, dec) << "\n";
}

Measured memory_bytes: 3352
import sys

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

for x in a:
  if x == 0:
    print("0")
    sys.exit()

kijun = 10 ** 18

res = 1
for x in a:
  res *= x
  if res > kijun:
    print("-1")
    sys.exit()
print(res)

Measured memory_bytes: 21720
N = int(input())
t = list(map(int,input().split()))
v = list(map(int,input().split()))
T = sum(t)*2
vt = [(i/2) if i<T/2 else ((T-i)/2) for i in range(T+1)]
ts = 0
te = 0
for i,ti in enumerate(t):
    te += ti*2
    vi = v[i]
    for j in range(ts,te):
        vt[j] = min(vt[j],vi)
    for j in range(te,T):
        if vt[j] >= (j-te)/2 + vi:
            vt[j] = (j-te)/2 + vi
        else:
            break
    for j in range(ts-1,-1,-1):
        if vt[j] >= -(j-ts)/2 + vi:
            vt[j] = -(j-ts)/2 + vi
        else:
            break
    ts = te
print(sum(vt)/2)

Measured memory_bytes: 4400
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  while(cin >>s){
    int ans=0,pro=2000,now;
    for(int i=0; i<s.size(); i++){
      if(s[i] == 'I') now = 1;
      if(s[i] == 'V') now = 5;
      if(s[i] == 'X') now = 10;
      if(s[i] == 'L') now = 50;
      if(s[i] == 'C') now = 100;
      if(s[i] == 'D') now = 500;
      if(s[i] == 'M') now = 1000;
      if(pro>=now){ans+=now;pro = now;}
      else{ans+=(now-pro*2);pro = 2000;}
    }
    cout <<ans<<endl;
  }
  return 0;
}

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

int main(){

	char a, b;

	cin >> a >> b;

	if(a<b){
		cout <<"<"<< endl;
	}else if(a>b){
		cout << ">" << endl;
	}else{
		cout << "=" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define coc g[node][i].st
#define mod 1000000007
#define inf 1000000009
#define N 52
using namespace std;

typedef long long ll;
typedef pair < ll , ll > ii;

ll n, m, a[N], u[N], x[N], y[N];
ll ans;
vector < ii > g[N];
ll yol[N][N];

bool dfs(ll node, ll bas, ll son){
	if(u[node])
		return 0;
	u[node] = 1;
	if(node == son)
		return true;
	bool don = false;
	for(ll i = 0; i < g[node].size(); i++){
		if(dfs(coc, bas, son)){
			don = true;
			yol[bas][son] |= (1ll<<g[node][i].nd);
		}
	}
	return don;
}

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%lld",&n);
	for(ll i = 1; i < n; i++){
		ll u, v;
		scanf("%lld %lld",&u ,&v);
		g[u].pb(mp(v, i));
		g[v].pb(mp(u, i));
	}
	for(ll i = 1; i <= n; i++)
		for(ll j = i + 1; j <= n; j++){
			memset(u, 0, sizeof u);
			dfs(i, i, j);
			// cout << yol[i][j] << endl;
			// for(ll k = 0; k < yol[i][j].size(); k++)
			// 	cout << yol[i][j][k] << " ";
			// cout << endl;
		}
	scanf("%lld",&m);
	for(ll i = 0; i < m; i++)
		scanf("%lld %lld",x + i, y + i);
	for(ll i = 0; i < (1ll<<m); i++){
		ll cur = 0;
		for(ll j = 0; j < m; j++){
			if( !((1ll<<j) & i) )
				continue;
			cur |= yol[x[j]][y[j]];
		}
		ll kac = __builtin_popcountll(cur);
		// cout << i << " " << n - 1 - kac << endl;
		if(__builtin_popcountll(i)%2)
			ans += (1ll<<(n - kac - 1));
		else
			ans -= (1ll<<(n - kac - 1));
		// cout << kac << endl;
	}
	cout << abs(ans) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <cassert>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using ld = long double;

#define st first
#define nd second

const int MAXN = 3e3 + 5, inf = 1e9;
const ll INF = 1e18;
const ld PI = 3.1415926535897932384626433832795;

int cnt[MAXN];
ld dp[MAXN][MAXN], p[MAXN];
bool vis[MAXN], used[MAXN];

vector<int> G[MAXN];
vector<ll> V;
set<ll> S;
map<ll, int> M;
stack<ll> St;
queue<ll> Q;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << setprecision(13) << fixed;

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

    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> p[i];
    }

    dp[0][0] = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= i; j++) {
            dp[i][j] = dp[i - 1][j - 1] * p[i] + dp[i - 1][j] * (1 - p[i]);
        }
    }

    ld res = 0;
    for (int i = (n + 1) / 2; i <= n; i++) {
        res += dp[n][i];
    }
    cout << res << "\n";
}


Measured memory_bytes: 139520
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define int ll
#define Endl endl

signed main(){
    string S;
    cin >> S;
    int L=(S[0]-'0')*10+(S[1]-'0');
    int R=(S[2]-'0')*10+(S[3]-'0');
    L=(L+99)%100;
    R=(R+99)%100;
    if(L<=11 && R<=11){
        cout << "AMBIGUOUS" << endl;
    }else if(L>11 && R<=11){
        cout << "YYMM" << endl;
    }else if(L<=11 && R>11){
        cout << "MMYY" << endl;
    }else{
        cout << "NA" << endl;
    }
    return 0;
}

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

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (A + B + C >= 22) cout << "bust" << endl;
    else cout << "win" << endl;
    return 0;
}


Measured memory_bytes: 3620
n = int(input())
a = list(map(int, input().split()))

r = 0
s = 0

ans = 0
for l in range(n):
    while r < n and not (s & a[r]):
        s ^= a[r]
        r += 1
    ans += r - l
    s ^= a[l]

print(ans)


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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long



int32_t main() {

    int n; cin >> n;
    vector<int> a(n+1);
    for(int i = 1; i <= n; ++i) {
        cin >> a[i];
    }

    vector<int> f(n+1, 0);
    vector<int> ans;
    
    for(int i = n; i > 1; i--) {
        if(f[i]%2 != a[i]) {
            ans.push_back(i);
            for(int j = 2; j*j <= i; ++j) {
                if(i%j == 0) {
                    f[j]++;
                    if(j != i/j) {
                        f[i/j]++;
                    }
                }
            }
        }
    }
    if((int)ans.size()%2 != a[1]) {
        ans.push_back(1);
    }

    cout << ans.size() << '\n';
    for(int aa : ans) {
        cout << aa << ' ';
    }
    if(!ans.empty()) {
        cout << '\n';
    }
    return 0;
}


Measured memory_bytes: 4980
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;
  
int main()
{
  string S;
  cin >> S;

  if(S=="KIHBR"||S=="AKIHBR"||S=="KIHABR"||S=="KIHBAR"||S=="KIHBRA"||S=="AKIHABR"||S=="AKIHBAR"||S=="AKIHBRA"||S=="KIHABAR"||S=="KIHABRA"||S=="KIHBARA"||S=="AKIHABAR"||S=="AKIHABRA"||S=="AKIHBARA"||S=="KIHABARA"||S=="AKIHABARA"){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    a, b, m = rli()
    la = rli()
    lb = rli()
    ans = min(la)+min(lb)
    for i in range(m):
        x, y, c = rli()
        x -= 1
        y -= 1
        ans = min(ans, la[x]+lb[y]-c)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 18740
#include <stdio.h>
#include <string.h>
#define N 101
#define X 298

void init(int [N][X]);

int main(void) {
    int n, x, tbl[N][X] = {{}};
    init(tbl);
    while(scanf("%d %d", &n, &x), n || x) {
        printf("%d\n", 0 < x && x < X ? tbl[n][x] : 0);
    }
    return 0;
}

void init(int tbl[N][X]) {
    int i, j, k;
    double v;
    for(i = 3; i < N; i++) {
        v = 1;
        for(j = i + 3; j <= ~-i * 3; j++) {
            for(k = i; k < N; k++) {
                tbl[k][j] += (int)v;
            }
            if(j < i * 2) {
                v += 0.5;
            } else {
                v -= 0.5;
            }
        }
    }
}

Measured memory_bytes: 728
#include <iostream>
#include <cstdio>
#include <map>

using namespace std;

int main()
{
	int n,m,in;
	pair<int,int> cnt[1000],temp;

	while(scanf("%d %d",&m,&n) && n || m){
		for(int i = 0; i < n; i++){
			cnt[i] = make_pair(i+1,0);
		}

		for(int i = 0; i < m; i++){
			for(int j = 0; j < n; j++){
				scanf("%d",&in);
				cnt[j].second += in;
			}
		}

		for(int i = 0; i < n-1; i++){
			for(int j = i+1; j < n; j++){
				if(cnt[i].second < cnt[j].second){
					temp = cnt[i];
					cnt[i] = cnt[j];
					cnt[j] = temp;
				}
				else if(cnt[i].second == cnt[j].second && cnt[i].first > cnt[j].first){
					temp = cnt[i];
					cnt[i] = cnt[j];
					cnt[j] = temp;
				}
			}
		}

		for(int i = 0; i < n; i++){
			printf("%d",cnt[i].first);
			if(i+1 != n){
				printf(" ");
			}
			else{
				printf("\n");
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
uli f[55][2];
int a[55];
int main(){
  int n,p;
  scanf("%d %d",&n,&p);
  for(int i=0;i<n;i++){
    scanf("%d",a+i);
    a[i]%=2;
  }
  f[n][0]=1;
  for(int i=n-1;i>=0;i--){
    for(int r=0;r<2;r++){
      f[i][r]=f[i+1][r]+f[i+1][r^a[i]];
    }
  }
  printf("%lld\n",f[0][p]);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353,INF=1e18;



int main() {
    int N,M;
    cin>>N>>M;
    vector<int> A(N);
    rep(i,N){cin>>A.at(i);}
    sort(A.begin(),A.end());
    vector<P> sousa(M);
    rep(i,M){
        int B,C;
        cin>>B>>C;
        sousa.at(i).first=C;
        sousa.at(i).second=B;
    }
    sort(sousa.rbegin(),sousa.rend());
    int pa=0,ps=0,count=0;
    while(pa<N && ps<M){
        if(A.at(pa)>=sousa.at(ps).first){pa++;continue;}
        A.at(pa)=sousa.at(ps).first;
        pa++;
        count++;
        if(count>=sousa.at(ps).second){
            ps++;
            count=0;
        }
    }
    ll ans=0;
    rep(i,N){
        ans+=A.at(i);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 200005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n;
	cin>>k>>n;
	ll ar[n+2];
	for(i=1;i<=n;i++){
		cin>>ar[i];
	}
	vector<ll> vc;
	for(i=1;i<n;i++){
		vc.ps(ar[i+1]-ar[i]);
	}
	vc.ps(k-ar[n]+ar[1]);
	
	sort(all(vc));
	ll an=0;
	for(i=0;i<n-1;i++){
		an+=vc[i];
	}
	cout<<an;
	return 0;
}

Measured memory_bytes: 3956
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <set>
#include <utility>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <deque>
#include <unordered_map>
#include <map>
#include <bitset>
#include <string>
#include <cstring>

#define pb push_back
#define mp make_pair
#define l(x) x << 1
#define r(x) x << 1 | 1
#define scan(x) do {while((x=getchar())<'0') ; for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0') ; } while(0)
char _;
#define x first
#define y second

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<float, float> pff;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef map<int, int> mii;
typedef unordered_map<int, int> umii;

int N, x, s = 0, t = 0, m = 101;

int main() {
    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%d", &x);
        if (x % 10 == 0) {
            t += x;
        } else {
            s += x;
            m = min(m, x);
        }
    }
    if (m == 101) {
        m = 0;
    }
    if (s != 0 && s % 10 == 0) {
        s -= m;
    }
    if (s % 10 != 0) {
        s += t;
    }
    printf("%d\n", s);
}


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

using namespace std;
using ll = long long;

void init();
void solve();

#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define rrep(i, a) for (int i = (int) a-1; i >= 0; i--)
#define rreps(i, a, b) for (int i = (int) (a)-1; i >= (int) (b); i--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a
#define lcoutln(a) cout << a << endl
#define lcerr(a) cerr << a
#define lcerrln(a) cerr << a << endl
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif
#define MOD 1000000007
#define PI 3.141592653589793238462643383

signed main()
{
	init();
	solve();
}

int N;

void init()
{
	cin >> N;
}

void solve()
{
	int ma = 0, res = 0;
	rep(i, N) {
		int a, b;
		cin >> a >> b;
		if (a > ma) {
			ma = a;
			res = a + b;
		}
	}
	cout << res << endl;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int h, w;
  cin >> h >> w;
  vector<vector<int>> a(h, vector<int>(w));
  rep(i, h){
    rep(j, w){
      int in;
      cin >> in;
      a.at(i).at(j) = in;
    }
  }
  vector<tuple<int, int, int,int>> ans;
  rep(i, h){
    rep(j, w){
      if(a.at(i).at(j) % 2 != 0){
        if(j != w-1){
          a.at(i).at(j+1)++;
          ans.push_back(make_tuple(i, j, i, j+1));
        }else if(i != h-1){
          a.at(i+1).at(j)++;
          ans.push_back(make_tuple(i, j, i+1, j));
        }
      }
    }
  }
  cout << ans.size() << endl;
  for(auto t : ans){
    int y1, x1, y2, x2;
    tie(y1, x1, y2, x2) = t;
    cout << y1+1 << " " << x1+1 << " " << y2+1 << " " << x2+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 5232
class UnionFind:
    def __init__(self):
        self.data = {}
        self.heights = {}
        self.sizes = {}

    def get_num_trees(self):
        return len(self.heights)

    def get_tree_size(self, a):
        return self.sizes[self.get_root(a)]

    def add_node(self, a):
        self.data[a] = a
        self.heights[a] = 1
        self.sizes[a] = 1

    def get_root(self, a):
        nodes = [a]
        while nodes[-1] not in self.heights:
            nodes.append(self.data[nodes[-1]])
        for x in nodes:
            self.data[x] = nodes[-1]
        return nodes[-1]

    def union(self, a, b):
        root_a = self.get_root(a)
        root_b = self.get_root(b)
        if root_a == root_b:
            return
        if self.heights[root_a] > self.heights[root_b]:
            a, b = b, a
            root_a, root_b = root_b, root_a
        self.data[root_a] = root_b
        self.heights[root_b] = max(self.heights.pop(root_a) + 1, self.heights[root_b])
        self.sizes[root_b] += self.sizes.pop(root_a)

    def find(self, a, b):
        return self.get_root(a) == self.get_root(b)


N, M = map(int, input().split())
AB = []
for _ in range(M):
    a, b = map(int, input().split())
    AB.append((a, b))

uf = UnionFind()
for i in range(1, N + 1):
    uf.add_node(i)

ans = [N * (N - 1) // 2]
for a, b in reversed(AB):
    if uf.find(a, b):
        ans.append(ans[-1])
    else:
        ans.append(ans[-1] - uf.get_tree_size(a) * uf.get_tree_size(b))
    uf.union(a, b)

for i in range(M):
    print(ans[-2 - i])

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

int main(){
  int n;
  cin >> n;
  VI o(n);
  rep(i,n){
    int ai;
    cin >> ai;
    o[ai-1] = i+1;
  }
  
  rep(i,n){
    cout << o[i] << " ";
  }
  
  return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll p(ll n) 
{ 
	ll min=1000000000000000;
    // Note that this loop runs till square root 
    for (ll i=1; i<=sqrt(n); i++) 
    { 
        if (n%i == 0) 
        { 
            // If divisors are equal, print only one 
            if ( i+(n/i)<min)
            min=(i+(n/i))-2;
                
  
    
                
        } 
    } 
    return min;
} 

int main() {
	ll n;
	cin>>n;
	ll ans=p(n);
	cout<<ans;
	
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    int a[100], b[100];
    for(int i=0;i<N;i++)
        cin >> a[i];
    for(int i=0;i<N;i++)
        cin >> b[i];
    int MAX = 0;
    //下に移動する位置(0,N-1)
    for(int i=0;i<N;i++){
        int C = 0; //Candies
        //N回の移動
        int j=0;
        for(j=0;j<N;j++){ //1列目
            if(j<i){
                C += a[j];
            }else if(j==i){
                C += a[j];
                C += b[j];
            }else{
                C += b[j];
            }
        }
        if(MAX < C)
            MAX = C;
    }
    cout << MAX << endl;
    return 0;
}

Measured memory_bytes: 256
from scipy.sparse.csgraph import floyd_warshall

n,m=map(int,input().split())
edge=[list(map(int,input().split())) for _ in range(m)]
g=[[float('inf')]*(n+1) for _ in range(n+1)]
for a,b,c in edge:
  g[a][b]=c
  g[b][a]=c
d=floyd_warshall(g)
ans=0
for a,b,c in edge:
  for i in range(1,n+1):
    if d[i][a]+c==d[a][b]:
      break
  else:
    ans+=1
print(ans)

Measured memory_bytes: 17360
#include <iostream>
#include <stdio.h>
#include <string>

#define MAX_Q 500'001
#define OFFSET 200'000

using namespace std;

char C[MAX_Q];

int main() {
  string S;
  cin >> S;
  int N = S.size();
  for (int i = 0; i < N; ++i) {
    C[OFFSET + i] = S[i];
  }
  int Q;
  cin >> Q;
  bool flg = false;
  int left = OFFSET - 1;
  int right = N + OFFSET;
  for (int i = 0; i < Q; ++i) {
    int t;
    cin >> t;
    if (t == 1) {
      flg = !flg;
    } else {
      int f;
      char c;
      cin >> f >> c;
      if ((!flg && f == 1) || (flg && f == 2)) {
        C[left--] = c;
      } else {
        C[right++] = c;
      }
    }
  }
  if (flg) {
    for (int i = right - 1; i > left; --i) {
      printf("%c", C[i]);
    }
    printf("\n");
  } else {
    for (int i = left + 1; i < right; ++i) {
      printf("%c", C[i]);
    }
    printf("\n");
  }
}

Measured memory_bytes: 3480
#define ll long long int

#include <bits/stdc++.h>

using namespace std;

int main() {

    vector<int> vc;
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        ll x;
        cin >> x;
        vc.push_back(x);
    }
    sort(vc.begin(), vc.end());
    ll sum = 0;
    for (int i = 0; i < k; i++)sum += vc[i];
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3608
n, m = gets.split.map(&:to_i)           
 ab = Hash.new(0)                        
 n.times do                              
   a, b = gets.split.map(&:to_i)         
   ab[a] += b                            
 end                                     
 price = ab.sort {|a, b| a[0] <=> b[0] } 
                                         
 ans = 0                                 
 while m > 0 do                          
   c = [m, price[0][1]].min              
   ans += price[0][0] * c                
   price.delete_at(0)                    
   m -= c                                
 end                                     
                                         
 puts ans                                


Measured memory_bytes: 16616
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<endl
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define F first
#define S second
#define PI 3.14159265358979323846264338327
#define INF 2e14
#define MOD 998244353
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef unsigned long long ull;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define MAXN 100005

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	string s; cin>>s;
	int n=s.length();
	
	int cnt=0;
	bool skip=0;
	forn(i,1,n){
		if(skip){
			skip=0;
			i++;
		}
		if(s[i]==s[i-1]){
			cnt++;
			skip=1;
			i++;
		}
	}
	cout<<n-cnt<<'\n';
	
	return 0;
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
int main(){
    string str;
    getline(cin,str);
    int n=str.size();
    int s=0;
    for(int i=0;i<n;i++){
        s+=str[i]-'0';
    }
    if(s%9==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3748
#include <iostream>
#include <iomanip>

using namespace std;

int main(void)
{
	int a, b;
	
	std::cin >> a >> b;
	
	double f = 1.0 * a / b;
	std::cout << a / b << " " << a % b << " " << fixed << std::setprecision(6) << f << std::endl;
	
	return 0;
}


Measured memory_bytes: 3276
#include "bits/stdc++.h"
using namespace std;

/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define isin(a, b, c) (b <= a && a <= c)
#define println cout << "\n";
#define sz(v) (int)v.size()


/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;

/* constant */
const int inf = 1LL << 62;
const int mod = 1e9 + 7;
const int dx[8]={1,0,-1,0,-1,1,-1,1};
const int dy[8]={0,1,0,-1,-1,-1,1,1};
const string alphabet = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T, class U, class V> void printx(tuple<T, U, V> t){cout << "{" << get<0>(t) << "," << get<1>(t) <<"," << get<2>(t) << "}" << endl;}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}


/* general_method */
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>T cut(T &a, int l, int r){return T(a.begin()+l, a.begin()+r);}

/* main */
int n;
string a, b, c;
void in(){
    cin >> n;
    cin >> a >> b >> c;
}

void solve(){

    int ans = 0;

    rep(i,0,n){
        int cnt = inf;
        for(char e : alphabet){
            int cost = 0;
            if(a[i] != e) cost++;
            if(b[i] != e) cost++;
            if(c[i] != e) cost++;
            chmin(cnt, cost);
        }
        ans += cnt;
    }
    
    print(ans);

}

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    in();
    solve();
    
}

Measured memory_bytes: 256