akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){

    ll N, K;
    cin >> N >> K;
    ll one;
    for(ll i = 1; i <= N; i++){
        ll a;
        cin >> a;
        if(a == 1)one = i;
    }
    for(ll i = 1; ; i++){
        if(K * i - (i - 1) >= N){
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#Coding: utf-8

N=int(input())
a=[]
total=0
for i in range(N):
    a.append(int(input()))

a.sort(reverse=True)
for l in range(N):
    if l==0:
        a[l]=a[l]/2
    total=total+a[l]

print(int(total))


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

int main(){
	int a,b;
	int ab[100];
	cin >> a;
	for(int i=0;i<a;i++){
		cin >> ab[i];
	}
	for(int i=0;i<a;i++){
		cout << ab[a-i-1];
		if(a!=i+1){
			cout <<" ";
		}
}
cout << endl;
	return 0;
}


Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int n=0;
	scanf("%d",&n);
	ll ans=0;
	for (int i=1;i<n;i++){
		ans+=(n-1)/i;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3836
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

int main(void){
    int n;
    cin >> n;

    vector<pair<string, int>> s(n);
    for(int i = 0; i < n; i++){
        pair<string, int> tmp;
        cin >> tmp.first >> tmp.second;
        s[i] = tmp;
    }

    string music;
    cin >> music;

    bool f = false;
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(f){
            ans += s[i].second;
        }
        if(s[i].first == music){
            f = true;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <utility>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <sstream>
#include <cstring>
#include <bitset>
#include <stack>
using namespace std;
#define MP make_pair
#define PB push_back
const int INF=1e9;
int n,p,a[105],cnt[5];
long long ans=0,C[105][105];

inline void init()
{
	for (int i=0;i<=50;i++) C[1][i]=1;
	for (int i=0;i<=50;i++) C[0][i]=1;
	for (int i=2;i<=51;i++)
	{
		C[i][1]=C[i][i]=1;
		C[i][0]=1;
		for (int j=2;j<i;j++) C[i][j]=C[i-1][j]+C[i-1][j-1];
	}
}

int main()
{
	cin>>n>>p;
	for (int i=1;i<=n;i++) cin>>a[i];
	for (int i=1;i<=n;i++) cnt[a[i]%2]++;
	init();
	if (p==0)
	{
		for (int i=0;i<=cnt[1];i+=2)
			for (int j=0;j<=cnt[0];j++) ans+=C[cnt[1]+1][i+1]*C[cnt[0]+1][j+1];
	}
	else
	{
		for (int i=1;i<=cnt[1];i+=2)
			for (int j=0;j<=cnt[0];j++)	ans+=C[cnt[1]+1][i+1]*C[cnt[0]+1][j+1];
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.array, std.algorithm;
import std.c.stdio;

void main() {

   auto a = readln.split.map!(to!int);
   write(a[0] / a[1], " ");
   write(a[0] % a[1], " ");
   printf("%f\n", cast(double)a[0] / a[1]);
}

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

int main() {
	// your code goes here
	int n; cin>>n;
	int *T = new int[n];
	unsigned long long s = 0;
	for(int i=0; i<n; i++) { cin>>T[i]; s+=T[i];}
	int m; cin>>m;
	for(int i=0; i<m; i++){
		int p,x; cin>>p>>x;
		cout<<s-T[p-1]+x<<endl;
	}
	return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
  int N,K; cin>>N>>K;
  vector<int> S(N+1,0);
  rep(i,K){
    int d; cin>>d;
    rep(j,d){
      int a; cin>>a;
      S.at(a)++;
    }
  }
  int res = 0;
  for(int i = 1; i <= N; i++)if(S.at(i)==0)res++;
  cout<<res<<endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	set<string> s;
	int n;
	cin >> n;
	while(n--){
		string t;
		cin >> t;
		s.insert(t);
	}
	cout << s.size() << '\n';
}


Measured memory_bytes: 19200
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def main():
    D, T, S = in_nn()

    if S * T >= D:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 61880
#include <stdio.h>
#include <math.h>


int main(){
  int N,T,A;
  scanf("%d%d%d",&N ,&T ,&A);

  int H[1010];
  int i;

  for (i = 1; i <= N; i++) {
    scanf("%d", &H[i]);
  }

  //地点iの平均気温
  double temp[1010];
  for (i = 1; i <= N; i++) {
    temp[i] = T - H[i] * 0.006;
  }

  //地点iの平均気温とA度との差
  double sa[1010];
  for (i = 1; i <= N; i++) {
    if (temp[i] >= A) {
      sa[i] = temp[i] - A;
    }else{
      sa[i] = A - temp[i];
    }
  }

  //sa[i]が最小となるようなiを求める
  double min = sa[1];
  int answer = 1;
  for (i = 1; i <= N ; i++) {
    if (sa[i] < min) {
      min = sa[i];
      answer = i;
    }
  }
  printf("%d\n", answer);

  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define sz(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define lli long long 
#define mod 1000000007 
void fast(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
}
inline lli power(lli x, lli y, lli p = mod)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
 
inline lli modadd(lli a, lli b, lli m = mod)
{
    a += b;
    if (a >= m)
        a -= m;
    return a;
}
 
inline lli modmul(lli a, lli b, lli m = mod)
{
    return ((a % m) * (b % m)) % m;
}
 
inline lli modi(lli a, lli m = mod) {
    return power(a, m - 2, m);
}

const int N = 2005;
lli fac[N], invfac[N];
void fact()
{
    invfac[0]=fac[0] = 1;
    for (int i = 1; i < N; i++)
    {
        fac[i] = (fac[i - 1] * i) % mod;
        invfac[i] = modi(fac[i]);
    }
    return;
}
 
lli ncr(lli a, lli b)
{
    if (a < b || a < 0 || b < 0)
        return 0;
    return ((fac[a] * invfac[b]) % mod * invfac[a - b]) % mod;
}


int main() {
   fast();
   long long s;
   cin>>s;
   fact();
   long long i=1;
   long long ans=0;
   while(2*i+1<=s){
     ans+=ncr(s-2*i-1,i-1);
     ans%=mod;
     i++;
   }
   cout<<ans%mod<<"\n";

   
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
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; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << min(a, b) + min(c, d) << endl;

  return 0;
}


Measured memory_bytes: 3544
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int ret = INF;
  for (int k = -100; k <= 100; ++k) {
    int cur = 0;
    for (int i = 0; i < n; ++i) {
      cur += (a[i] - k) * (a[i] - k);
    }
    ret = min(ret, cur);
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
use std::io::stdin;


fn main() {
    let mut get_s = String::new();
    stdin().read_line(&mut get_s).unwrap();
    let (x, y, a, b, c) = {
        let mut xya = get_s.split_whitespace().map(|x| x.parse::<usize>().unwrap());
        (xya.next().unwrap(),xya.next().unwrap(),xya.next().unwrap(),xya.next().unwrap(),xya.next().unwrap())
    };
    let mut get_s = String::new();
    stdin().read_line(&mut get_s).unwrap();
    let mut p:Vec<i64> = get_s.split_whitespace().map(|x| x.parse::<i64>().unwrap()).collect();
    p.sort();
    p = p[(a-x)..].to_vec();

    let mut get_s = String::new();
    stdin().read_line(&mut get_s).unwrap();
    let mut q:Vec<i64> = get_s.split_whitespace().map(|x| x.parse::<i64>().unwrap()).collect();
    q.sort();
    q = q[(b-y)..].to_vec();

    p.append(&mut q);
    p.sort();

    let mut pq:Vec<i64> = Vec::with_capacity(x+y);
    let mut all_pq: i64 = p.iter().sum();
    pq.push(all_pq);
    for i in 0..(x+y) {
        all_pq -= p[i];
        pq.push(all_pq);
    };

    let mut get_s = String::new();
    stdin().read_line(&mut get_s).unwrap();
    let mut r:Vec<i64> = get_s.split_whitespace().map(|x| x.parse::<i64>().unwrap()).collect();
    r.sort();

    let mut s_r:Vec<i64> = Vec::with_capacity(c+1);
    s_r.push(0);
    let mut sr:i64 = 0;
    for i in 0..c {
        sr += r[c-i-1];
        s_r.push(sr);
    };

    let end = min_usize(x+y, c+1);

    for i in 0..end {
        pq[i] += s_r[i];
    };
    println!("{}", pq.iter().max().unwrap());

}

fn min_usize(a:usize, b:usize) -> usize {
    if a > b {
        return b;
    } else {
        return a;
    };
}

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

using namespace std;
typedef long long ll;

int main() {

	ll n, m;
	const ll q = 1000000007;
	cin >> n >> m;
	vector<ll> s(n);
	vector<ll> t(m);
	for (ll i = 0; i < n; i++)
	{
		cin >> s.at(i);
	}
	for (ll i = 0; i < m; i++)
	{
		cin >> t.at(i);
	}

	vector<vector<ll> > dp(n, vector<ll>(m));
	vector<vector<ll> > sum(n, vector<ll>(m));

	//  dp[i][j] = sum[i-1][j-1]  or 0
	// sum[i][j] = dp[i][j] + (sum[i][j-1]-sum[i-1][j-1])
	//             + (sum[i-1][j]-sum[i-1][j-1]) + sum[i-1][j-1]
	//           = dp[i][j]+sum[i][j-1]+sum[i-1][j]-sum[i-1][j-1]

	if (s[0] == t[0]) {
		dp[0][0] = 1;
	}
	else {
		dp[0][0] = 0;
	}
	sum[0][0] = dp[0][0] + 1;
	// i fix
	for (ll j = 1; j < m; j++)
	{
		if (s[0] == t[j]) {
			dp[0][j] = 1;
		}
		else {
			dp[0][j] = 0;
		}
		sum[0][j] = dp[0][j] + sum[0][j - 1];
	}
	// j fix
	for (ll i = 1; i < n; i++)
	{
		if (s[i] == t[0]) {
			dp[i][0] = 1;
		}
		else {
			dp[i][0] = 0;
		}
		sum[i][0] = dp[i][0] + sum[i - 1][0];
	}

	for (ll i = 1; i < n; i++)
	{
		for (ll j = 1; j < m; j++)
		{
			if (s[i] == t[j]) {
				dp[i][j] = sum[i - 1][j - 1];
			}
			else {
				dp[i][j] = 0;
			}
			sum[i][j] = dp[i][j] + sum[i][j - 1] + sum[i - 1][j] - sum[i - 1][j - 1];
			sum[i][j] %= q;
			sum[i][j] += q;
			sum[i][j] %= q;
		}
	}

	printf("%lld", sum[n - 1][m - 1]);

	return 0;
}

Measured memory_bytes: 62976
#include<bits/stdc++.h>
#include<iomanip>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define ar array
#define mxn 200005
#define mod 1000000007
#define ld long double
#define pb push_back
#define inf 1e18
#define fi first
#define se second
typedef long long int ll;
using namespace std;
int main(void){
	fast;
	int n,i;
	array<int,3>a[mxn];
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a[i][0]>>a[i][1];
	}
	bool ok=0;
	for(i=2;i<n;i++){
		if(a[i][0]==a[i][1]&&a[i-1][0]==a[i-1][1]&&a[i-2][0]==a[i-2][1])
		ok=1;
	}
	if(ok)
	cout<<"Yes";
	else
	cout<<"No";
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define pb push_back
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;
typedef tuple<int,int,int> tiii;

int n,k;

int main(void)
{
    cin >> n >> k;
    ll ans=0;
    if(k%2!=0){
        ll a = n / k;
        ans = pow(a, 3);
    }else{
        ll a = n / k;
        ll b = (2 * n / k) - a;
        ans = pow(a,3) + pow(b,3);
    }
    pr(ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const long MOD = 1000000007;
typedef pair<int, int> P;
typedef long long ll;

int main(){
    int K;
    cin >> K;

    int A, B;
    cin >> A >> B;

    bool fl = false;
    for(int i=A; i<=B; i++){
        if(i % K == 0) fl = true;
    }

    if(fl) cout << "OK" << endl;
    else cout << "NG" << endl;

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <tuple>
#include <math.h>
#include <deque>
#include <stack>

using namespace std;

typedef long long ll;

int main(void){
    ll k, x;
    cin >> k >> x;
    ll rp = k * 2 - 1;
    ll s = x - k + 1;
    for (ll i = 0;i < rp;i++){
        cout << s << " ";
        s++;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		String c = in.next();
		char n = c.charAt(0);

		if (n == 'a' | n == 'i' | n == 'u' | n == 'e' | n == 'o') {
			System.out.println("vowel");
		} else {
			System.out.println("consonant");
		}

	}
}

Measured memory_bytes: 23508
#include<iostream>
using namespace std;
int main(){
  int m,d,ans=0;
  cin >>m>>d;
  for(int i=4;i<=m;i++){
    for(int j=22;j<=d;j++){
      int one=j%10,ten=j/10;
      if(one>=2 && ten>=2 && i==one*ten)
        ans++;
    }
  }
  cout <<ans;
  return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
  var b string
  fmt.Scan(&b)
  if b == "A" {
    fmt.Println("T")
  } else if b == "T" {
    fmt.Println("A")
  } else if b == "C" {
    fmt.Println("G")
  } else if b == "G" {
    fmt.Println("C")
  }
}


Measured memory_bytes: 512
use std::cmp::max;

#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (a, b) = scan!(usize, usize);
    println!("{}", max(a + max(a - 1, b), b + max(a, b - 1)));
}


Measured memory_bytes: 4352
// In the name of Allah.
// We're nothing and you're everything.
// Ya Ali!

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e2 + 14, maxs = maxn * maxn * 2, inf = 1e9;

int n, m;
char c[maxn][maxn];
struct State{
    int x, y, l;
    int i(){
        return (x * m + y) * 2 + l;
    }
    void operator =(int w){
        l = w % 2;
        l >>= 1;
        y = w % m;
        y /= m;
        x = w;
    }
};
vector<pair<int, int> > g[maxs];
set<pair<int, int> > pq;
int d[maxs];
void dij(int source){
    memset(d, 63, sizeof d);
    d[source] = 0;
    pq.insert({0, source});
    while(pq.size()){
        int v = pq.begin() -> second;  
        pq.erase(pq.begin());
        for(auto e : g[v])
            if(d[e.first] > d[v] + e.second){
                pq.erase({d[e.first], e.first});
                pq.insert({d[e.first] = d[v] + e.second, e.first});
            }
    }
}
int main(){
    ios::sync_with_stdio(0), cin.tie(0);
    cin >> n >> m;
    for(int i = 0; i < n; i++)
        cin >> c[i];
    for(int i = 0; i < n; i++)
        for(int j = 0; j < m; j++){
            g[State({i, j, 0}).i()].push_back({State({i, j, 1}).i(), 1});
            g[State({i, j, 1}).i()].push_back({State({i, j, 0}).i(), 0});
        }
    for(int i = 1; i < n; i++)
        for(int j = 0; j < m; j++){
            if(c[i - 1][j] == '.')
                g[State({i - 1, j, 0}).i()].push_back({State({i, j, c[i][j] == '#'}).i(), c[i][j] == '#'});
            else
                g[State({i - 1, j, 1}).i()].push_back({State({i, j, c[i][j] == '#'}).i(), 0});
        }
    for(int i = 0; i < n; i++)
        for(int j = 1; j < m; j++){
            if(c[i][j - 1] == '.')
                g[State({i, j - 1, 0}).i()].push_back({State({i, j, c[i][j] == '#'}).i(), c[i][j] == '#'});
            else
                g[State({i, j - 1, 1}).i()].push_back({State({i, j, c[i][j] == '#'}).i(), 0});
        }
    dij(0);
    cout << min(d[State({n - 1, m - 1, 0}).i()], d[State({n - 1, m - 1, 1}).i()]) << '\n';
}

Measured memory_bytes: 2048
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class Program
	{
		static void Main(string[] args)
		{

			int[] vs = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();

			int a = vs[0];
			int b = vs[1];
			int c = vs[2];

			Console.WriteLine(Math.Min(b / a, c));

		}
	}
}

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

#define PII pair<int, int>
#define A first
#define B second
#define MP make_pair

int ans[111][111];

int main() {
    int n, m; cin >> n >> m;
    vector<string> B(n);
    for (int i=0; i<n; i++)
        cin >> B[i];
    ans[0][0] = int(B[0][0] == '#');
    for (int i=0; i<n; i++) {
        for (int j=0; j<m; j++) {
            if (i+j == 0) continue;
            ans[i][j] = 1000;
            if (i > 0)
                ans[i][j] = min(ans[i][j], ans[i-1][j] + int(B[i-1][j] != B[i][j]));
            if (j > 0)
                ans[i][j] = min(ans[i][j], ans[i][j-1] + int(B[i][j-1] != B[i][j]));
        }
    }
    cout << (ans[n-1][m-1]+1)/2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.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: 980
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:1048576")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble
#define rf(x) (x)=0;while(*p<48)p++;while(47<*p)(x)=((x)<<3)+((x)<<1)+(*p++&15);

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;
typedef tuple <int, int, int> t3;

int IT_MAX = 1 << 12;
const ll MOD = 1000000009;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<(n);i++)

int main() {
	ll K;
	scanf("%lld", &K);
	
	printf("50\n");
	ll t = K / 50;
	ll x = 49 + t;
	ll y = K % 50;
	for (int i = 1; i <= y; i++) printf("%lld ", x + 50 + 1 - y);
	for (int i = 1; i <= 50 - y; i++) printf("%lld ", x - y);
	return 0;
}

Measured memory_bytes: 256
#if 1
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <functional>

using namespace std;
#define int long long
constexpr int mod = 1000000007;

#define LOADVEC(type,name,N) std::vector<type>name(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name[nnn]; \
}

#define LOAD(type,name) type name; \
cin >> name;



signed main() {
	ios::sync_with_stdio(false);
	LOAD(int, N);
	LOAD(int, x);
	LOADVEC(int, A, N);
	int res = 1000000000000000;
	for (int n = 0; n < N; ++n) {
		int cost0 = n * x, cost1 = 0;
		for (int nn = 0; nn < N; ++nn) {
			cost1 += A[nn];
		}
		int cost = cost0 + cost1;
		if (cost < res) {
			res = cost;
		}
		if (cost1 < x)break;
		//
		int Aend = A[N - 1];
		for (int nn = N - 1; nn >= 1; --nn) {
			A[nn] = std::min({ A[nn] ,A[nn - 1] });
		}
		A[0] = std::min({ A[0] ,Aend });
	}
	cout << res << endl;
	return 0;
}
#endif


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define endl "\n"
#define inf 2000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll mod=1e9+7;		
			
	   
int main() {
			fast
			// #ifndef ONLINE_JUDGE
			// freopen("input.txt","r",stdin);
			// freopen("output.txt","w",stdout);
			// #endif

			ll n;
			cin>>n;
			ll r=0,w=0;
			string s;
			cin>>s;
			for(ll i=0;i<n;i++)
			{
				if(s[i]=='R')
				r+=1;
				else
				w+=1;
			}
			ll ans=0;
			for(ll i=0;i<n-w;i++)
			{
				if(s[i]=='W')
				ans+=1;
			}
			cout<<ans;

			
		
			return 0;
		 }	




Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
int main() {
  int N;
  ll L;
  cin >> N >> L;
  vector<ll> A(N), sum(N+1);
  int last = -1;
  rep(i, N) {
    cin >> A[i];
    if(i>0 && A[i]+A[i-1]>=L) {
      last = i;
    }
  }
  if(last == -1) {
    cout << "Impossible" << endl;
  } else {
    cout << "Possible" << endl;
    REP(i, 1, last) cout << i << endl;
    RREP(i, N-1, last+1) cout << i << endl;
    cout << last << endl;
  }
  return 0;
}


Measured memory_bytes: 2432
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


fn main() {
    let n = read::<u8>();
    let mut a = read::<String>().chars().collect::<Vec<char>>();
    for c in a {
        if c as u8 + n > 90 {
            print!("{}", (c as u8 - 26 + n) as char);
        } else {
            print!("{}", (c as u8 + n) as char);
        }
    }

}



Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int mod=1000000007;

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n,x;
  cin>>n;
  map<ll,ll> d;
  ll sum=0;
  for(ll i=0; i<n; i++){
    cin>>x;
    d[x]++;
    sum=sum+x;
  }
  ll q;
  cin>>q;
  while(q--){
    ll b,c;
    cin>>b>>c;
    ll a=d[b];
    sum=sum-b*a+c*a;
    d[c]+=a;
    d[b]=0;
    cout<<sum<<"\n";
  }
    return 0;
}


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

#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPR(i, a, b) for (int i = (a); i >= (b); i--)
#define ALL(container) (container).begin(), (container).end()

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;

const int INF = 1e9;

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

  int count;
  int max_count = 0;
  int len = (int)(S.length());
  REP(i, 0, len) {
    count = 0;
    REP(j, i, len) {
      if (S[j] == 'A' || S[j] == 'C' || S[j] == 'G' || S[j] == 'T') {
        count++;
        if (j == len-1 && max_count < count) {
          max_count = count;
        }
      } else {
        if (max_count < count) {
          max_count = count;
        }
        break;
      }
    }
  }

  cout << max_count << endl;

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	EACH(x,vec) is >> x;
	return is;
}
/*
template<class... T>
ostream& operator<<(ostream& os, tuple<T...>& t) {
	for (size_t i = 0; i < tuple_size< tuple<T...> >::value; ++i) {
		if (i) os << " ";
		os << get<0>(t);
	}
	return os;
}
*/
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
	REP(i,vec.size()) {
		if (i) os << " ";
		os << vec[i];
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
	REP(i,vec.size()) {
		if (i) os << endl;
		os << vec[i];
	}
	return os;
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int N;
	while (cin >> N, N) {
		map<char, char> m;
		REP(i, N) {
			char c1, c2; cin >> c1 >> c2;
			m[c1] = c2;
		}
		int M; cin >> M;
		REP(i, M) {
			char c; cin >> c;
			if (m.count(c)) {
				cout << m[c];
			}
			else {
				cout << c;
			}
		}
		cout << endl;
	}
}

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

#define ll long long
#define Y printf("YES\n")
#define N printf("NO\n")
#define pb push_back
#define tp make_tuple
#define srt(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define sc(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld%lld",&a,&b)
#define sc3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define pr(a) printf("%lld\n",a)
#define r0 return 0
#define pi acos(-1)

using namespace std;

int main(){

     ll n,m,i,j,k,l,r,x,y,z,t;

     cin>>n;

     ll f=0;

     k=0;

     while(n--){

        cin>>x>>y;

        if(x==y)k++;
        else k=0;

        if(k>=3)f=1;
     }

     if(f)cout<<"Yes"<<endl;
     else cout<<"No"<<endl;
}



Measured memory_bytes: 3620
n, m = map(int, input().split())
points = list(map(int, input().split()))
points.sort()

if n >= m:
	print(0)
    
else:
	distances = []
	for i in range(1, m):
		distances.append(points[i] - points[i-1])
	distances.sort()
    
	print(sum(distances[:(m-n)]))

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

int main()
{
	int n,m,ans=0,i,j;
	cin>>n>>m;
	
	for(i=1;i<n;i++)
	   for(j=i+1;j<=n;j++)
	      ans++;
	      
    for(i=1;i<m;i++)
	   for(j=i+1;j<=m;j++)
	      ans++;
	      
	cout<<ans;
	
	return 0;
	
}

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

// 💻 Here in checker.cpp, write code that checks whether your output is correct. 💻
// 🤢 This helps when there are many correct outputs, like 3.000000005 and 3. 🤢
// ⏲️ During contests, it's better go to Alt+0, move your mouse to the wrong output and click "Mark as Accepted" ⏲️
// 💡 Then, ICIE will check if checker.cpp file exists, and if so, use it for all tests! 💡
// 😕 You can read from input/... variables like from cin (`int aaa; your_output >> aaa;`). 😕
// 😕 If the output is correct, return 0 from main. If not, return 1. 😕

int main() {
   
int x;
cin>>x;
if(x>=30)
cout<<"Yes";
else
    cout<<"No";

}


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

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

template<class T> bool chmin(T& a,T b){ if(a > b){ a = b; return true; } return false; }
template<class T> bool chmax(T& a,T b){ if(a < b){ a = b; return true; } return false; }

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

    char x;cin >> x;
    if('A' <= x && x <= 'Z'){
        cout << 'A' << '\n';
    }else cout << 'a' << '\n';
}


Measured memory_bytes: 3612
#include <iostream>
#include<string.h>
using namespace std;
int main (int argc, const char * argv[])
{

    int n=0;
    bool b[3]={0};
    cin>>n;
    int out=0;
    string eve;
    int point=0;
    for(int i=0;i<n;i++){
        point=0;out=0;
        b[0]=false;b[1]=false;b[2]=false;
        while(out<=2){
            cin>>eve;
            if(eve=="OUT"){
                out++;
                if(out==3){
                    break;
                }
            }
            
            if(eve=="HIT"){
                if(b[2]){point++;b[2]=false;}
                if(b[1]){b[2]=true;b[1]=false;}
                if(b[0]){b[1]=true;b[0]=false;}
                b[0]=true;
                
            
            }
            
            
            if(eve=="HOMERUN"){
                point++;
                for(int j=0;j<=2;j++){
                    if(b[j]){point++;b[j]=false;}
                }
            }
            
            
        }
        cout<<point<<endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template <typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
    for(auto &e:t) fill_v(e,v);
}
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;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vi D(N);
    REP(i,N)cin >> D[i];
    int ans = 0;
    REP(i,N){
        FOR(j,i + 1,N){
            if(i == j)continue;
            ans += D[i] * D[j];
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main()
{
	long long n;
	cin >> n;
	cout << 2 * (n / 11) + (6 < n % 11 ? 1 : 0) + (0 < n % 11 ? 1 : 0) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//actual solution is at bottom//
////<pbds>////
/*OPTIONAL
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <class T> using Tree = tree<T, null_type, less<T>, 
    rb_tree_tag, tree_order_statistics_node_update>; 
// change null_type for map
#define ook order_of_key
#define fbo find_by_order
*/
///</pbds>///

#define int long long int
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()

///<constants>///
const int MOD = 1e9+7; // 998244353; // = (119<<23)+1
const int MX = 2e5+5; 
const ll INF = 1e18; 
const ld PI = 4*atan((ld)1); 
const int xd[4] = {0,1,0,-1}, yd[4] = {1,0,-1,0};
///</constants>///

///<IO>/// 
namespace io {
    void setIn(string s) { freopen(s.c_str(),"r",stdin); }
    void setOut(string s) { freopen(s.c_str(),"w",stdout); }
    void setIO(string s = "") {
        ios_base::sync_with_stdio(0); cin.tie(0); // fast I/O
        // cin.exceptions(cin.failbit); // ex. throws exception when you try to read letter into int
        if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
    }
}
 
using namespace io;
///</IO>///

///<execution-time>///
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
/*example for clock usage
    clock_t z = clock();
    debug("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
*/
///</execution-time>///

inline void google(int i){
    cout<<"Case #"<<i<<" :";
}
signed main(){
    setIO("");
    int a;cin>>a;
    cout<<a+(a*a)+(a*a*a);
    return 0;
}
/* stuff you should look for
    * check whether you have read the problem correctly
    * int overflow, array bounds
    * special cases (n=1?), slow multiset operations
    * do smth instead of nothing and stay organized
*/

Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
 
class Program
{
    public static readonly int[] Coefs = {4, 2, 4, 2, 4, 6, 2, 6};
 
    private static void Main()
    {
        var x = int.Parse(Console.ReadLine());
        var primes = Sieve(100003);
        var answer = primes.First(prime => prime >= x);
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();
    }
 
    public static List<int> Sieve(int max)
    {
        var isPrimes = Enumerable.Repeat(true, max + 1).ToArray();
 
        for (var i2 = 4; i2 <= max; i2 += 2) isPrimes[i2] = false;
        for (var i3 = 9; i3 <= max; i3 += 6) isPrimes[i3] = false;
        for (int i5 = 25, x = 4; i5 <= max; i5 += 5 * (x = 6 - x)) isPrimes[i5] = false;
 
        var iCoefIndex = 7;
        for (var i = 7; i * i <= max; i += Coefs[iCoefIndex])
        {
            if (!isPrimes[i])
            {
                iCoefIndex = iCoefIndex == 7 ? 0 : iCoefIndex + 1;
                continue;
            }
 
            var jCoefIndex = iCoefIndex;
            for (var j = i * i; j <= max; j += i * Coefs[jCoefIndex])
            {
                isPrimes[j] = false;
                jCoefIndex = jCoefIndex == 7 ? 0 : jCoefIndex + 1;
            }
 
            iCoefIndex = iCoefIndex == 7 ? 0 : iCoefIndex + 1;
        }
 
        return Primes(max, isPrimes);
    }
 
    public static List<int> Primes(int max, bool[] isPrimes)
    {
        var primes = new List<int>();
        if (max < 2) return primes;
        primes.Add(2);
        if (max < 3) return primes;
        primes.Add(3);
        if (max < 5) return primes;
        primes.Add(5);
        if (max < 7) return primes;
 
        var iCoefIndex = 7;
        for (var i = 7; i <= max; i += Coefs[iCoefIndex])
        {
            if (isPrimes[i])
                primes.Add(i);
            iCoefIndex = iCoefIndex == 7 ? 0 : iCoefIndex + 1;
        }
 
        return primes;
    }
}

Measured memory_bytes: 28424
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        StringBuilder sb = new StringBuilder();
        while(n != 0) {
            sb.append(n % 2 == 0 ? 0 : 1);
            n -= Math.abs(n%2);
            n /= -2;
        }
        if(sb.length() == 0) sb.append(0);
        System.out.println(sb.reverse().toString());
    }
}


Measured memory_bytes: 23380
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
long long int MOD=1000000007;
#define SIZE 200005
ll a,k;

int main(){
	int n,x;
	cin>>n;
	vi ls;
	for(int i=0;i<2*n;i++){
		cin>>x;
		ls.pb(x);
	}
	sort(ls.begin(),ls.end());
	int ans=0;
	for(int i=0;i<n;i++){
		ans+=ls[2*i];
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a=0;
	int b=0;
	cin>>a>>b;
	if(a!=b){
		if(a<b){
			cout<<"a < b"<<endl;
		}else{
			cout<<"a > b"<<endl;
		}
	}else{
		cout<<"a == b"<<endl;
	}
}
	

Measured memory_bytes: 1156
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
	int n,a[100002],l,r;
	int q,b,count = 0;
	cin >> n;
	for(int i = 0;i < n;i++){
		scanf("%d",&a[i]);
	}
	cin >> q;
	for(int i = 0;i < q;i++){
		scanf("%d",&b);
		l = 0;
		r = n;
		while(1){
			if(a[(l+r)/2] == b){
				count++;
				break;
			}
			else if(a[(l+r)/2] < b){
				l = (l+r)/2 + 1;
			}
			else if(a[(l+r)/2] > b){
				r = (l+r)/2;
			}
			if(l == r)break;
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 1632
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll x;
    cin >> x;
    if(x == 0){
        cout << 1;
    }else{
        cout << 0;
    }
}

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

void merge(int A[], int n, int left, int mid, int right, int &ans) {
    int *tmp = new int[n];

    for (int i = left; i <= mid; ++i) {
        tmp[i] = A[i];
    }

    for (int i = mid + 1, j = right; i <= right; --j, ++i) {
        tmp[i] = A[j];
    }

    int i = left;
    int j = right;
    for (int k = left; k <= right; ++k) {
        ++ans;
        if (tmp[i] <= tmp[j]) {
            A[k] = tmp[i++];
        } else {
            A[k] = tmp[j--];
        }
    }

    delete[] tmp;
}

void mergeSort(int A[], int n, int left, int right, int &ans) {
    if (right <= left) return;

    int mid = (left + right) / 2;
    mergeSort(A, n, left, mid, ans);
    mergeSort(A, n, mid + 1, right, ans);
    merge(A, n, left, mid, right, ans);
}

int main() {

    int n;
    cin >> n;

    int *S = new int[n];
    for (int i = 0; i < n; ++i) {
        cin >> S[i];
    }

    int ans = 0;
    mergeSort(S, n, 0, n - 1, ans);

    for (int i = 0; i < n; ++i) {
        if (i) cout << " ";
        cout << S[i];
    }
    cout << endl;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5104
#!usr/bin/env python3

import sys


def int_fetcher():
    num = int(sys.stdin.readline())
    return num


def call(num):
    res = ''
    for i in range(1, num+1):
        x = i
        if x % 3 == 0 or x % 10 == 3:
            res += ' ' + str(i)
            continue
        while x:
            if x % 10 == 3:
                res += ' ' + str(i)
                break
            x //= 10
    return res


def main():
    print(call(int_fetcher()))


if __name__ == '__main__':
    main()

Measured memory_bytes: 7756
import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException {
		ABC50B p = new ABC50B();
		p.solve();
	}
}

class ABC50B {
	public void solve() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		String[] input = br.readLine().split(" ");
		int[] t = new int[N];
		long sum = 0;
		for (int i = 0; i < N; i++) {
			t[i] = Integer.parseInt(input[i]);
			sum += t[i];
		}
		int M = Integer.parseInt(br.readLine());
		long[] ans = new long[M];
		for (int i = 0; i < M; i++) {
			input = br.readLine().split(" ");
			int pi = Integer.parseInt(input[0]);
			int xi = Integer.parseInt(input[1]);
			ans[i] = sum - t[pi - 1] + xi;
		}

		for (int i = 0; i < M; i++) {
			System.out.println(ans[i]);
		}
	}
}

class ABC50A {
	public void solve() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] input = br.readLine().split(" ");
		long a = Long.parseLong(input[0]);
		long b = Long.parseLong(input[2]);
		if (input[1].equals("+"))
			System.out.println((a + b));
		else
			System.out.println((a - b));
	}
}

Measured memory_bytes: 8404
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>

typedef __int128_t int128_t;
std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
    long long tmp; input >> tmp; value = tmp;
    return input;
}
std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
    output << (long long)value;
    return output;
}

const int MAX_M = 110;
int N, M, X;
int A[MAX_M];

int main(int argc, char **argv) {
    std::cin >> N >> M >> X;

    for (int i = 1; i <= M; i++) {
        std::cin >> A[i];
    }
    
    int right = 0;
    int left = 0;
    for (int i = 1; i <= M; i++) {
        if (X < A[i]) {
            right++;
        } else {
            left++;
        }
    }
    std::cout << std::min(left, right) << std::endl;

    return 0;
}

Measured memory_bytes: 256