akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define F(i,a,b) for(long long  i =a; i<b; i++)
#define rF(i,a,b) for(long long i=a-1; i>=b;i--)
#define endl "\n"
#define min1(x,y,z) min(x, min(y,z))
#define max1(x,y,z) max(x, max(y,z))
#define input_vector(v,n,type) vector<type> v;for(int i=0;i<n;i++){type x;cin>>x;v.push_back(x);}
#define IOS ios_base::sync_with_stdio(false);  cin.tie(NULL);  cout.tie(NULL);
#define int long long
#define inf (1LL<<61)
typedef pair<int,int> ii;
typedef vector<pair<int,int>> vii;
typedef vector<int> vi;
 
 
 
int32_t main()
{
        IOS;

        int n;
        cin>>n;


        vector<int> v(n);
        map<int, int> mp;
        for (int i = 0; i < n; i++) {
                cin>>v[i];
                mp[v[i]]++;
        }

        map<int, int> ans;
        int tot = 0;
        for (auto u: mp) {
                int cnt = u.second;
                ans[u.first] = cnt*(cnt-1)/2-(cnt-1)*(cnt-2)/2;
                tot += cnt*(cnt-1)/2;
        }

        for (int i = 0; i < n; i++) {
                cout<<tot-ans[v[i]]<<" ";
        }
        cout<<endl;







        
 
 
 
            
 
 
 
      
 
 
        
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
        return 0;
}

Measured memory_bytes: 18944
# coding: utf-8
# Your code here!
N=int(input())
l=[0]*5

for _ in range(N):
    S=input()
    if S[0]=="M":
        l[0]+=1
    elif S[0]=="A":
        l[1]+=1
    elif S[0]=="R":
        l[2]+=1
    elif S[0]=="C":
        l[3]+=1
    elif S[0]=="H":
        l[4]+=1
    else:
        pass
count=0
for i in range(3):
    for j in range(i+1,4):
        for k in range(j+1,5):
            count+=l[i]*l[j]*l[k]

print(count)
    

Measured memory_bytes: 3064
import java.io.*;

class Main{
 public static void main(String[] args)throws IOException{
   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
   String[] strAry; 
   int H,W,i,j;
      
   while(true){
     strAry = br.readLine().split(" ");
     H = Integer.parseInt(strAry[0]);  
     W = Integer.parseInt(strAry[1]);
     if(H==0&&W==0) break;
     for(j=0;j<H;j++){
       for(i=0;i<W;i++){
         System.out.print("#");
       }
       System.out.print("\n");  
     }     
     System.out.print("\n");  
     
    }  
      


  }
}

Measured memory_bytes: 34916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll calc(ll n, vector<ll>& a, ll s, ll sum)
{
    ll ret = s;
    ll S = sum;
    for (int i = 1; i < n; i++) {
        if (S > 0) {
            if (S + a[i] < 0) {
                S += a[i];
            } else {
                ret += abs(S + a[i]) + 1;
                S = -1;
            }
        } else {
            if (S + a[i] > 0) {
                S += a[i];
            } else {
                ret += abs(S + a[i]) + 1;
                S = 1;
            }
        }
    }
    return ret;
}
int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (auto& in : a)
        cin >> in;
    cout << min(
                calc(n, a, a[0] > 0 ? 0 : abs(a[0]) + 1, a[0] > 0 ? a[0] : 1),
                calc(n, a, a[0] < 0 ? 0 : abs(a[0]) + 1, a[0] < 0 ? a[0] : -1))
         << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define inf 1e9
#define mod 1000000007
#define ff first
#define ss second

void solve()
{
	string s;
	cin >> s;
	if (s == "ABC")
		cout << "ARC";
	else
		cout << "ABC";
}

signed main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	solve();
	return 0;
}


Measured memory_bytes: 3576
// Try Tenka1
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    
    let s = get().as_bytes();
    
    if s.len() == 2 {
    	print!("{}", s[0] as char);
    	println!("{}", s[1] as char);
    } else {
    	print!("{}", s[2] as char);
    	print!("{}", s[1] as char);
    	println!("{}", s[0] as char);
    }
}

Measured memory_bytes: 4352
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import combinations, product
#import bisect# lower_bound etc
import numpy as np
def run():
    N,K = map(int, sysread().split())
    A = [0] + list(map(int, sysread().split()))

    seen = [False] * (N+1)
    arr = [1]
    seen[1] = True
    while True:
        next = A[arr[-1]]
        if seen[next]:
            arr.append(next)
            break
        arr.append(next)
        seen[next] = True
    arr = np.array(arr)
    x = int(math.log2(K)) + 1
    dub = np.array([[0] * (N+1) for _ in range(x)])
    dub[0, arr[:-1]] = np.array(arr[1:])
    for d in range(1,x):
        next1 = dub[d-1, arr[:-1]]
        next2 = dub[d-1, next1]
        dub[d, arr[:-1]] = next2

    ret = 1
    while K:
        d = int(math.log2(K))
        K -= 1 << d
        ret = dub[d][ret]
    print(ret)

if __name__ == "__main__":
    run()

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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

ll in(int a, int b, int c, int d, int e, int f) {
  return a * d + b * e + c * f;
}

int main() {

  int n, q; cin >> n >> q;
  vector<ll> x(n), y(n), z(n), r(n), l(n);
  for(int i=0;i<n;++i) {
    cin >> x[i] >> y[i] >> z[i] >> r[i] >> l[i];
  }
  int sx, sy, sz, dx, dy, dz;
  for(int i=0;i<q;++i) {
    cin >> sx >> sy >> sz >> dx >> dy >> dz;
    int vx = dx - sx, vy = dy - sy, vz = dz - sz;
    ll ans = 0;
    for(int j=0;j<n;++j) {
      int a = sx - x[j], b = sy - y[j], c = sz - z[j];
      ll D = in(a, b, c, vx, vy, vz) * in(a, b, c, vx, vy, vz) - in(vx, vy, vz, vx, vy, vz) * (in(a, b, c, a, b, c) - r[j] * r[j]);
      if(D < 0) continue;
      double t1 = (-in(a, b, c, vx, vy, vz) + sqrt(D)) / in(vx, vy, vz, vx, vy, vz), t2 = (-in(a, b, c, vx, vy, vz) - sqrt(D)) / in(vx, vy, vz, vx, vy, vz);
      if((t1 >= 0 && t1 <= 1) || (t2 >= 0 && t1 <= 1)) ans += l[j];
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 3120
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt(),m=nxt();
    vector <int> v(n);
    generate(all(v),nxt);
    sort(all(v),greater<int>());
    int sum=0;
    for(auto i:v)
        sum+=i;
    double x=sum;
    x/=(4*m);
    bool f=1;
    //cout<<x<<endl;
    for(int i=0;i<m;i++)
        if(v[i]<x)
        {
            f=0;
            break;
        }
    if(!f)
        cout<<"No\n";
    else
        cout<<"Yes\n";

    
    return 0;   
}




 
 


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

using namespace std;

int main() {
	long n, s, a, ans, j, m = 998244353, d[3001] = {};
	cin >> n >> s;
	while (n--) {
		cin >> a;
		for (j = s; j >= a; j--)
			d[j] = (d[j] + d[j - a]) % m;
		d[a]++;
		d[0]++;
		ans += d[s];
	}
	cout << ans % m << endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

S = input()
n = len(S)
T = []

for i in range(len(S)-1):
    if S[i] != S[i+1]:
        t = max(i+1, n-i-1)
        T.append(t)
if len(T) == 0:
    print(n)
else:
    print(min(T))


Measured memory_bytes: 5212
//%std
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define y1 ysgh
inline int read()
{
	int out = 0, fh = 1;
	char jp = getchar();
	while ((jp > '9' || jp < '0') && jp != '-') jp = getchar();
	if (jp == '-')
	   fh = -1, jp = getchar();
	while (jp >= '0' && jp <= '9') out = out * 10 + jp - '0', jp = getchar();
	return out * fh;
}
void print(int x)
{
	if (x >= 10)
	   print(x / 10);
	putchar('0' + x % 10);
}
void write(int x, char c = '\n')
{
	if (x < 0)
	   putchar('-'), x = -x;
	print(x);
	putchar(c);
}
namespace Module
{
	const int P = 1e9 + 7;
	int add(int a, int b) {return a + b >= P ? a + b - P : a + b;}
	void inc(int &a, int b) {a = add(a, b);}
	void dec(int &a, int b) {a = add(a, P - b);}
	int mul(int a, int b) {return 1LL * a * b % P;}
	int fpow(int a, int b)
	{
		int res = 1;
		while (b)
		{
			if (b & 1) res = mul(res, a);
			a = mul(a, a);
			b >>= 1;
		}
		return res;
	}
}
using namespace Module;
const int N = 1e6 + 10;
int n, f[N], pos[N];
int main()
{
//	freopen("magic.in", "r", stdin);
//	freopen("magic.out", "w", stdout);
	n = read();
	f[0] = 1;
	for (int i = 1; i <= n; ++i)
	{
		f[i] = f[i - 1];
		int c = read();
		int j = pos[c];
		if (j && i - 1 > j)
			inc(f[i], f[j]);
		pos[c] = i;
	}
	write(f[n]);
	return 0;
}


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

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

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

/*==================================================*/
/*variable*/
ll H, W, A, B;
const ll MOD = 1000000007;
/*==================================================*/
/*function*/
class FermatCombination {
private:
    long long factrial[201010]; //階乗を保持
    long long inverse[201010];  //逆元を保持
    long long MOD;

public:
    FermatCombination(ll size, long long mod);
    long long combine(ll n, ll k);
    long long fast_pow(long long x, ll n);
};

FermatCombination::FermatCombination(ll size, long long mod) {

    MOD = mod;

    factrial[0] = 1;
    inverse[0] = 1;

    for (ll i = 1; i <= size; i++) {
        factrial[i] = (factrial[i - 1] * i) % MOD;  // 階乗を求める
        inverse[i] = fast_pow(factrial[i], (int)MOD - 2) % MOD; // フェルマーの小定理で逆元を求める
    }
}

long long FermatCombination::combine(ll n, ll k) {
    return factrial[n] * inverse[k] % MOD * inverse[n - k] % MOD;
}

long long FermatCombination::fast_pow(long long x, ll n) { // x^n 計算量O(logn)
    long long ans = 1;
    while (n > 0) {
        if ((n & 1) == 1) {
            ans = ans * x % MOD;
        }
        x = x * x % MOD; // 一周する度にx, x^2, x^4, x^8となる
        n >>= 1;         // 桁をずらす n = n >> 1
    }
    return ans;
}

/*==================================================*/

int main() {
    cin>>H>>W>>A>>B;

    FermatCombination fc(201000, MOD);     // 初期化と nCi % mod の計算

    ll ans = 0;
    REP(j,B,W){
        ll n1 = ((H - A -1) + j) % MOD;
        ll n2 = ((A-1) + (W-j-1)) % MOD;

        ll t1 = fc.combine(n1, j); // nCr % modの値の取得
        ll t2 = fc.combine(n2, (W-j-1)); // nCr % modの値の取得
        ans = (ans + (t1*t2) % MOD ) % MOD;
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int main(){
  long N, base=0, ans=0;
  cin >> N;
  long A[N];
  for(long i=0;i<N;i++){
    cin >> A[i];
    if(base < A[i])
      base = A[i];
    ans += base - A[i];
  }
  cout << ans;
}


Measured memory_bytes: 5116
#ifdef ONPC
    # define _GLIBCXX_DEBUG
#endif
#include <iostream>
#include <vector>
#include <cstdio>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <unordered_set>
#include <complex>
#include <unordered_map>
#include <bitset>
#include <ctime>
#include <cassert>
#include <random>
#include <iomanip>

#ifdef ONPC
    #define deb(a) cerr << "      " << #a << " = " << a << endl;
#else
    #define deb(a)
#endif

#define sz(a) (a).size()

using namespace std;
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnd(time(0));

typedef long long ll;
typedef long double ld;

int solve()
{
    char n;
    if (!(cin >> n))
        return 1;
    if (n == 'A')
        n = 'T';
    else if (n == 'T')
        n = 'A';
    else if (n == 'G')
        n = 'C';
    else if (n == 'C')
        n = 'G';
    cout << n << endl;
    return 0;
}

int32_t main()
{
    #ifdef ONPC
        freopen("in.txt", "r", stdin);
    #endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T = 1e9;
    //cin >> T;
    while (T--)
    {
        if (solve())
            break;
        #ifdef ONPC
            cout << "\n__________________________" << endl;
        #endif
    }
    #ifdef ONPC
        cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
    #endif
    return 0;
}



Measured memory_bytes: 256
n = gets.to_i
arr = gets.split(' ').map(&:to_i)
total = 0
arr.each { |i| total = total + i }
even_total = 0
for i in 0...n do
  next if i % 2 == 0
  even_total += arr[i]
end
results = [total - (2 * even_total)]
1.upto(n - 1) do |i|
  results.push(2 * arr[i - 1] - results[i - 1])
end
0.upto(n - 2) do |i|
  print "#{results[i]} "
end
puts results[n - 1]

Measured memory_bytes: 13068
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long int ll;
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}

int main()
{
   int n;
   cin>>n;
   vector<int>l(n);
   for(int i=0;i<n;i++)
   	cin>>l[i];
   int ans=0;
   sort(l.begin(),l.end());
   for(int i=0;i<n-1;i++)
   	for(int j=i+1;j<n;j++)
   	{
   		int x=l[i]+l[j];
   		int left=j+1;
   		int right=n;
   		int place;
   		while(left<right)
   		{int mid=(left+right)/2;
   			if(x<l[mid])
   				right=mid;
   			else
   				left=mid+1;

   		}
   		left--;

   		while(l[left]>=x)
   			left--;
   		if(left<=j)
   			continue;

   		ans+=left-j;
   		
   		
   	}
   	cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#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 ipr pair<ll,ll>
#define ps push_back
#define fs first
#define sc second
#define endl "\n"
#define mod 1000000007
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll x,y,z;
	cin>>x>>y>>z;

	ll a,b;
	a=(x-z);
	b=(y+z);
	a=a/b;
	cout<<a;
	
	return 0;
}


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

namespace Triple_Dots_0527_2問目
{
    class Program
    {
        static void Main(string[] args)
        {
            int K = Convert.ToInt32(Console.ReadLine());
            string S = Console.ReadLine();
           
         
            int A = S.Length;

            if(K>=A)
            {
                Console.WriteLine(S);
            }

            else
            {
                Console.WriteLine(S.Substring(0, K) + "...");
            }

        

            Console.Read();
        }
    }
}


Measured memory_bytes: 27556
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.nextLine());
		String a = sc.nextLine();
		String b = sc.nextLine();
		String c = sc.nextLine();
		
		int op = 0;
		
		for (int i = 0; i < n; i++) {
			final char chA = a.charAt(i);
			final char chB = b.charAt(i);
			final char chC = c.charAt(i);
			
			final boolean abMatch = chA == chB;
			final boolean acMatch = chA == chC;
			final boolean bcMatch = chB == chC;
			
			if (abMatch && acMatch) {
				// do nothing
			} else if (abMatch || acMatch || bcMatch) {
				op += 1;
			} else {
				op += 2;
			}
		}
		
		System.out.println(op);
	}

}

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

int n,m;
int G[301][301];
int d[301][301];
int vst[301];

void dfs(int x, int i){
    for (int j=1; j<=n; j++){
        if (G[i][j] && vst[j]==0){
            d[x][j]=1;
            vst[j]=1;
            dfs(x,j);
        }
    }
}

int main(){
    cin>>n>>m;
    for (int i=0; i<m; i++){
        int a,b;
        cin>>a>>b;
        G[a][b]=1;
    }
    for(int i=1; i<=n; i++){
        d[i][i]=1;
        for(int j=1; j<=n; j++){
            vst[j]=0;
        }
        dfs(i,i);
    }
    for (int i=1; i<=n; i++){
        bool flag=true;
        //cout<<"i="<<i<<":";
        for (int j=1; j<=n; j++){
            if(d[i][j] && d[j][i]){
                if(flag){
                    cout<<j;
                    flag=false;
                }else{
                    cout<<' '<<j;
                }
            }
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3816
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int k,m,n;
int main(){
	n=read();
	int x1,x2,x3;
	x1=n%10;n/=10;
	x2=n%10;n/=10;
	x3=n%10;
	if(x1==7 || x2==7 || x3==7)puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
int main(){
    
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    
    if ((a<=b && b<=c) || (b<=a && a<=c)) {
        printf("%d",a+b);
    }
    else if((a<=c && c<=b) || (c<=a && a<=b)){
        printf("%d",a+c);
    }
    else{
        printf("%d",b+c);
    }
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;}
#define dec(x,y) {x-=(y);if(x<0)x+=mod;}
using namespace std;
multiset<int> s;
int n,m,i,j,x;
int main()
{
	scanf("%d",&n);
	fz1(i,n){
		scanf("%d",&x);
		if(i==1||*s.begin()>=x){
			s.insert(x);
		}
		else{
			multiset<int>::iterator it=s.lower_bound(x);
			s.erase(--it);s.insert(x);
		}
	}
	cout<<s.size()<<endl;
	return 0;
}

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

int A[1000000], n;

int binarySearch(int key) {
  int left = 0;
  int right = n;
  int mid;
  while (left < right) {
    mid = (left + right) / 2;
    if (key == A[mid]) return 1;
    if (key > A[mid])
      left = mid + 1;
    else if (key < A[mid])
      right = mid;
  }
  return 0;
}

int main() {
  int i, q, k, sum = 0;

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

  scanf("%d", &q);
  for (i = 0; i < q; i++) {
    scanf("%d", &k);
    if (binarySearch(k)) sum++;
  }
  printf("%d\n", sum);

  return 0;
}


Measured memory_bytes: 3564
n = int(input())
s = list(input())

pointer1 = 0
pointer2 = 1
ans = []
ans.append(s[0])
while (pointer2 <= n-1):
  if s[pointer2] == s[pointer1]:
    pointer2 += 1
  elif s[pointer2] != s[pointer1]:
    pointer1 = pointer2
    pointer2 = pointer1 + 1 
    ans.append(s[pointer1])
    
print(len(ans))

Measured memory_bytes: 4648
from itertools import permutations, combinations,combinations_with_replacement,product
A,B=map(int,input().split())

a=[2 for i in range(A)]+[1 for i in range(B)]
b=list(combinations(a,2))
ans=0
for i in b:
    tmp=sum(i)
    if tmp%2==0:
        ans+=1
print(ans)

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

using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;

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

constexpr long long mod = 1000000007;

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

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

    int n;
    cin >> n;
    vector<string> v(n);
    rep(i, n) cin >> v[i];

    map<string, int> mp;
    mp["AC"] = 0;
    mp["WA"] = 0;
    mp["TLE"] = 0;
    mp["RE"] = 0;

    rep(i, n){
        mp[v[i]]++;
    }

    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
}

Measured memory_bytes: 6372
#include <bits/stdc++.h>
using namespace std;
int n;
vector <string> str;
string mem[15][15];
typedef pair <string,int> P;

string con(string a,string b){
  int K=0;
  for(int i=0;i<a.size();i++){
    int j=i,k=0;
    while(a[j]&&b[k]&&a[j]==b[k]) j++,k++;
    if(!a[j]||!b[k])K=max(K,k);
  }
  return b.substr(K,b.size());
}

string solve(int idx){
  string dp[1<<14][14];
  dp[(1<<idx)][idx]=str[idx];
  
  for(int i=0;i<(1<<n);i++){
    for(int k=0;k<n;k++){
      if(dp[i][k]=="")continue;
      for(int j=0;j<n;j++){
	if((i&(1<<j)))continue;
	string nx=dp[i][k]+mem[k][j];
	int ni=i|1<<j;
	if(!dp[ni][j].size()||nx.size()<dp[ni][j].size()) dp[ni][j]=nx;
	else if(nx.size()==dp[ni][j].size()&&dp[ni][j]>nx)dp[ni][j]=nx;
      }
    }
  }
  string res;
  for(int i=0;i<n;i++) {
    if(dp[(1<<n)-1][i]=="")continue;
    if(res==""||res.size()>dp[(1<<n)-1][i].size()) res=dp[(1<<n)-1][i];
    else if(dp[(1<<n)-1][i].size()==res.size()) res=min(res,dp[(1<<n)-1][i]);
  }
  return res;
}

int main(){
  
  while(cin>>n,n){
    str.resize(n);
    for(int i=0;i<n;i++)cin>>str[i];

    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++){
	if(i==j)continue;
	if(con(str[i],str[j])==""){
	  str.erase(str.begin()+j);
	  n--;
	  i=-1;
	  break;
	}
      }
    
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)mem[i][j]=con(str[i],str[j]);

    
    string ans=solve(0);
    for(int i=1;i<n;i++) {
      string res=solve(i);
      if(ans.size()>res.size()) ans=res;
      if(ans.size()==res.size()) ans=min(ans,res);
    }

    cout<<ans<<endl;
    //cout<<ans.size()<<endl;
  }

  return 0;
}

Measured memory_bytes: 3256
N = int(input())
s = [int(input()) for _ in range(N)]

if sum(s)%10 != 0:
    print(sum(s))
else:
    ans = sum(s)
    s.sort()
    for i in s:
        ans -= i
        if ans%10 != 0:
            print(ans)
            exit()
        ans += i
    print(0)

Measured memory_bytes: 3060
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int anum = sc.nextInt();
    int bnum = sc.nextInt();
    // String a[][] = new String[anum][bnum];
    String a[] = new String[anum];
    
    for(int i=0;i<anum;i++){
      // for(int j=0;j<bnum;j++){
        a[i] = sc.next();
      // }
    }
    for(int i=0;i<bnum+2;i++){
      System.out.print("#");
    }
    System.out.println();
    
    for(int i=0;i<anum;i++){
      System.out.print("#");
      // for(int j=0;j<bnum;j++){
        System.out.print(a[i]);
      // }
      System.out.print("#");
      System.out.println();
    }
    
    for(int i=0;i<bnum+2;i++){
      System.out.print("#");
    }
    
  }
}

Measured memory_bytes: 23124
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <list>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define sz(x) int(x.size())

typedef long long ll;

using namespace std;

/*******-c++14 don't include-*******/
template<typename T>
T gcd(T a, T b){if( b == 0)return a; return gcd(b, a%b); }
template<typename T>
T lcm(T a, T b){return a*b/gcd(a,b); }
/*******---------------------*******/

static const int INTINF = (2147483647);
static const ll LLINF = (1ll<<32);
static const int MAX = 100001;

int main(int argc, const char * argv[]) {
    // input from txt
    
    /////////
    //write//
    /////////
    
    int n;
    cin >> n;
    int *h;
    h = new int[101];
    ll res = 0;
    rep(i, n){
        cin >> h[i];
    }
    
    int now = 0;
    rep(i, n){
        if(h[i]>now){
            res += h[i] - now;
            now= h[i];
        }
        else {
            now = h[i];
        }
    }
    
    cout << res << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
using namespace std;
const int N=105;
char mp[N][N];
int n,m,ex,ey,ans;
int sr[N][N],sc[N][N];
int dp[N][N][N];
void mx(int &x,int y){
	x<y?x=y:0;
}
int main(){
	scanf("%d%d",&n,&m);
	memset(dp,233,sizeof(dp));
	For(i,1,n) scanf("%s",mp[i]+1);
	For(i,1,n) For(j,1,m){
		if (mp[i][j]=='o') sr[i][j]=sc[i][j]=1;
		else if (mp[i][j]=='E') ex=i,ey=j;
		sr[i][j]+=sr[i][j-1],sc[i][j]+=sc[i-1][j];
	}
	int L=ey-1,R=m-ey,U=ex-1,D=n-ex; dp[0][0][0]=0;
	For(l,0,L) For(r,0,R) For(u,0,U) For(d,0,D){
		int v=dp[r][u][d]; ans=max(ans,v);
		int up=max(ex-u,d+1),dn=min(ex+d,n-u);
		int le=max(ey-l,r+1),ri=min(ey+r,m-l);
		if (up>dn||le>ri) continue;
		if (u<U-d) mx(dp[r][u+1][d],v+sr[ex-u-1][ri]-sr[ex-u-1][le-1]);
		if (d<D-u) mx(dp[r][u][d+1],v+sr[ex+d+1][ri]-sr[ex+d+1][le-1]);
		if (r<R-l) mx(dp[r+1][u][d],v+sc[dn][ey+r+1]-sc[up-1][ey+r+1]);
		if (l<L-r) mx(dp[r][u][d],v+sc[dn][ey-l-1]-sc[up-1][ey-l-1]);
	}
	printf("%d",ans);
}

Measured memory_bytes: 4864
N = int(input())
A = list(map(int, input().split()))
ans = sum(A)
num = [0 for i in range(10**5+5)]
for a in A:
   num[a] += 1
Q = int(input())
for i in range(Q):
    b, c = map(int, input().split())
    n = num[b]
    ans -= b*n
    ans += c*n
    num[b] = 0
    num[c] += n
    print(ans)




Measured memory_bytes: 20980
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll MOD = 1e9+7;

/*ll gcd(ll a, ll b){
  if(b==0) return a;
  return gcd(b, a%b);
}

ll lcm(ll a, ll b){
  ll g = gcd(a, b);
  b /= g;
  a *= b;
  return a;
}*/

/*int dfs(vector<int> &T, vector<int> &C, int i, int sum, int g, int count){
   
}*/

int main(){
  string n;
  cin >> n;
  int ch = 0;
  rep(i, 3){
    if(n.at(i)=='7'){
      cout << "Yes" << endl;
      ch = 1;
      break;
    }
  } 
  if(ch==0) cout << "No" << endl;

}



Measured memory_bytes: 3628
#include <iostream>
using namespace std;
int a,b,c,d,l,r;
int main(){
	cin>>a>>b>>c>>d;
	l=a+b;
	r=c+d;
	if(l==r){
		cout<<"Balanced";
	}
	if(l<r){
		cout<<"Right";
	}
	if(l>r){
		cout<<"Left";
	}
	return 0;
} 

Measured memory_bytes: 256
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=300;

int n;
int a[MAXN];

int cnt[3];

double dp[MAXN+1][MAXN+1][MAXN+1];

double solve() {
	REP(i,3) cnt[i]=0; REP(i,n) ++cnt[a[i]-1];
	REPE(k,n) REPE(j,n-k) REPE(i,n-j-k) {
		dp[i][j][k]=0;
		if(i==0&&j==0&&k==0) continue;
		dp[i][j][k]+=n;
		if(i>0) dp[i][j][k]+=i*dp[i-1][j][k];
		if(j>0) dp[i][j][k]+=j*dp[i+1][j-1][k];
		if(k>0) dp[i][j][k]+=k*dp[i][j+1][k-1];
		dp[i][j][k]*=1.0/(i+j+k);
	}
	return dp[cnt[0]][cnt[1]][cnt[2]];
}

void run() {
	scanf("%d",&n);
	REP(i,n) scanf("%d",&a[i]);
	printf("%.15lf\n",solve());
}

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


Measured memory_bytes: 213248
def main():
    n, m = [int(i) for i in input().split()]
    wa = [0]*n
    ac = [0]*n
    
    for _ in range(m):
        p, s = input().split()
        if s == "WA":
            if ac[int(p)-1] == 0:
                wa[int(p)-1] += 1
        else:
            ac[int(p)-1] += 1
    
    print(n-ac.count(0), sum([wa[i] for i in range(n) if ac[i] >= 1]))


if __name__ == "__main__":
    main()

Measured memory_bytes: 5528
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main()
{
    int k;
    cin >> k;
    int ans = (k / 2) * (k - k / 2);
    cout << ans << endl;

    return 0;
}

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

long long int dp[100][100000+1];

long long int call(long long int i,long long int S,long long int p[],long long int w[])
{
	if(i<0)
		return 0;
	if(S<0)
		return 0;
	if(dp[i][S]!=-1)
		return dp[i][S];
	
	long long int ans=call(i-1,S,p,w);
	if(S>=w[i])
	{
		ans=max(ans,call(i-1,S-w[i],p,w)+p[i]);
	}
	dp[i][S]=ans;
	return dp[i][S];
}
int main()
{
	long long int n,W;
	cin>>n>>W;
	
	long long int p[n],w[n];
	
	for(long long int i=0;i<n;i++)
	{
		cin>>w[i]>>p[i];
	}
	memset(dp,-1,sizeof(dp));
	cout<<call(n-1,W,p,w);
	
	return 0;
}

Measured memory_bytes: 78336
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

signed main() {	
	int a, b, c, k;
	cin >> a >> b >> c >> k;

	while (a >= b) {
		b *= 2;
		k--;
	}
	while (b >= c) {
		c *= 2;
		k--;
	}

	if (k < 0) {
		col("No");
	}
	else {
		col("Yes");
	}

	return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  vector<int> v(b);
  for(int i=0; i < b; i++){cin >> v[i]; a-= v[i];}
  if(a <= 0) cout << "Yes" << endl;
  else cout << "No" << endl;

}


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

using namespace std;

const int iINF = INT_MAX;

template <typename Monoid>
struct SegmentTree {
    using F = function<Monoid(Monoid, Monoid)>;

    int size = 1;
    vector<Monoid> node;

    const F f;
    const Monoid e;

    SegmentTree(int n, const F f, const Monoid &e) : f(f), e(e) {
        while (size < n) size <<= 1;
        node.assign(2 * size, e);

        for (int i = size - 2; i >= 0; i--) {
            node[i] = f(node[2 * i + 1], node[2 * i + 2]);
        }
    }

    SegmentTree(vector<Monoid> vec, const F f, const Monoid &e) : f(f), e(e) {
        int n = (int)vec.size();
        while (size < n) size <<= 1;
        node.assign(2 * size, e);

        for (int i = 0; i < n; i++) {
            node[i + size - 1] = vec[i];
        }

        for(int i = n - 2; i >= 0; i--) {
            node[i] = f(node[2 * i + 1], node[2 * i + 2]);
        }
    }

    void set(int i, const Monoid &x) {
        node[i + size - 1] = x;
    }

    void update(int i, const Monoid &x) {
        i += (size - 1);

        node[i] = x;

        while(i > 0) {
            i = (i - 1) / 2;
            node[i] = f(node[2 * i + 1], node[2 * i + 2]);
        }
    }

    Monoid query(int a, int b, int i = 0, int l = 0, int r = - 1) {
        if (r < 0) r = size;

        if(r <= a || b <= l) return e;

        if(a <= l && r <= b) return node[i];

        Monoid xl = query(a, b, 2 * i + 1, l, (l + r) / 2);
        Monoid xr = query(a, b, 2 * i + 2, (r + l) / 2, r);

        return f(xl, xr);
    }
};

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

    SegmentTree<int> seg(n, [] (int a, int b) { return min(a, b); }, iINF);

    for(int i = 0; i < q; i++) {
        int com, x, y;
        cin >> com >> x >> y;

        if (com == 0) {
            seg.update(x, y);
        } else {
            cout << seg.query(x, y + 1) << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3816
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

template <class T>
void cout_vec2(const vector<vector<T>> &vec){
  rep(i,vec.size()){
    rep(j,vec[i].size()){
      cout<<vec[i][j]<<' ';
    }
    cout<<endl;
  }
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  ll ans=1;
  rep(i,n){
    (ans*=(i+1))%=mod;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int P,Q,R,C;
  int n,h;
  while(cin>>n){
    if(n==0) break;
    h = 0;
    int i[n],p[n],q[n],r[n];
    for(int j=0;j<n;j++) cin >> i[j] >> p[j] >> q[j] >> r[j];
    cin >> P >> Q >> R >> C;
    for(int j=0;j<n;j++){
      if(p[j]>P) continue;
      if(q[j]>Q) continue;
      if(r[j]>R) continue;
      if(4*p[j]+9*q[j]+4*r[j]>C) continue;
      else{
	cout << i[j] << endl;
	h = 1;
      }
    }
    if(h==0) cout << "NA" << endl;
  }
  return 0;
}

Measured memory_bytes: 1176
#include <iostream>
#include <math.h>
//#include <numeric>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;
#define n_max 100000

#define rep(i, a, n) for(int i = a; i < n; i++)
#define rrep(i, a, n) for(int i = a; i > n; i--)
#define lrep(i, a, n) for(long int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl

int main()
{
    long int L, R;
    int ans = 3000;
    int cnt = 0;
    long int mem = -1;
    
    cin >> L >> R;
    

    lrep(i, L, R) lrep(j, i + 1, R + 1){
        int tmp = ((i * j) % 2019);
        ans = min(ans, tmp);
        if(mem != tmp) { 
            cnt++;
            mem = tmp;
        }
        if(ans == 0) { 
            cout << 0 << endl;
            return 0;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());

		long ans = IntStream.rangeClosed(1, N).filter(s -> String.valueOf(s).length() % 2 != 0).count();

		System.out.println(ans);

		sc.close();
		
		System.gc();
	}
}


Measured memory_bytes: 45268
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <random>
#include <complex>
#include <assert.h>

using namespace std;
typedef long long ll;

template<typename T>
inline bool chmin(T& x, T a) {
	if (x >= a) { x = a; return true; }
	return false;
}

template<typename T>
inline bool chmax(T& x, T a) {
	if (x <= a) { x = a; return true; }
	return false;
}

bool isPalindrome(string& s, int a, int b) {
	while (a < b) {
		if (s[a] != s[b]) { return false; }
		a++;
		b--;
	}
	return true;
}
int main() {
	string s; cin >> s;
	int N = s.size();
	if (isPalindrome(s, 0, N - 1) && isPalindrome(s, 0, (N - 3) / 2) && isPalindrome(s, (N + 1) / 2, N - 1)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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

using namespace std;

typedef std::pair<int,int> ipair;
bool greaterPair(const ipair& l, const ipair& r){return l.second > r.second;}

int max_index(vector<int> vec){
	vector<int>::iterator iter = max_element(vec.begin(), vec.end());
	int index = distance(vec.begin(), iter);
	return index;
}

int main(){
	int N;

	cin >> N;
	int V[N];

	for (int n=0; n<N; n++){
		cin >> V[n];
	}

	vector<int> odd_vec;
	vector<int> even_vec;

	for (int n=0; n<(N/2); n++){
		odd_vec.push_back(V[2*n]);
		even_vec.push_back(V[2*n+1]);
	}

	vector<int> odd_count(100001, 0);
	vector<int> even_count(100001, 0);

	for (int o : odd_vec){
		++odd_count[o];
	}

	for (int e : even_vec){
		++even_count[e];
	}

	vector<ipair> odd_pair;
	vector<ipair> even_pair;

	for (int i=0; i<odd_count.size(); i++){
		odd_pair.push_back(ipair(i, odd_count[i]));
	}

	for (int i=0; i<even_count.size(); i++){
		even_pair.push_back(ipair(i, even_count[i]));
	}

	partial_sort(odd_pair.begin(), odd_pair.begin()+2, odd_pair.end(), greaterPair);
	partial_sort(even_pair.begin(), even_pair.begin()+2, even_pair.end(), greaterPair);

	int ans;

	if (odd_pair[0].first != even_pair[0].first){
		ans = N - odd_pair[0].second - even_pair[0].second;
	}
	else{
		ans = N - max(odd_pair[1].second + even_pair[0].second, odd_pair[0].second + even_pair[1].second);
	}

	cout << ans << endl;

}

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

int main()
{
    int M, D;
    scanf("%d %d", &M, &D);

    int m, d;
    int sekiDay = 0;
  
    for (d = 2; d <= D; d++) {
        if ((d % 10) >= 2 && (d / 10) >= 2) {
            if ((d % 10) * (d/10) <= M) {
                sekiDay++;
            }
        }
    }
    printf("%d", sekiDay);
    return 0;
}

Measured memory_bytes: 256
a=input()
import itertools
l=list(itertools.product("+-",repeat=3))
for i in range(8):
    num=a[0]
    for j in range(3):
        num+=l[i][j]
        num+=a[j+1]
    if eval(num)==7:
        print(num+"=7")
        exit()


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

int main() {
    int n,W;
    cin>>n>>W;
    vector<vector<int>> v(n,vector<int>(2,0));
    for(int i=0;i<n;i++){
        cin>>v[i][0]>>v[i][1];
    }
    vector<vector<ll>> dp(n+1,vector<ll>(W+1,0));
    for(int i=1;i<=n;i++){
        for(int w=0;w<=W;w++){
            if(w >= v[i-1][0]){
                dp[i][w] = max(dp[i-1][w],dp[i-1][w-v[i-1][0]] + v[i-1][1]);
            }else{
                dp[i][w] = dp[i-1][w];
            }
        }
    }
    cout<<dp[n][W];
	return 0;
}

Measured memory_bytes: 80256
#include <iostream>
#include <cmath>
#include <climits>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string.h>
#include <iomanip>
#include <ctype.h>

#define ll          long long int
#define ull         unsigned long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
//#define hell        1000000007
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.000000001
#define all(a)      (a).begin(),(a).end()
const long long INF = (long long) 1e7+1;
const long long mod = (long long) 998244353;
const long long hell = (long long) 1000000007;

using namespace std;
#include <stdio.h>
ll m;
ll power(ll x,ll y)
{
  ll res=1;
  while(y>0)
  {
    if(y%2) res=(x*res);
    x=(x*x);
    y=y/2;
  }
  return res;
}

ll modinv(ll x){
  return power(x,hell-2);
}

void solve();


void fastIO() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

int main(){
   fastIO();
    solve();
}
//void sieve();
ll pw(ll k,ll x);
ll gcd(ll x,ll y);

/*
  For freq or prime factors

for(auto pri:prime){
  while(k%pri==0){
    pcnt[pri]++;
    k/=pri;
  }
}*/

bool issafe(int x,int y,int n,int m){
  return (x>=0 && y>=0 && x<n && y<m);
}

bool comp(pair<ll,ll> a,pair<ll,ll> b){
    if(a.F!=b.F)
    return a.F<b.F;
    else
    return a.S>b.S;
}

void solve(){
  int test;
  //cin>>test;
  test=1;
  
  while(test--){
        int n,k;
        ll s;
        cin>>n>>k>>s;
        
        for(int i=0;i<k;i++)
        cout<<s<<" ";
        
        if(s<1e9){
            for(int i=k;i<n;i++)
            cout<<s+1<<" ";
        }
        else{
            for(int i=k;i<n;i++)
            cout<<1<<" ";
        }
  }    
}    

    




///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1

ll gcd(ll x,ll y){
  if(x==0)
  return y;
  else
  return gcd(y%x,x);
}


ll pw(ll k,ll x){
  if(x==0)
  return 1;
  if(x&1)
  return ((pw(k,x-1))*k);
  else
  return ((pw(k,x/2))*(pw(k,x/2)));
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI 				acos(-1)
#define mp				make_pair
#define pb				push_back
#define all(a)			(a).begin(), (a).end()
#define sz(a)			a.size()
#define srt(a)			sort(all(a))
#define mem(a, h)		memset(a, (h), sizeof(a))
#define f 				first
#define s 				second
#define MOD1			998244353
#define fore(i, b, e)	for(int i = b; i < e; i++)
#define forg(i, b, e, m)	for(int i = b; i < e; i+=m)
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//find_by_order kth largest  order_of_key <
const int tam = 100010;
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	//freopen("qwe.txt", "r", stdin);
	int n;
	cin>>n;
	double a, b;
	while(n--)
	{
		cin>>a>>b;
		if(fabs(a - b) < EPS)
			cout<<(ll)(ceil(sqrt(a * b) * 2 - 2) + EPS)<<'\n';
		else
			cout<<(ll)(ceil(sqrt(a * b) * 2 - 3) + EPS)<<'\n';
	}
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2

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

using namespace std;
using ll = long long;
constexpr int mod = 1e9+7;
constexpr int md = mod;

int main(){
    int k;
    vector<int> d(5);
    for(auto & a : d)cin>>a;
    cin>>k;
    bool ng = false;
    for(int i=0;i<5;++i){
        for(int j=i;j<5;++j){
            if(d[j] - d[i] > k)ng = true;
        }
    }
    if(ng)cout << ":(" << endl;
    else cout << "Yay!" << endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        if(b-a == c-b){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 23764
#include<iostream>
#include<bitset>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ck(a) (0<=(a)&&(a)<10)
int dx[]={-1,0,1,0,0},dy[]={0,0,0,-1,1};
void set(int *a,int b){
	bitset<10> c(b);
	string t=c.to_string<char,char_traits<char>,allocator<char> >();
	rep(i,10)a[i]=t[i]-'0';
}
void change(int t[10][10],int *a,int l){
	rep(i,10){
		rep(d,5){
			if(!ck(l+dy[d])||!ck(i+dx[d]))continue;
			t[l+dy[d]][i+dx[d]]^=a[i];
		}
	}
}
int main(){
	int n; cin>>n;
	while(n--){
		int state[10][10]={0},axion[10][10],temp[10][10];
		rep(i,10)rep(j,10)cin>>state[i][j];
		rep(d,1<<10){
			rep(i,10)rep(j,10)temp[i][j]=state[i][j];
			set(axion[0],d);
			rep(i,10){
				change(temp,axion[i],i);
				if(i<9)rep(j,10)axion[i+1][j]=temp[i][j];
			}
			rep(i,10)rep(j,10)if(temp[i][j])goto NEXT;
			rep(i,10){
				rep(j,10)cout<<axion[i][j]<<(j<9?" ":"");
				cout<<endl;
			}
			goto END;
			NEXT:;
		}
		END:;
	}
	return 0;
}

Measured memory_bytes: 0