akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	var p []int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scan(&tmp)
		p = append(p, tmp)
	}

	sort.Ints(p)
	sum := 0
	for i, v := range p {
		if i == len(p)-1 {
			sum += v / 2
		} else {
			sum += v
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 512
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String[] lines = sc.next().split(",");
            int[] cards = new int[13];
            int max = 0;
            int max2 = 0;
            for (int i = 0; i < lines.length; i++) {
                int n = Integer.parseInt(lines[i]) - 1;
                cards[n]++;
                if (max < cards[n]) {
                    max = cards[n];
                } else if (max2 < cards[n]) {
                    max2 = cards[n];
                }
            }
            String a = "";
            if (max >= 4) {
                a = "four card";
            } else if (max == 3) {
                if (max2 == 2) {
                    a = "full house";
                } else {
                    a = "three card";
                }
            } else if (max == 2 && max2 == 2) {
                a = "two pair";
            } else if (max == 2) {
                a = "one pair";
            } else {
                a = "null";
                int count = 0;
                for (int i = 0; i < 14; i++) {
                    if (cards[i % 13] == 1) {
                        count++;
                        if (count == 5) {
                            a = "straight";
                            break;
                        }
                    } else {
                        count = 0;
                    }
                }
            }
            System.out.println(a);
        }
    }
}


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

int main() {
  int N, K;
  cin >> N >> K;
  int f = 0;
  for (int i = 0; i < N; i++){
    int x;
    cin >> x;
    if (x < K-x){
      f = f + 2*x;
      continue;
    }
    else{
      f = f + 2*(K-x);
      continue;
    }
  }
  cout << f << endl;
}

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

int main(){
      int a,b,k;cin >> a >> b >> k;
      int n = min(a, b);
      for(int i = n;i >= 0;i--){
            if(a % i == 0 && b % i == 0){
                  k--;
                  if(k == 0)return cout << i, 0;
            }
      }
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	l := make([]int, n)
	for i := 0 ;i < n;i++ {
		fmt.Scan(&l[i])
	}

	cnt := 0
	for i := 0 ; i< n; i++ {
		for j := i+1; j < n; j++ {
			for k := j+1; k < n; k++{
				if i == j || i == k || j== k {
					continue
				}

				if l[i] +l[j] > l[k] &&
					l[j] +l[k] > l[i] &&
					l[k] +l[i] > l[j] {
					if l[i] != l[j] && l[j] != l[k] && l[k] != l[i] {
						///fmt.Println(i,j,k)
						//fmt.Println(l[i],l[j],l[k])
						cnt++

					}
				}
			}
		}
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 1776
#include<bits/stdc++.h>
using namespace std;
int a[1001],n,m,oddnum[2];
int main()
{
    int odd=0,tot=0;
    scanf("%d%d",&n,&m);
    oddnum[0]=1;oddnum[1]=m;
    for(int i=1;i<=m;i++)
    {
        scanf("%d",a+i);
        if(~a[i]&1) continue;
        oddnum[odd++]=i;
        if(odd>2) return puts("Impossible"),0;
    }
    swap(a[1],a[oddnum[0]]);
    swap(a[m],a[oddnum[1]]);
    if(m==1&&a[1]==1) return puts("1\n1\n1"),0;
    for(int i=1;i<=m;i++) printf("%d ",a[i]);
    if(m==1) return printf("\n2\n%d 1\n",a[1]-1),0;
    printf("\n%d\n%d ",a[m]>1?m:m-1,a[1]+1);
    for(int i=2;i<m;i++) printf("%d ",a[i]);
    if(a[m]>1) printf("%d\n",a[m]-1);
    return 0;
}


Measured memory_bytes: 3824
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    a = f()

    a = sorted(a, reverse = True)

    ans = 0
    for i in range(n):
        if i%2 == 0:
            ans += a[i]
        else:
            ans -= a[i]
    
    print(ans)

solve()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
map<int, int> mmp;
int main(int argc, char const *argv[])
{
	int n;
	while (cin >> n) {
		mmp.clear();
		while (n--) {
			int x; cin >> x;
			++mmp[x];
			++mmp[x - 1];
			++mmp[x + 1];
		}
		auto p = mmp.begin(), q = mmp.end();
		int ans = 0;
		while (p != q) {
			ans = max(ans, p->second);
			++p;
		}
		cout << ans << endl;
	}
	return 0;
}

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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}

int64_t dp[3001][3001];

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

    for(int j=0; j<N; j++) dp[0][j] = 1;
    for(int i=0; i<N-1; i++){
        for(int j=0; j<N-i; j++){
            if(S[i] == '>'){
                add(dp[i+1][0], dp[i][j]);
                add(dp[i+1][j], MOD - dp[i][j]);
            }else{
                add(dp[i+1][j], dp[i][j]);
            }
        }
        for(int j=1; j<N-i-1; j++) add(dp[i+1][j], dp[i+1][j-1]);
    }
    cout << dp[N-1][0] << endl;
    return 0;
}

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

int main() {
  string s;
  cin >> s;
  if(s == "ABC")
    cout << "ARC" << endl;
  else if(s == "ARC")
    cout << "ABC" << endl;
      
}


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

#include <unordered_map> 
#include <cstdio>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define clr(a) memset(a, 0, sizeof(a))
#define sz(x) x.size()
#define rep(n) for (ll i = 0; i < n; i++)
#define repc(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define DEC(i, x, y) for (int i = x; i >= y; i--)
#define all(v) v.begin(), v.end()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define alla(a, n) a, a + n

using namespace std;

// Some typedef's
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

// UTILITY FUNCTIONS

// String
char toUpper(const char &c) { return isupper(c) ? c : c - 'a' + 'A'; }
char toLower(const char &c) { return islower(c) ? c : c + 'a' - 'A'; }
bool isvowel(char c){  c = toLower(c);return (c == 'a' or c == 'e' or c == 'i' or c == 'i' or c == 'o' or c == 'u' || c == 'y');}
void toLowerCase(string &s){rep(s.size()){  if (!islower(s[i]))  {    s[i] = tolower(s[i]);  }}}
void toUpperCase(string &s){rep(s.size()) { s[i] = toupper(s[i]); }}
bool ispal(string s){  ll lo, hi;  lo = 0;  hi = s.length() - 1;  while (lo <= hi)  {    if (s[lo] != s[hi])    {      return 0;    }    lo++;    --hi;  }  return 1;}
template <class T>string toString(T n){  string v = "";  while (n)  {    v.pb(n % 10 + '0');    n /= 10;  }  reverse(all(v));  return v;}

// Maths
template <typename t>t gcd(t a, t b){  a = abs(a), b = abs(b);  return ((b == 0) ? a : gcd(b, a % b));}
template <typename t>t lcm(t a, t b) { return (a * (b / gcd(a, b))); }
template <typename T>T modpow(T base, T exp, T modulus){  base %= modulus;  T result = 1;  while (exp > 0)  {    if (exp & 1)      result = (result * base) % modulus;    base = (base * base) % modulus;    exp >>= 1;  }  return result;}
template <typename T>void cumulative(T *a, T *b, T n){  rep(n) { i ? b[i] = b[i - 1] + a[i] : b[i] = a[i]; }}

// Some constants
const int inf = 1e9 + 7;
const double eps = 1e-6;
const double pi = 1.00 * acos(-1.00);

//------------------------------------------------------------------------


const int N = 1e6;
map<ll, vii> adj;
bool color[N] = {0};

void dfs(ll u){
  color[u] = 1;
  for(auto x: adj[u]){
    if(color[x.fr] == 0){
      dfs(x.fr);
    }
  }
}




void solve(ll testcase){
  ll n;
  cin >> n;
  ll m;
  cin >> m;
  rep(m){
    ll u, v, wt;
    cin >> u >> v >> wt;
    u--, v--;
    adj[u].pb(mp(v, wt));
    adj[v].pb(mp(u, wt));
  }
  ll ans = 0;
  rep(n){
    if(color[i] == 0){
      ans++;
      dfs((ll)i);
    }
  }
  cout << ans << endl;
}

int main()
{
  std::ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef ONLINE_JUDGE
#else
  //freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
#endif
  ll t = 1;
  // cin >> t;
  ll cas = 0;
  while (t--)
  {
    solve(++cas);
  }
}


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

#define F first
#define S second
#define x1 privet1
#define x2 privet2
#define y1 privet3
#define y2 privet4
#define left privet6
#define prev ppppp

using namespace std;
typedef long long ll;

const int max_n = 200011, log_n = 32, max_m = 111, mod = 1000000007, inf = 1000111222;

string s;
int a[33][max_n];
ll dp[max_n];

int main() {
    //freopen("input.txt", "r", stdin);
    cin >> s;
    for (int i =0; i < s.length(); ++i) {
        a[s[i] - 'a'][i] = 1;
        if (i)
        for (int q = 0; q < 33; ++q) {
            a[q][i] += a[q][i - 1];
        }
    }
    dp[0] = 1;
    for (int i = 1; i < s.length(); ++i) {
        dp[i] = dp[i - 1] + i + 1 - a[s[i] - 'a'][i];
    }
    cout << dp[s.length() - 1] << endl;
    return 0;
}


Measured memory_bytes: 27908
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

int main(){
  int x,y,z;
  cin >> x >> y >> z;
  
  cout << (x-z)/(z+y) << endl;
  return 0;
}


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

int main(void){
    int A, B, K, count = 0;
    cin >> A >> B >> K;
    int minnum = min(A, B);
    for(int i = minnum; i > 0; --i){
        if(A % i == 0 && B % i == 0) count++;
        if(count == K) {
            cout << i << endl;
            break;
        }
    }
    return 0;
}

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

int main() {
    ll n;
    ll abc[3][100001];
    std::cin >> n;
    for (int i = 0; i < n; i++) {
        std::cin >> abc[0][i]>>abc[1][i]>>abc[2][i];
    }
    ll dp[100002][3];
    
    dp[0][0] = dp[0][1] = dp[0][2] = 0;
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            dp[i+1][j] = max(dp[i][(j+1)%3] , dp[i][(j+2)%3] )+ abc[j][i];
        }
    }
    std::cout << max({dp[n][0],dp[n][1],dp[n][2]}) << std::endl;
}



Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define imp() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define endl "\n"
#define lli long long int 
#define ll long long 
int main() {
	// your code goes here
	imp();
	
	  //  lli n;cin>>n;
	   string str;cin>>str;//set<char>s;
	   int c=0;int maxx=INT_MIN;
	   for(int i=0;i<3;i++)
	   {
	       if(str[i]=='R')
	       c++;
	       else
	       {
	           maxx=max(c,maxx);
	           c=0;
	       }
	   }
	   maxx=max(maxx,c);
	   //if(c==3)
	   //cout<<c<<"\n";
	  // else
	   cout<<maxx<<"\n";
	   
	   

	
	   
	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    int r;
    cin >> r;
    if(r < 1200){
        cout << "ABC" << endl;
    } else if(r < 2800) {
        cout << "ARC" << endl;
    } else {
        cout << "AGC" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll MOD=1e9+7;

ll f(pair<string,ll>&x ,pair<string,ll>&y) 
{
	if(x.first == y.first) 
	{
		return x.second>y.second;
	}
	else 
	{
		return x.first<y.first;
	}
}
 
void solve()
{
	ll n;
	cin>>n;
	ll a[n],b[n];
	for(ll i=0;i<n;i++)
		cin>>a[i];
	for(ll i=0;i<n;i++)
		cin>>b[i];
	ll ans=0;
	for(ll i=0;i<n;i++)
	{
		if(a[i]>b[i])
			ans+=(a[i]-b[i]);
	}
	cout<<ans;
	return;
}

int main()
{
        fast;
        ll q;
        q=1;
        // cin>>q;
        while(q--)
        	solve();
        
        return 0;
}


Measured memory_bytes: 3692
#define _USE_MATH_DEFINES
 
#include <bits/stdc++.h> 
 
using namespace std;
 
#define len(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define vi vector<int> 
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<int, int>
#define pdd pair<double, double> 
#define beg begin
 
#ifdef LOCAL
    #define dbg(x) cout << #x << " = " << x << endl;
#else 
    #define dbg(x)
#endif 
 
template<class T> istream& operator>>(istream &str, vector<T> &a) {
    for (auto &i : a) {
        str >> i; 
    }
    return str;
}
 
template<class T> ostream& operator<<(ostream &str, vector<T> &a) {
    for (auto &i : a) {
        str << i << " ";
    }
    return str;
}
 
template<class T> istream& operator>>(istream &str, pair<T, T> &a) {
    str >> a.x >> a.y;
    return str;
}
 
template<class T> ostream& operator<<(ostream &str, pair<T, T> &a) {
    str << a.x << " " << a.y;
    return str;
}
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);                                       
    freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(6);
    solve();    
    return 0;
}
 
const int INF = 1e18, MAXN = 1e4 + 10, MOD = 1e9 + 7, BASE = 37;

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

    cout << "No" << endl;
}

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

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

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

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( a > b ) { a = b; return 1; } return 0; }

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

signed main(){
    int N; cin >> N;
    cout << pow( N, 3 ) << endl;
}


Measured memory_bytes: 384
N = int(input())
a = list(map(int, input().split()))
res = 0

def plus(n):
    if n == 1:
        return 0
    elif n <= 3:
        return 1
    else:
        return n // 2

tmp=1
for i in range(1,N):
    if a[i-1] == a[i]:
        tmp += 1
    else:
        res += plus(tmp)
        tmp = 1
res += plus(tmp)


print(res)





Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  int n, W;
  cin >> n >> W;
  int w[n], v[n];
  for(int i = 0; i < n; i++){
    cin >> w[i] >> v[i];
  }
  ll dp[W+1] = {};
  for(int i = 0; i < n; i++){
    for(int j = W - w[i]; j >= 0; j--){
      dp[j+w[i]] = max(dp[j] + v[i], dp[j+w[i]]);
    }
  }
  ll ans = 0;
  for(int i = 0; i <= W; i++){
    ans = max(ans, dp[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
from decimal import *
getcontext().prec = 1000
a, b, c = map(lambda x: Decimal(x), input().split())

if a.sqrt() + b.sqrt() + Decimal('0.00000000000000000000000000000000000000000000000000000000000000000001') < c.sqrt():
    print('Yes')
else:
    print('No')



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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"
*/

bool binarySearch(int arr[], int dim, int key){
    int left = 0, right = dim;
    while(left < right){
        int mid = (left + right) / 2;
        if(arr[mid] == key){
            return true;
        }else if(key < arr[mid]){
            right = mid;
        }else if(key > arr[mid]){
            left = mid + 1;
        }
    }
    return false;
}

int main()
{
    int An; cin >> An;
    int A[An];
    for(int i=0; i<An; i++){
        int Ai; cin >> Ai;
        A[i] = Ai;
    }
    int Bn; cin >> Bn;
    int B[Bn];
    int count = 0;
    for(int i=0; i<Bn; i++){
        int Bi; cin >> Bi;
        if(binarySearch(A, An, Bi)) count += 1;
    }
    cout << count << endl;
}


Measured memory_bytes: 3472
from functools import reduce
S = int(input())
mod = 10**9 + 7

def cmb(n, r):
    r = min(r, n - r)
    if r == 0: return 1
    numerator = reduce(lambda x, y: x*y%mod, [n - r + 1 + k for k in range(r)])
    denominator = reduce(lambda x, y: x*y%mod, [k + 1 for k in range(r)])
    return numerator * pow(denominator, mod - 2, mod) % mod

ans = 0
m = S//3
for i in range(1, m+1):
    left = S - i*3
    ans = (ans + cmb(left + i - 1, i - 1)) % mod

print(ans)

Measured memory_bytes: 74064
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.StringTokenizer

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)
    val s = sc.next()
    println(if (listOf("hi", "hihi", "hihihi", "hihihihi", "hihihihihi").contains(s)) "Yes" else "No")
}



class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}




Measured memory_bytes: 33600
import qualified Data.ByteString.Char8 as C
import qualified Data.IntMap.Strict as M
import Data.List

main = C.interact $ C.pack . show . sol . get

get = fmap (unfoldr (C.readInt . C.dropWhile (==' '))) . C.lines

sol [[n],as] = maximum $ zipWith (+) lsum rsum
  where
  lsum = fmap snd $ scanl' f (sl,sum al) am
  rsum = fmap snd $ scanr (flip f) (sr,sum ar') (negate <$> am)
  (al:am:ar:_) = unfoldr (\xs -> if null xs then Nothing else Just (splitAt n xs)) as
  ar' = negate <$> ar
  sl = M.fromListWith (+) $ zip al (repeat 1)
  sr = M.fromListWith (+) $ zip ar' (repeat 1)

f (s,x) a = if a>k then (delins a k s, x+a-k) else (s,x)
  where k = fst $ M.findMin s

delins a k = M.insertWith (+) a 1 . 
  M.update (\c -> if c==1 then Nothing else Just (c-1)) k

Measured memory_bytes: 167292
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	int max1=max(a,max(b,c));
	int sum=a+b+c-max1;
	int k;
	cin>>k;
	cout<<max1*pow(2,k)+sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<string.h>

const int MAXN = 1000000000;
const int MAX_BOUND = 31623;

struct PrimeInfo
{
	int v;
	int cnt;
};
struct PrimeInfoArr
{
	PrimeInfo arr[MAX_BOUND];
	int len;
};

PrimeInfoArr piarr;
char isprime[MAX_BOUND];

bool is_prime(const int n) {
	int b = (int)sqrt(n) + 1;
	for (int i = 2; i < b; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

void init() {
	memset(&piarr, 0, sizeof(piarr));
	memset(isprime, -1, sizeof(isprime));
	//set the primes
	for (int i = 2; i < MAX_BOUND; i++) {
		if (isprime[i]) {
			for (int j = i * i; j < MAX_BOUND; j += i) {
				isprime[j] = 0;
			}
		}
	}
}

void getrs(const int n) {
	int b = std::min(MAX_BOUND - 1, n -1);
	int rn = n;
	//is a prime
	if ( (n < MAX_BOUND && isprime[n]) || (n >= MAX_BOUND && is_prime(n)) ){
		printf("%d: %d\n", n, n);
		return;
	}
	for (int i = 2; i < b; i++) {
		if (rn == 1) { break; }
		if (isprime[i] && (rn % i == 0)) {
			piarr.arr[piarr.len].v = i;
			while (rn % i == 0) {
				piarr.arr[piarr.len].cnt++;
				rn /= i;
			}
			piarr.len++;
		}
	}
	printf("%d:", n);
	for (int i = 0; i < piarr.len; i++) {
		for (int j = 0; j < piarr.arr[i].cnt; j++) {
			printf(" %d", piarr.arr[i].v);
		}
	}
	putchar('\n');
}

int main() {
	int n;
	init();
	scanf("%d", &n);
	getrs(n);
	return 0;
}


Measured memory_bytes: 3004
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>

using namespace std;
void trace(int *a, int n)
{
    for (int k = 0; k < n; k++)
    {
        if (k != 0)
            cout << ' ';
        cout << a[k];
    }
    cout << '\n';
}
int main() {
    int n;
    cin >> n;
    int *a = new int[n];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    int c = 0;
    bool flag = true;
    while(flag) {
        flag = false;
        for(int j=n-1; j>=1; j--) {
            if(a[j] < a[j-1]) {
                int t = a[j];
                a[j] = a[j-1];
                a[j-1] = t;
                flag = true;
                c++;
            }
        }
    }
    trace(a, n);
    cout << c << endl;
}


Measured memory_bytes: 3104
def main():
    from collections import Counter
    n = int(input())
    As = list(map(int,input().split(" ")))

    cnts = Counter(As)
    ns = [cnts.get(i,0)*(cnts.get(i,0)-1)/2 for i in range(1,n+1)]
    sumn = sum(ns)
    for i in As:
        k = cnts.get(i,0)
        ct = sumn - k*(k-1)/2 + (k-1)*(k-2)/2
        print(int(ct))
main()

Measured memory_bytes: 25900
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e13;
const int mod = 1e9+7;
#define ll long long
map<char, int> m;
signed main() {
    string s;
    cin >> s;
    bool f = true;
    if(s.find("N")<s.length()&&s.find("N")>=0) {
        //cout << s.find("W")  << endl;
        if(s.find("S")<0||s.find("S")>=s.length()) {

            f = false;
        }
    }
    if(s.find("S")<s.length()&&s.find("S")>=0) {
        //cout << s.find("W")  << endl;
        if(s.find("N")<0||s.find("N")>=s.length()) {

            f = false;
        }
    }
    if(s.find("W")<s.length()&&s.find("W")>=0) {
        if(s.find("E")<0||s.find("E")>=s.length()) {
            f = false;
        }
    }
    if(s.find("E")<s.length()&&s.find("E")>=0) {
        if(s.find("W")<0||s.find("W")>=s.length()) {
            f = false;
        }
    }
    if(f)cout << "Yes" << endl;
    else cout << "No" << endl;
  return 0;
}



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

using namespace std;

int main(){
    char c;
    scanf(" %c",&c);

    if (c == 'a' || c=='i'||c=='u'||c=='e'||c=='o'){
        printf("vowel\n");
    }else{
    printf("consonant\n");
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
struct edge { int to, cost; };

string s[501];
char ar[501][501], br[501][501];

void disp(int h, int w) {
	rep(i, h) {
		rep(j, w)cout << ar[i][j];
		cout << endl;
	}
	cout << endl;
	rep(i, h) {
		rep(j, w) {
			cout << br[i][j];
		}
		cout << endl;
	}
}
signed main() {
	int h, w; cin >> h >> w;
	rep(i, h)cin >> s[i];
	rep(i, h)rep(j, w) {
		ar[i][j] = '.'; br[i][j] = '.';
	}
	rep(i, h) {
		rep(j, w) {
			if (i & 1)ar[i][j] = '#';
			else br[i][j] = '#';
		}
	}
	rep(i, h) {
		ar[i][0] = '#';
		ar[i][w - 1] = '.';
		br[i][0] = '.';
		br[i][w - 1] = '#';
	}

	rep(i, h) {
		rep(j, w) {
			if (s[i][j] == '#') {
				if (i & 1)br[i][j] = '#';
				else ar[i][j] = '#';
			}
		}
	}
	disp(h, w);
}

Measured memory_bytes: 1536
#include <stdio.h>
int main () {
	int X_ryokin,Y_kihon,Y_jogen,Y_tuika,siyo;
	int min,X_sum,Y_sum,tuika = 0;
	scanf("%d",&X_ryokin);
	scanf("%d",&Y_kihon);
	scanf("%d",&Y_jogen);
	scanf("%d",&Y_tuika);
	scanf("%d",&siyo);

	X_sum = X_ryokin * siyo;

	if (siyo <= Y_jogen) {
		Y_sum = Y_kihon;
	} else {
		for(siyo; siyo > Y_jogen; siyo--) {
			tuika = tuika + Y_tuika;
		}
		Y_sum = Y_kihon + tuika;
	}
	if (X_sum > Y_sum) {
		min = Y_sum;
	} else {
		min = X_sum;
	} 
	printf("%d\n",min);
}

Measured memory_bytes: 1024
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  s=S()

  if n%2==1:
    return 'No'

  if s[:n//2]==s[n//2:]:
    return 'Yes'
  return 'No'

# main()
print(main())


Measured memory_bytes: 6860
#include <bits/stdc++.h>
using namespace std;
#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 ALL(a) a.begin(),a.end()
int main()
{
    int N;
    string S;
    cin >> N >> S;
    int count = 0;
    int pos = S.find("ABC");
    while(pos!=string::npos){
        count ++;
        pos = S.find("ABC",pos+3);
    }
    cout << count << endl;
    return 0;
}

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

const int mod = 998244353;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x=0):x((x%mod+mod)%mod){}
	mint operator-() const { return mint(-x);}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
		return a;
	}
	
	// for prime mod
	mint inv() const {
		return pow(mod-2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res/=a;
	}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

// combination c(n);
// mint ans = c(n, k);
// cout << ans.x << endl;
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

mint power(ll x, ll n) {
	mint ret = 1;
	while(0 < n){
		if((n % 2) == 0){
			x *= x;
			n >>= 1;
		}else{
			ret *= x;
			--n;
		}
	}
	return ret;
}

int main() {
	ll n, m, k;
	cin >> n >> m >> k;
	mint ans = 0;
	// rep(i, n-1) ans *= m-1;
	
	combination c(n);
	for(int i = 0; i <= k; i++) {
		mint nc = c(n-1, i);
		mint now = nc * m;
		mint a = m-1;
		now *= a.pow(n-i-1);
		// rep(j, n-1-i) now *= m-1;
		ans += now;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6336
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>
using namespace std;

//#include<bits/stdc++.h>

int main() {
	
	string s;
	cin >> s;
	int r = 700;
	for (int i = 0; i < s.size(); i++)if (s[i] == 'o')r += 100;
	cout << r << endl;

	return 0;
}

Measured memory_bytes: 256
n=list(input())
for i in range(len(n)):
  n[i]=int(n[i])
n.reverse()
n.append(0)
ans=0
l=[]
for i in range(len(n)-1):
  if n[i]<5 or (n[i]==5 and n[i+1]<5):
    ans+=n[i]
  else:
    ans+=10-n[i]
    n[i+1]+=1
ans+=n[-1]
print(ans)

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

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

	long long gcd = __gcd( A, B );
	set<long long> st;
	for( long long i = 2; i * i <= gcd; i++ ) {
			while( gcd % i == 0 ) {
				gcd /= i;
				if( st.count( i ) == 0 ) st.insert( i );
			}
	}
	st.insert( 1 );
	if( gcd != 1 ) st.insert( gcd );
	long long ans = st.size();

	cout << ans << endl;
}


Measured memory_bytes: 3644
import math
from itertools import combinations
d,g = map(int,input().split())
x = []
for i in range(d):
    x1,y1=[int(i) for i in input().split()]
    x.append([x1,y1])
zy = [i for i in range(1,d+1)]
zyu = []
for i in range(d+1):
  zyu.extend(list(combinations(zy, i)))
ans2 = 100000000000000000000000
gou = g+0
for i in zyu:
  ans = 0
  g = gou +0
  for j in i:
    g -= (x[j-1][0] * j*100 + x[j-1][1])
    ans += x[j-1][0]
  if g >0:
    y = d+0
    while y in i:
      y -= 1
    a = x[y-1][0]
    if g > a*y*100:
      continue
    ans += math.ceil(g/(y*100))
  ans2 = min(ans,ans2)
print(ans2)

Measured memory_bytes: 3188
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());

    let a = scan.read::<f64>();
    let b = scan.read::<f64>();
    let x = scan.read::<f64>();
    println!("{}", if x < a * a * b / 2.0 {kdh(f64::atan2(b*b*a, 2.0*x))} else {kdh(f64::atan2(2.0*a*a*b-2.0*x, a*a*a))});
}

fn kdh(rad: f64) -> f64 {
    rad * 180.0 / std::f64::consts::PI
}

// region template
#[allow(dead_code)]
fn iu(i: i64) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> i64 { i as i64 }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

#[allow(dead_code)]
fn arr<'a, S, T>(n: usize, mut f: S) -> Vec<T> where S: FnMut(usize) -> T + 'a {
    (0..n).map(|i| f(i)).collect::<Vec<T>>()
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion

Measured memory_bytes: 4476
#include <cstdio>

int main(){
    int a,b,c,n;
    scanf("%d %d %d",&a,&b,&c);
    scanf("%d",&n);
    int d[3] = {a,b,c};
    int maxi = 0;
    for(int i = 0; i < 3; i++){
        if(d[i] > d[maxi]){
            maxi = i;
        }
    }

    int ans = 0;
    for(int i = 0; i < 3; i++){
        if(i != maxi){
            ans += d[i];
        }else{
            for(int j = 1; j <= n; j++){
                d[i] = d[i] * 2;
            }
            ans += d[i];
        }
    }
    printf("%d\n",ans);

    return 0;
}

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

using namespace std;
typedef long long ll;

int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a.at(i);
    }

    vector<vector<bool>> ok1(n, vector<bool>(k, false));
    {
        ok1.at(0).at(0) = true;
        for(int i = 0; i < n - 1; ++i){
            copy(ok1.at(i).begin(), ok1.at(i).end(), ok1.at(i + 1).begin());
            for(int j = 0; j < k; ++j){
                if(ok1.at(i).at(j) && j + a.at(i) < k){
                    ok1.at(i + 1).at(j + a.at(i)) = true;
                }
            }
        }
    }

    vector<vector<bool>> ok2(n, vector<bool>(k, false));
    {
        ok2.at(n - 1).at(0) = true;
        for(int i = n - 1; i > 0; --i){
            copy(ok2.at(i).begin(), ok2.at(i).end(), ok2.at(i - 1).begin());
            for(int j = 0; j < k; ++j){
                if(ok2.at(i).at(j) && j + a.at(i) < k){
                    ok2.at(i - 1).at(j + a.at(i)) = true;
                }
            }
        }
    }

    ll ans = 0;
    for(int i = 0; i < n; ++i){
        vector<ll> v1, v2;
        for(int j = 0; j < k; ++j){
            if(ok1.at(i).at(j)){ v1.push_back(j); }
            if(ok2.at(i).at(j)){ v2.push_back(j); }
        }
        ll tmp = 0;
        ll i1 = 0, i2 = v2.size() - 1;
        while(i1 < v1.size() && i2 >= 0){
            if(v1.at(i1) + v2.at(i2) < k){
                tmp = max(tmp, v1.at(i1) + v2.at(i2));
                i1++;
            }else{
                i2--;
            }
        }
        if(tmp + a.at(i) < k){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

void solve() {
  string s, s_b = "", s_a = "", ans;
  char c;
  int q, t, f;
  bool reversed = false;
  cin >> s >> q;
  REP(i, q) {
    cin >> t;
    if (t == 1) {
      reversed = !reversed;
    } else {
      cin >> f >> c;
      if ((f == 1 && !reversed) || (f == 2 && reversed)) {
        s_b += c;
      } else {
        s_a += c;
      }
    }
  }
  if (reversed) {
    reverse(ALL(s));
    reverse(ALL(s_a));
    ans = s_a + s + s_b;
  } else {
    reverse(ALL(s_b));
    ans = s_b + s + s_a;
  }
  cout << ans << endl;
}

signed main() {
  solve();

  return 0;
}

Measured memory_bytes: 1348
#include <algorithm>  // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>     // bitset
#include <cctype>     // isupper, islower, isdigit, toupper, tolower
#include <cstdint>    // int64_t, int*_t
#include <cstdio>     // printf
#include <deque>      // deque
#include <iomanip>    // fixed, setprecision
#include <iostream>   // cout, endl, cin
#include <map>        // map
#include <queue>      // queue, priority_queue
#include <set>        // set
#include <stack>      // stack
#include <string>     // string, to_string, stoi
#include <tuple>      // tuple, make_tuple
#include <unordered_map>  // unordered_map
#include <unordered_set>  // unordered_set
#include <utility>        // pair, make_pair
#include <vector>         // vector
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main() {
  ll L, R, im, mo, mi = 2019;
  cin >> L >> R;

  for (ll i = L; i <= min(R - 1, L + 2019); i++) {
    im = i % 2019;
    for (ll j = i + 1; j <= min(R, i + 2020); j++) {
      mo = (im * j) % 2019;
      mi = min(mi, mo);
    }
  }
  cout << mi << endl;
}


Measured memory_bytes: 3196
#include<bits/stdc++.h>
#define int long long int
#define nitro ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define pb push_back
#define PI 3.1415926535897932384626
#define MOD 1000000007
#define DEBUG false
#pragma GCC optimize "trapv"

using namespace std;

void dfs(vector<int> adj[],int node,int dp[],bool vis[])
{
    vis[node]=true;
    for(int i=0;i<adj[node].size();++i)
    {
        if(!vis[adj[node][i]])
        dfs(adj,adj[node][i],dp,vis);
        dp[node]=max(dp[node],1+dp[adj[node][i]]);
    }
}

int longest(vector<int> adj[],int n)
{
    int dp[n+1];
    memset(dp,0,sizeof(dp));
    bool vis[n+1]={false};
    for(int i=1;i<=n;++i)
    {
        if(!vis[i])
        dfs(adj,i,dp,vis);
    }
    int ans=*max_element(dp,dp+n+1);
    return ans;
}
 
int32_t main()
{
    nitro;
    int n,m;
    cin>>n>>m;
    vector<int> adj[n+1];
    int u,v;
    for(int i=0;i<m;i++)
    {
        cin>>u>>v;
        adj[u].pb(v);
    }
    cout<<longest(adj,n);
return 0;
}

Measured memory_bytes: 9984
#include <bits/stdc++.h> 
 
using namespace std;
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
bool m[10][10];

int main(){
    CLR(m);
    int N,M;
    cin>>N>>M;
    REP(i,M){
        int a,b;
        cin>>a>>b;a--;b--;
        m[a][b]=m[b][a]=1;
    }
    vector<int>vec;
    REP(i,N-1)vec.PB(i+1);
    int res=0;
    do{
        bool flag=true;
        if(!m[0][vec[0]])continue;
        REP(i,SZ(vec)-1){
            if(!m[vec[i]][vec[i+1]]){
                flag=false;break;
            }
        }
        res+=flag;
    }while(next_permutation(ALL(vec)));
    cout<<res<<endl;
    return 0;
}


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

int a,b,c;
int main(){
	cin>>a>>b>>c;
	int ans=abs(a-b)+abs(b-c);
	ans=min(ans,abs(a-b)+abs(a-c));
	ans=min(ans,abs(a-c)+abs(b-c));
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
monsterList = [int(x) for x in input().split()]

atackTimes = 0

monsterList.sort()
if K != 0:
    for hp in monsterList[:-K]:
        atackTimes += hp
else:
    for hp in monsterList:
        atackTimes += hp

print(atackTimes)

Measured memory_bytes: 25768
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

int main(){
  ll n, a, b;
  cin >> n >> a >> b;

  cout << (n/(a+b))*a + min(n%(a+b), a) << endl;

  return 0;
}


Measured memory_bytes: 256
s = require("fs").readFileSync("/dev/stdin","utf8").split('\n')
n = s[0].split(' ')[0] | 0
k = s[0].split(' ')[1] | 0
s.shift()
s = s.map(n => n | 0).sort((a, b) => b - a)
a = 1000000000
for (i = 0; i < n - k + 1; i++) {
	t = s[i] - s[i + k - 1]
	a > t && (a = t)
}
console.log(a)


Measured memory_bytes: 28624
using System;
using System.Collections.Generic;

namespace ABC102B
{
    public class B_MaximumDifference
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var ai = Console.ReadLine();
            Console.WriteLine(CalcMaximumDiff(N, ai));
        }

        public static int CalcMaximumDiff(int N, string Ai)
        {
            var aiArray =  Ai.Split(' ');
            var intAiArray = new List<int> { };

            for (int i = 0; i < N; i++)
            {
                intAiArray.Add(int.Parse(aiArray[i]));
            }
            var result = 0;

            // 配列を昇順ソートし、1番目の要素と、最後の要素の差を返す
            intAiArray.Sort();
            result = intAiArray[^1] - intAiArray[0]; 

            return result;
        }
    }
}


Measured memory_bytes: 27476
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>

using namespace std;

#define C_MAX(a, b) ((a)>(b)?(a):(b))
#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v) {std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

constexpr int INF = 1e7;

int main() {

    while (true) {

        int N;
        cin >> N;

        if (N == 0) break;

        vector<int> p(N + 1), t(N + 1);
        p[0] = t[0] = 0;
        for (int i = 0; i < N; i++) cin >> p[i + 1] >> t[i + 1];

        vector<vector<vector<int>>> dp(N + 1, vector<vector<int>>(110, vector<int>(4, INF)));
        dp[0][0][0] = 0;

        bool already = false;

        for (int i = 0; i < N; i++) {

            int pre_pos = p[i];
            int pre_time = t[i];

            int pos = p[i + 1];
            int time = t[i + 1];

            bool good = false;

            for (int j = 0; j <= 100; j++) {

                for (int k = 0; k < 4; k++) {
                    if (dp[i][j][k] != INF) {
                        if (k < 3) {
                            int need_time = abs(pos - j) * (k + 1);
                            if (time - pre_time >= need_time) {
                                dp[i + 1][pos][k + 1] = min(dp[i + 1][pos][k + 1], dp[i][j][k] + abs(pos - j));
                                good = true;
                            }
                        }
                        int need_time = abs(j - 0) * (k + 1) + abs(pos - 0);
                        if (time - pre_time >= need_time) {
                            dp[i + 1][pos][1] = min(dp[i + 1][pos][1], dp[i][j][k] + abs(j - 0) + abs(pos - 0));
                            good = true;
                        }
                    }
                }
            }

            if (!good) {
                cout << "NG" << " " << i + 1 << endl;
                already = true;
                break;
            }

        }

        if (!already) {
            int minV = INF;
            for (int i = 0; i < 4; i++) minV = min(dp[N][p[N]][i] + p[N], minV);

            if (minV == INF) {
                //cout << "NG";
            } else {
                cout << "OK" << " " << minV << endl;
            }
        }
    }

    return 0;
}























































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

using namespace std;

typedef long long llint;

string s;

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> s;
    cout << s.substr(0, 4) << " " << s.substr(4) << endl;
    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>

using namespace std;
#define ll long long

int main()
{
    ll n,m;
    ll sum;

    while(scanf("%lld%lld",&n,&m) != EOF)
    {
        if(n*2 == m)
        {
            sum = n;
        }
        else if(n*2 > m)
        {
            sum = m/2;
        }
        else
        {
            sum = n + (m-2*n)/4;
        }
        printf("%lld\n",sum);
    }

    return 0;
}


Measured memory_bytes: 256
// AOJ1166  
#include <bits/stdc++.h>
#define endl "\n"
#define _GLIBCXX_DEBUG //配列外参照エラー表示,gcc依存
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ipair;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
namespace you {
    std::string to_string(char val) {
        return std::string(1, val);
        // return std::string{val};
        // you::to_string(char)
    }
}
vector<int> yy={0,-1,0,1};
vector<int> xx={-1,0,1,0};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int X,Y;
    while(cin>>X>>Y){
        if(X==0 && Y==0) break;
        vector<vector<int>> tatekabe(Y,vector<int>(X-1));
        vector<vector<int>> yokokabe(Y-1,vector<int>(X));
        rep(i,X-1) cin>>tatekabe[0][i];
        rep(i,Y-1){
            rep(j,X){
                cin>>yokokabe[i][j];
            }
            rep(j,X-1){
                cin>>tatekabe[i+1][j];
            }
        }
        //cout<<tatekabe<<endl;
        //cout<<yokokabe<<endl;
        vector<vector<int>> dis(Y,vector<int>(X,-1));
        dis[0][0]=1;
        queue<ipair> next;
        next.push(ipair(0,0));
        int ans=0;
        while(!next.empty()){
            ipair q=next.front();
            int cy=q.first,cx=q.second;
            next.pop();
            rep(i,4){
                int ny=cy+yy[i],nx=cx+xx[i];
                if(ny<0||Y<=ny||nx<0||X<=nx) continue;
                if(dis[ny][nx]!=-1) continue;
                if(ny==cy){
                    if(tatekabe.at(ny).at(min(nx,cx))==1) continue; //縦の壁がある
                    dis[ny][nx]=dis[cy][cx]+1;
                    next.push(ipair(ny,nx));
                }else if(nx==cx){
                    if(yokokabe.at(min(ny,cy)).at(nx)==1) continue; //横の壁がある
                    dis[ny][nx]=dis[cy][cx]+1;
                    next.push(ipair(ny,nx));
                }
            }
            if(dis[Y-1][X-1]!=-1){
                ans=dis[Y-1][X-1];
                break;
            }
        }
        cout<<ans<<endl;
    }

    return 0;
}


Measured memory_bytes: 3160
#include<math.h>
#include<algorithm>
#include<deque>
#include<vector>
#include <iostream>
#include<map>
#include<stack>
#include <string>
using namespace std;
int main()
{
    long long n;
        cin >> n;
        long long k, a=0;
        long long* m = new long long[n];
        long long i = 0;
        cin >> k;
        i = n-1;
        while (i>=0) {
            cin >> m[i];
            i--;
            
        }
        sort(m, m + n);
        for (long long i = n-k-1; i >=0 ; i--) {
            a += m[i];


        }
        cout << a << endl;


    return 0;
}


Measured memory_bytes: 1792
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
cnt = 0

S.sort()
for i in range(n):
    for j in range(q):
        if S[i] == T[j]:
            if S[i-1] != S[i]:
                cnt += 1
print(cnt)




Measured memory_bytes: 6324