akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

struct SProgram
{
  int s;
  int t;
  int c;
};

int main()
{
  int N, C;
  int timeline[200002];
  int bangumisu[200002] = {0};
  cin >> N >> C;
  vector<SProgram> prog(N);

  for (int i = 0; i < N; i++)
  {
    cin >> prog[i].s >> prog[i].t >> prog[i].c;
    prog[i].s *= 2;
    prog[i].t *= 2;
  }

  for (int i = 1; i <= C; i++)
  {
    //初期化
    for (int j = 0; j < 200002; j++)
      timeline[j] = 0;

    // 各番組
    for (int j = 0; j < N; j++)
    {
      if (prog[j].c == i)
      {
        timeline[prog[j].s - 1]++;
        timeline[prog[j].t]--;
      }
    }

    for (int j = 1; j < 200002; j++)
      timeline[j] += timeline[j - 1];
    // その時間にいくつ使っているか
    for (int j = 0; j < 200002; j++)
    {
      if (timeline[j] > 0)
      {
        bangumisu[j]++;
      }
    }
  }

  int mx = 0;
  for (int j = 0; j < 200002; j++)
  {
    mx = max(mx, bangumisu[j]);
  }
  cout << mx << endl;
  return 0;
}

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

int main(){
        
    string s, t;
    cin >> s >> t;
    int res = 0;
    for(int i =0; i < (int)s.length(); i++){
        if(s[i] != t[i]) res++;
    }
    
    cout << res << endl;
    
    return 0;
    
    
}


Measured memory_bytes: 3924
//
// Created on 2020/07/13.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
//#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    vector<int>menu(5);
    for (int j = 0; j < 5; ++j) {
        cin>>menu[j];
    }
    vector<int>array = {0,1, 2, 3,4};
    int ans = INF;
    do {
        int time = 0;
        for (int i = 0; i < array.size(); i++) {
            while(true){
                if(time % 10 == 0){
                    time += menu[array[i]];
                    break;
                }else{
                        time ++;
                }
            }
        }
        ans = min(ans,time);
    }while (std::next_permutation(array.begin(), array.end()));

    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 3588
//Author: Rahul Purohit

#include<bits/stdc++.h>
#define vi vector<int>
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define ll  long long int
#define pi pair<ll,ll>
#define f first
#define mp make_pair
#define mod 1000000007
#define s second
#define pb push_back
#define mp make_pair
#define N 100001
using namespace std;
int gcd(int a, int b)
{
	if(b==0)
		return a;
	else
		return (b,a%b);
}
/*ll isp[N]={1};
void sieve(int n)
{
	isp[0]=isp[1]=0;
	for(int i=2;i<=n;i++)
	{
		if(isp[i]==1)
		{
			for(int j=i*i;j<=n;j+=i)
			{
				isp[j]==0;
			}
		}
	}
}*/
ll pow(int x,int  y,int m)
{
	ll ans=1;
	while(y!=0)
	{
		if(y%2==1)
		{
			ans=(ans*x)%m;
		}
		x=(x*x)%m;
		y/=2;
	}
	return ans;
}
template <class x>
void swap(x &a,x &b)
{
	x tp;
	tp=a;
	a=b;
	b=tp;
}
template <class x>
void max(x &a,x &b)
{
	return (a>=b?a:b);
}
template <class x>
void min(x &a,x &b)
{
	return (a>=b?b:a);
}
int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll a,b,k;
  cin>>a>>b>>k;
	for(ll i=0;i<k;++i)
	{
		if(i%2)
		{
			b/=2;
			a+=b;
		}
		else
		{
			a/=2;
			b+=a;
		}
	}
	cout<<a<<" "<<b;
	return 0;
}


Measured memory_bytes: 256
use v5.18; # strict say state
use warnings;

chomp (my $n = <STDIN>);
my @x;
for my $i (0..$n-1) {
  my ($p, $l) = split ' ', <STDIN>;
  $x[$i][0] = $p - $l;
  $x[$i][1] = $p + $l;
}
@x = sort {@$a[1] <=> @$b[1]} @x;
my $ans = 0;
my $cur = -1e9;
for my $i (0..$n-1) {
  next if $cur > $x[$i][0];
  $ans++;
  $cur = $x[$i][1];
}
say $ans;

Measured memory_bytes: 20352
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, math.MaxInt64)
}

func readFloat64() float64 {
	sc.Scan()
	r, _ := strconv.ParseFloat(sc.Text(), math.MaxInt64)
	return r
}

func main() {
	n, k := readFloat64(), readFloat64()
	d, num := 0, 1.0
	for {
		num = num * k
		d++
		if n < num {
			break
		}
	}
	fmt.Println(d)
}


Measured memory_bytes: 640
for q in range(12000):
    a, b = input().split()
    if a[0] is '0' and b[0] is '0':
        break

    hit = sum(1 for c, d in zip(a, b) if d is c)
    blow = sum(1 for e in b if e in a) - hit
    print(hit, blow)

Measured memory_bytes: 7420
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
const double PI = acos(-1.0);
const string ALP = "abcdefghijklmnopqrstuvwxyz";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i,n)cin>>a[i];
  SORT(a);
  cout << a[a.size()-1]-a[0] << endl;
  return 0;
}

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

int main()
{
    int m, f, r;
    string a;
    while(1)
    {
        cin >> m >> f >> r;
        int mf = m + f;
        if(m == -1 && f == -1 && r == -1) break;
        else if(m == -1 || f == -1) a = 'F';
        else if(mf >= 80) a = 'A';
        else if(mf >= 65) a = 'B';
        else if(mf >= 50) a = 'C';
        else if(r >= 50) a = 'C';
        else if(mf < 30) a = 'F';
        else a = 'D';
        cout << a << endl;
    }
    return 0;
}




Measured memory_bytes: 3172
#include <iostream>

int main()
{
    int a, b, c, d, e, k;
    std::cin >> a >> b >> c >> d >> e >> k;

    bool can = false;
    if ((e - a) <= k)
    {
        can = true;
    }

    if (can)
    {
        std::cout << "Yay!" << std::endl;
    }
    else
    {
        std::cout << ":(" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int k,s,cnt=0;
int main()
{
    scanf("%d %d", &k, &s);
    for (int x = 0;x <= k;x++)
        for (int y = 0;y <= k;y++){
		    int z = s - x - y;
		    if (z <= k && z >= 0)
		    	cnt++;
    	}
	printf("%d\n", cnt);
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		char[] s = sc.next().toCharArray();
		char[] ss = sc.next().toCharArray();
		int[] a = new int[s.length - ss.length];
		int max = 0;
		for(int i = 0; i <= s.length - ss.length; i++) {
			int count = 0;
			for(int j = 0; j < ss.length; j++) {
				if(s[j+i] == ss[j]) {
					count++;
				}
			}
			if(count > max) {
				max = count;
			}
		}
		Arrays.sort(a);
		System.out.println(ss.length-max);
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 32680
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll,ll> pll;
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
#define MOD 1000000007
#define ARRAY_MAX 1005

const int INF = 1e9+7;


int main(){

    int s;
    cin >> s;

    vector<int> a(ARRAY_MAX,0);

    a[0] = s;
    for(int i = 1;i <= ARRAY_MAX;i++){

        if(a[i-1]%2 == 0){
            a[i] = a[i-1]/2;
        }else{
            a[i] = 3*a[i-1] + 1;
        }
    }

    int mini = INF;
    for(int i = 0;i < ARRAY_MAX;i++){
        for(int j = i+1;j < ARRAY_MAX;j++){
            if(a[i] == a[j]){
                mini = min(j,mini);
            }
        }
    }
    cout << mini+1 << endl;






    return 0;
}

Measured memory_bytes: 256
stack = []
A = list(input().split())

for i in A:
    if i == "+":
        a = stack.pop()
        b = stack.pop()
        c = b + a
        stack.append(c)
    elif i == "-":
        a = stack.pop()
        b = stack.pop()
        c = b - a
        stack.append(c)
    elif i == "*":
        a = stack.pop()
        b = stack.pop()
        c = b * a
        stack.append(c)
    else:
        stack.append(int(i))

print(stack[0])


Measured memory_bytes: 5600
#include<vector>
#include<cmath>
#include<iostream>

using namespace std;

long long candles(int n, int k, std::vector<long long> x) {
  long long answer = 400000000;
  for(int start_index = 0; start_index+k<=x.size(); start_index++) {

    long long start = x[start_index];
    long long end = x[start_index+k-1];

    if(end <=0) {
      answer = min(answer, -start);
      continue;
    }
    if(start <0 && end > 0) {
      long long temp = min(2*(-start) + end, 2*end - start);
      answer = min(temp, answer);
      continue;
    }
    answer = min(answer, end);
  }
  return answer;
}

int main() {
  int n, k;
  cin >> n;
  cin >> k;
  vector<long long> x;
  for(int i =0;i<n;i++) {
    long long j;
    cin >> j;
    x.push_back(j);
  }
  cout << candles(n, k, x);
}

Measured memory_bytes: 1908
import java.io.*
import java.util.*

fun solve(N: Long, a: LongArray){
    println(a.map{ powerOfTwo(it.toInt()) }.sum())
    return
}

fun powerOfTwo(x: Int): Int{
    var count = 0
    var ret = x
    while(ret % 2 == 0){
        ret /=2
        count++
    }
    return count
}

fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toLong()
    val a = LongArray(N.toInt())
    for (i in 0 until N.toInt()) {
        a[i] = sc.next().toLong()
    }
    solve(N, a)
}



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

#define int        long long
#define nn         401
#define inf        (1LL<<60)

int n;
int a[nn], dp[nn][nn], sum[nn][nn];

void preprocess(){
    for(int i=1;i<=n;i++){
        for(int j=i;j<=n;j++){
            sum[i][j] = a[j] + ((j == i) ? 0 : sum[i][j-1]);
        }
    }
}

int solve(int i,int j){
    if(i == j)
        return 0;

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

    int minCost = inf;
    for(int k=i;k<j;k++){
        minCost = min(minCost, sum[i][j] + solve(i,k) + solve(k+1,j));
    }

    return dp[i][j] = minCost;
}

int32_t main(){
    cin>>n;
    memset(dp,-1,sizeof(dp));

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

   cout<<solve(1,n);
}


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

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


signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int n; cin>>n;
  vi a(n);
  rep(i,n) cin>>a[i];
  
  string ans="APPROVED";
  rep(i,n){
    if(a[i]%2==0){
      if(!(a[i]%3==0||a[i]%5==0)) ans="DENIED";
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int cubic(int num)
{
    int ret = 1;
    for(int i = 0; i < 3; i++)
    {
        ret *= num;
    }
    
    return ret;
}

int main(void){
    int num;
    cin >> num;
    
    int answer = cubic(num);
    
    cout << answer << endl;
    
    return 0;
}

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

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

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;
const double EPS = 1e-10;

struct UnionFind {
  vector<int> parent;
  UnionFind(int n) : parent(n) { rep(i, n) parent[i] = i; }
  int root(int a) {
    if (a == parent[a]) return a;
    parent[a] = root(parent[a]);
    return parent[a];
  }
  void unite(int a, int b) {
    a = root(a), b = root(b);
    parent[a] = b;
  }
};

int main() {
  //
  ll n, m, k;
  cin >> n >> m >> k;
  UnionFind uf(n);
  vl fr(n, 0);
  vl bl(n, 0);
  vvl block(n);
  rep(i, m) {
    ll a, b;
    cin >> a >> b;
    a--, b--;
    uf.unite(a, b);
    fr[a]++, fr[b]++;
  }
  rep(i, k) {
    ll a, b;
    cin >> a >> b;
    a--, b--;
    if (uf.root(a) == uf.root(b)) {
      bl[a]++, bl[b]++;
    }
  }
  map<int, int> conn;
  rep(i, n) {
    int p = uf.root(i);
    conn[p]++;
  }
  rep(i, n) {
    int p = uf.root(i);
    cout << conn[p] - fr[i] - bl[i] - 1;
    if (i < n - 1)
      cout << " ";
    else
      cout << endl;
  }
  return 0;
}


Measured memory_bytes: 9344
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	ll a,b,c;
	cin>>a>>b>>c;
	ll lhs = 4ll*a*b;
	if(c - a - b <= 0){
		cout<<"No";
		return 0;
	}
	ll rhs = (c-a-b)*(c-a-b);
	if(rhs > lhs){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}

	return 0;
}

Measured memory_bytes: 256
## from collections import Counter
from collections import Counter

N=int(input())
Word_List=[]

for i in range(N):
    Temp_Word=''.join(sorted(input()))
    Word_List.append(Temp_Word)

Word_Count=Counter(Word_List)
Word_PairCount_List = []

for i in Word_Count.values():
    if i > 1 :
        Word_PairCount_List.extend(range(i))

print(sum(Word_PairCount_List))




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

int main() {
  
  rep(i,5) {
    int a;
    cin >> a;
    if (a == 0) cout << i + 1 << endl;
  }
  return 0;
}


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

using namespace std;

int main() {

	long long L, R; 
	cin >> L >> R;

	int mod_min = 2018;

	R = min(R, L + 2019);

	for (long long  i = L; i < R; i++)
	{
		for (long long j = i + 1; j <= R; j++)
		{

			int mod = (i * j) % 2019;

			mod_min = min(mod_min, mod);
		}
	}

	cout << mod_min << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

int main() {
    cout << fixed << setprecision(10);
    int N;
    cin >> N;
    REP(i, N + 1) {
        if((int)(i * 1.08) == N) {
            cout << i;
            return 0;
        }
    }
    cout << ":(";
    return 0;
}

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

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

int main(){
    int n;cin>>n;
    vector<int> a(n);
    for(auto&& w:a)cin>>w;
    int ans=a[0];
    for(auto&& w:a)ans=gcd(ans,w);
    cout<<ans<<endl;   
    
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int k, s;
    cin >> k >> s;
    int ans = 0;
    rep(i, 0, k + 1){
        rep(j, 0, k + 1){
            if(s - i - j >= 0 && s - i - j <= k) ans++;
        }
    }
    cout << ans << endl;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin >> a[i];
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  
  int ans=0;
  
  for(int i=1;a.size();i++){
    int x=0;
    while(a[a.size()-1]==i){
      a.pop_back();
      x++;
      if(a.size()==0) break;
    }
    if(x<i) ans+=x;
    else ans+=x-i;
  }
  
  cout << ans << endl;
}

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

int main() {

    rep(i, 10000){
        int h, w;
        cin >> h >> w;
        if(h == 0 && w == 0)break;
        rep(i, h){
            rep(j, w){
                if(i % 2 == 0){
                    if(j % 2 == 0){
                        cout << "#";
                    }else{
                        cout << ".";
                    }
                }else if(j % 2 == 0){
                    cout << ".";
                }else{
                    cout << "#";
                }
            }
            cout << endl;
        }
        cout << endl;
    }

}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string day;
    cin>>day;

    if(day=="Sunny")
        cout<<"Cloudy"<<endl;

    else if(day=="Cloudy")
        cout<<"Rainy"<<endl;

    else if(day=="Rainy")
        cout<<"Sunny"<<endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static int max;
	static int Q[];
	static String P[];
	static int head;
	static int tail;

	static void initialize() {
		head = 0;
		tail = 0;
	}

	static boolean isEmpty() {
		return head == tail;
	}

	static boolean isFull() {
		return head == (tail+1)%max;
	}

	static void enqueue1(int x) {
		if(!isFull()) {
			Q[tail] = x;
			if(tail+1 ==max) {
				tail = 0;
			}else {
				tail++;
			}
		}
	}

	static void enqueue2(String s) {
		if(!isFull()) {
			P[tail] = s;
		}
	}

	static int dequeue1() {
		if(!isEmpty()) {
			int x = Q[head];
			if(head+1 == max) {
				head = 0;
			}else {
				head++;
			}
			return x;
		}else {
			return -1;
		}
	}

	static String  dequeue2() {
		if(!isEmpty()) {
			String s = P[head];
			return s;
		}else {
			return "";
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		max = n + 1;
		P = new String[max];
		Q = new int[max];
		int q = sc.nextInt();
		initialize();
		
		for(int i=0;i<n;i++) {
			enqueue2(sc.next());
			enqueue1(sc.nextInt());
		}
		int time = 0;
		while(!isEmpty()) {
			String s = dequeue2();
			int x = dequeue1();
			if(x <= q) {
				time += x;
				System.out.println(s + " " + time);
			}else {
				x -= q;
				enqueue2(s);
				enqueue1(x);
				time += q;
			}
		}

	 }
}




Measured memory_bytes: 73936
#define dbg(...) fprintf(stderr,__VA_ARGS__)
#define dpr(x) cerr<<#x<<": "<<x<<endl;
#define dprc(c) do{cerr<<#c<<":";for(auto&_i:(c)){cerr<<" "<<_i;}cerr<<endl;}while(0)
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
int INF = 1e9+7;
#define all(c) (c).begin(), (c).end()
#define tr(i,c) for(auto i=(c).begin();i!=(c).end();i++)
#define rtr(i,c) for(auto i=(c).rbegin();i!=(c).rend();i++)
#define rep(i,b) for(auto i=0;i<(b);i++)
#define pb push_back
#define sz(c) int((c).size())

void solve(vector<complex<double>>& v, int n,
      complex<double> p, complex<double> q) {
  if (n == 0) {
    v.pb(p);
    return;
  }
  complex<double> s = (q-p) * complex<double>(1.0/3, 0.0) + p;
  complex<double> t = (q-p) * complex<double>(2.0/3, 0.0) + p;
  double ang = M_PI/3;
  complex<double> u = (t-s) * complex<double>(cos(ang), sin(ang)) + s;
  solve(v, n-1, p, s);
  solve(v, n-1, s, u);
  solve(v, n-1, u, t);
  solve(v, n-1, t, q);
}

int main(int argc, char **argv)
{
  int n;
  scanf("%d", &n);
  vector<complex<double>> v;
  solve(v, n, complex<double>(0.0, 0.0), complex<double>(100.0, 0.0));
  for (auto& c:v) {
    printf("%f %f\n", real(c), imag(c));
  }
  printf("%f %f\n", 100.0, 0.0);

  return 0;
}

Measured memory_bytes: 3264
#include <iostream>
#include <stdio.h>
#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;

using namespace std;
void solve();

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

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


/*class CompareDist
{
public:
    bool operator()(pair<ll,int> a,pair<ll,int> b) {
        if(a.F!=b.F)
        return a.F<b.F;
        else
        return a.S>b.S;
    }
};*/

double calc(vii& vec,vi& temp){
    int n=temp.size();
    double tdis=0.0;

    for(int i=1;i<n;i++){
      int cur=temp[i];
      int pre=temp[i-1];

      pair<int,int> en=vec[cur];
      pair<int,int> st=vec[pre];

      double t=(en.F-st.F)*(en.F-st.F)+(en.S-st.S)*(en.S-st.S);
      double dis=sqrt(t);
      tdis+=dis;
    }
    return tdis;
}
int fact(int x){
  int res=1;
  for(int i=2;i<=x;i++){
    res*=i;
  }
  return res;
}
void solve(){

  int test;
  //cin>>test;
  test=1;
  while(test--){
    int n;
    cin>>n;
    vii vec;
    forn(i,0,n){
      int x,y;
      cin>>x>>y;
      vec.pb(mp(x,y));
    }
    vi temp;
    forn(i,0,n)
    temp.pb(i);

    double ans=0;

    do{
        ans+=calc(vec,temp);
    }while(next_permutation(temp.begin(),temp.end()));

    double fac=double(fact(n));
    ans/=fac;
    cout<<fixed<<setprecision(10)<<ans;
  }
}

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

///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)%hell)*k%hell)%hell;
  else
  return ((pw(k,x/2)%hell)*(pw(k,x/2)%hell))%hell;
}

/*void sieve(){

  for(int i=2;i<=1000000;i++){
    if(prime[i]==true){
      for(int j=i*i;j<=1000000;j+=i)
      prime[j]=false;
    }
  }

}*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define testcase() int t; cin>>t; while(t--)
#define fo(n) for (int i = 0; i < n; i++)
#define deb(x) cout << #x << " = " << x << endl;
#define ll long long

using namespace std;

void solve()
{
    ll n;
    cin >> n;
    char alpha[26];
    char c = 'a';
    fo (26)
    {
        alpha[i] = c;
        c++;
    }/*
    fo(26)
        cout << alpha[i] << " ";
    cout << endl;*/
    vector<int> v;
    n;
    while (n > 26)
    {
        int r = n % 26;
        if (r == 0)
        {
            n--;
            r = 26;
        }
        v.push_back(r);
        //deb(r);
        n /= 26;
    }
    //deb(n);
    v.push_back(n);
    for (int i = v.size() - 1; i >= 0; i--)
    {
        int index = v[i]-1;
        cout << alpha[index];
    }
    cout << endl;
}

int main()
{
    //testcase()
    {
        solve();
    }
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int a[100001];
    map<long long, long long> mp;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        mp[a[i]] = 0;
    }
    for(int i = 0; i < n; i++){
        mp[a[i]]++;
    }
    long long ans = 0;
    for(auto itr = mp.begin(); itr != mp.end(); itr++){
        if(itr->first > itr->second){
            ans += itr->second;
        }
        else{
            ans += itr->second - itr->first;
        }
    }
    cout << ans << endl;
}

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

int main(){
    char c[4];

    int count = 0;

    for(int i=0; i<4; i++){
        cin>>c[i];

        if(c[i] == '+')count++;

        else count--;

    }

    cout<<count<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <array>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
const int  INF=10e7;

typedef  pair<int,int> P;


int main(){
     string s;
     cin>>s;
     int n=s.length();
     long long ans=0;
     for(int i=0;i<(1<<n-1);++i){
          long long sa=0;
          long long a=s[0]-'0';
          for(int j=0;j<n-1;++j){
          if(i&(1<<j)){
               sa+=a;
               a=0;
          }
          a=a*10+s[j+1]-'0';
          }
          sa+=a;
          ans+=sa;
     }    
     cout<<ans<<endl;
}

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

using namespace std;

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

int main(){
	int n;
	scanf("%d", &n);
	while (true){
		if (is_prime(n)){
			printf("%d\n", n);
			return 0;
		}
		n++;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=3e5+5;
int mod=1e9+7;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
ll qpow(ll a,ll b){ll ans=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)ans=ans*a%mod;a=a*a%mod;}return ans;}
ll gcd(ll a,ll b){return b>0?gcd(b,a%b):a;}
int n,m,T;
int a[maxn];
int dp[5005][5005];
void update(int &x, int y) {
	x += y;
	if (x >= mod) x -= mod;
}
int main(){
	cin>>n>>mod;
	m=(n-1)/2;
	dp[0][0]=1;
	for(int i=1;i<=m;i++){
		for(int j=0;j<=n;j++){
			for(int k=0;k*i<=j;k++){
				update(dp[i][j],1ll*dp[i-1][j-k*i]*(k+1)%mod);
			}
		}
	}
	int ans=0;
	if(n&1){
		for(int i=1;i<=n;i++){
			for(int j=0;j*(m+1)<=n-i;j++){
				update(ans,dp[m][n-i-j*(m+1)]);
			}
		}
	}else{
		for(int i=1;i<=n;i++){
			for(int j=0;j*(m+1)<=n-i;j++){
				update(ans,1ll*dp[m][n-i-j*(m+1)]*(j+1)%mod);
			}
		}
	}
	cout<<ans<<endl;
	
	return 0;
}
/*

*/



Measured memory_bytes: 49408
#include<iostream>
using namespace std;
int h, w, n;
int main() {
    cin >> h;
    cin >> w;
    cin >> n;
    int k = max(h, w);
    if (n % k == 0) {
        cout << n / k << endl;
    } else {
        cout << n / k + 1  << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int state = 0;
  while(1){
    char c = getchar();
    if (c == '\0' || c == '\n'){
      break;
    }
    if(state==0){
      if(c == 'A'){
        state = 1;
      }else{
        state = 5;
      }
    }else if (state == 1){
      if (c >= 'a' && c <= 'z'){
        state = 2;
      }else{
        state = 5;
      }
    }else if (state == 2){
      if (c >= 'a' && c <= 'z'){
        continue;
      }else if(c == 'C'){
        state = 3;
      }else{
        state = 5;
      }
    }else if (state == 3){
      if (c >= 'a' && c <= 'z'){
        state = 4;
      }else{
        state = 5;
      }
    }else if (state == 4){
      if (c >= 'a' && c <= 'z'){
        continue;
      }else{
        state = 5;
      }
    }
  }
  if (state == 4){
    puts("AC");
  }else{
    puts("WA");
  }
  return 0;
}


Measured memory_bytes: 128
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static Input in = new Input(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = in.nextInt();
        int[] A = new int[N];
        int[] B = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = in.nextInt();
            B[i] = in.nextInt();
        }
        Arrays.sort(A);
        Arrays.sort(B);
        if (N % 2 == 0) {
            out.println(B[N/2-1] + B[N/2] - A[N/2-1] - A[N/2] + 1);
        } else {
            out.println(B[N/2] - A[N/2] + 1);
        }

        out.flush();
    }

    static class Input {
        private BufferedReader br;
        private String[] buff;
        private int index = 0;

        Input(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }
        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }
        String next() {
            while (buff == null || index >= buff.length) {
                buff = nextLine().split(" ");
                index = 0;
            }
            return buff[index++];
        }
        byte nextByte() {
            return Byte.parseByte(next());
        }
        short nextShort() {
            return Short.parseShort(next());
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        float nextFloat() {
            return Float.parseFloat(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
        BigDecimal nextBigDecimal() {
            return new BigDecimal(next());
        }
    }
}



Measured memory_bytes: 58284
#define taskname "z"

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>

using namespace std;
#define long long long

const int N = 2e5 + 10;

int n, h[N];
long C, dp[N];

struct line {
    // ax + b;
    long a, b;
    long operator () (long x) {return a * x + b;}
};
vector<line> convex;

bool ok(line A, line B, line C)
{return (long) (B.b - A.b) * (A.a - C.a) < (long) (C.b - A.b) * (A.a - B.a);}

int main()
{
//    freopen(taskname".INP", "r", stdin);
//    freopen(taskname".OUT", "w", stdout);
    cin.tie(nullptr); ios_base::sync_with_stdio(false);

    cin >> n >> C;
    for (int i = 1; i <= n; ++i) cin >> h[i];

    int cur = 0;
    for (int i = 1; i <= n; ++i) {
        if (i > 1) {
            while (cur + 1 < (int) convex.size() && convex[cur](h[i]) >= convex[cur + 1](h[i])) ++cur;
            dp[i] = convex[cur](h[i]) + (long) h[i] * h[i] + C;
        }

        line C = {-2 * h[i], dp[i] + (long) h[i] * h[i]};
        while (convex.size() >= 2 && !ok(convex[convex.size() - 2], convex.back(), C)) convex.pop_back();
        convex.push_back(C);
    }
    cout << dp[n];

    return 0;
}


Measured memory_bytes: 8688
N = int(input())

def gcd(a, b):
  while b:
    a, b = b, a%b
  return(a)

result = []
x = 1
for i in range(N):
  T = int(input())
  x = x * T // gcd(x, T)
  result.append(x)
print(max(result))

Measured memory_bytes: 3060
# D - Triangles
import bisect

N=int(input())
Li=list(map(int,input().split()))
Li.sort()

ans=0

for i in range(N):
    for j in range (i+1,N):
        a=Li[i]+Li[j]
        t=bisect.bisect_left(Li,a)
        ans+=t-(j+1)

print(ans)


Measured memory_bytes: 9236
#include <iostream>
using namespace std;
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string>
#include <cstdlib>


int main() {
	int n; cin >> n;
	string s, t; cin >> s >> t;
	int flag = 1;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n-i; j++) {
			if(s[j+i] != t[j]) { flag = 0; break; }
			flag = 1;
		}
		if(flag) { cout << 2*n-n+i <<endl; return 0;}
	}
	cout << 2*n <<endl;
	return 0;
}

Measured memory_bytes: 256
S=input()
T=input()
count=1
for i in range(len(S)):
  if S[i]==T[i]:
    count=1
  else:
    count=0
    break
    
if count==1:
  if (len(S)+1)==len(T):
    print('Yes')
  else:
    print('No')
else:
  print('No')

Measured memory_bytes: 9120
#include<iostream>
#include<algorithm>
#include<vector>
using lint=int64_t;
using namespace std;

int main()
{
	int N;
	int A[100010]={};
	
	cin >> N;
	for(int i=0;i<N;i++)
		cin >> A[i];
	
	int cnt=0;
	int type=0;
	for(int i=1;i<N;i++)
	{
		if(A[i]==A[i-1])continue;
		if(A[i]>A[i-1])
		{
			if(type==0)
				type=1;
			else if(type==-1)
			{
				type=0;
				cnt++;
			}
		}
		if(A[i]<A[i-1])
		{
			if(type==0)
				type=-1;
			else if(type==1)
			{
				type=0;
				cnt++;
			}
		}
	}
	
	cout << cnt+1 << endl;
	return 0;
}


Measured memory_bytes: 640
// ==============================================
// Library
// ==============================================
#define _CRT_SECURE_NO_WARNINGS

// When you are using the gcc compiler, you need only the following lines.
// #include <bits/stdc++.h>

// When you are using other compilers, you need the following line instead.
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;

// competitive macro
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i ,n) for (int i = (n) - 1; i >= 0; i--)
#define LL long long
#define ULL unsigned long long

// If you use this function, "cin" speeds up.
// However, you can not mix "cin" and "scanf", "cout" and "printf".
void fastIOS()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}
// ==============================================
// ==============================================

array<int, 100000> A = {};

int main()
{
	fastIOS();

	int H, W;
	cin >> H >> W;

	vector<string> C;
	REP(y, H)
	{
		string tmp;
		cin >> tmp;
		C.push_back(tmp);
	}

	REP(y, H)
	{
		cout << C[y] << "\n";
		cout << C[y] << "\n";
	}

}

Measured memory_bytes: 256
#include<stdio.h>


#define ALL_CARD_NUM 52
#define CARD_NUM 13

int main()
{
	int n;
	int iCard[ALL_CARD_NUM];	//1なら持ってる0なら持ってない
	char szMark[2];
	int iCardNum;
	int iCount;

	//配列の初期化
	for (iCount = 0; iCount < ALL_CARD_NUM; iCount++)
	{
		iCard[iCount] = 0;
	}

	scanf("%d", &n);
	for (iCount = 0; iCount < n; iCount++)
	{
		scanf("%s", szMark);
		scanf("%d", &iCardNum);
		//絵柄がスペード
		if (strcmp(szMark,"S")==0)
		{
			iCard[iCardNum-1] = 1;
		}
		//絵柄がハート
		else if (strcmp(szMark, "H") == 0)
		{
			iCard[iCardNum - 1+ CARD_NUM] = 1;
		}
		//絵柄がクラブ
		else if (strcmp(szMark, "C") == 0)
		{
			iCard[iCardNum - 1 + (CARD_NUM *2)] = 1;
		}
		//絵柄がダイヤ
		else if (strcmp(szMark, "D") == 0)
		{
			iCard[iCardNum - 1 + (CARD_NUM * 3)] = 1;
		}
		else
		{
			printf("指定した入力をしてください\n");
		}

	}

	for (iCount = 0; iCount < ALL_CARD_NUM; iCount++)
	{
		if (iCard[iCount] == 0)
		{
			switch (iCount / CARD_NUM)
			{
			case 0:
				printf("S %d\n", iCount % CARD_NUM + 1);
				break;
			
			case 1:
				printf("H %d\n", iCount % CARD_NUM + 1);
				break;
			
			case 2:
				printf("C %d\n", iCount % CARD_NUM + 1);
				break;
			
			case 3:
				printf("D %d\n", iCount % CARD_NUM + 1);
				break;
			default:
				break;
			}

		}
	}

	
}


Measured memory_bytes: 2048
#include <iostream>
#include <queue>
#include <algorithm>
#include <cstdio>
using namespace std;
#define F first
#define S second
#define INF 2e9
#define MP(i, j) make_pair((i), (j))
typedef pair<int, int> P;
int revel[500][500];

int r, w, h, x, y;
vector<P> able, able2;
struct S{
	int x, y, r;
	S(int inx, int iny, int inr): x(inx), y(iny), r(inr){}
	bool operator < (const S &s)const{
		return r > s.r;
	}
};
void dijkstra(vector<P> &able){
	int nowr = 1, cnt = 0;
	bool flag[500][500] = {};
	priority_queue<S> que;
	que.push(S(x - 1, y - 1, 1));
	flag[y - 1][x - 1] =  true;
	while(!que.empty()){
		S p = que.top();
		if(nowr < revel[p.y][p.x]){
			able.push_back(MP(cnt, nowr));
			nowr = revel[p.y][p.x];
		}
		cnt++;
		
		que.pop();
		for(int i = -1; i <= 1; i++){
			if(!flag[p.y + i][p.x]&& p.y + i >= 0 && p.y + i < h && p.x >= 0 && p.x < w){
				que.push(S(p.x, p.y + i, revel[p.y + i][p.x]));
				flag[p.y + i][p.x] = true;
			}
			if(!flag[p.y][p.x + i]&& p.y >= 0 && p.y < h && p.x + i >= 0 && p.x + i < w){
				que.push(S(p.x + i, p.y, revel[p.y][p.x + i]));
				flag[p.y][p.x + i] = true;
			}
		}
	}
	able.push_back(MP(cnt, nowr));
}
int main(){
	while(cin >> r && r){
		cin >> w >> h >> x >> y ;
		int ans = INF;
		able.clear();
		able2.clear();
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				scanf("%d", &revel[i][j]);
			}
		}
		dijkstra(able);
		cin >> w >> h >> x >> y;
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				scanf("%d", &revel[i][j]);
			}
		}
		dijkstra(able2);

		for(int i = 0; i < able.size(); i++){
			P pp = MP(r - able[i].F, 0);
			if(pp.F > 0){
				int p = lower_bound(able2.begin(),able2.end(), pp) - able2.begin();
				if(p != able2.end() - able2.begin())
					ans = min(ans, able2[p].S + able[i].S);
			}
			else{
				ans = min(ans, able[i].S);
			}
		}
		cout << ans << endl;
	}
}

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

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;

int main() {
	int h, w;
	while (cin >> h >> w) {
		if (h == 0 && w == 0)
			break;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				char c = '.';
				if (i == 0 || j == 0 || i == h - 1 || j == w - 1)
					c = '#';
				cout << c;
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    int a;
    cin >>a;

    cout << 3*a*a <<endl;
    return (0);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
typedef pair<int,int>P;
int n,m,ans;
int cnt;
P t[200];
int dp[200];
int main(){
  while(cin>>n&&n){
    cnt=ans=0;
    for(int i=0;i<n;i++)cin>>t[cnt].first>>t[cnt].second,cnt++;
    cin>>m;
    for(int i=0;i<m;i++)cin>>t[cnt].first>>t[cnt].second,cnt++;
    sort(t,t+cnt);
    for(int i=0;i<cnt;i++)dp[i]=1;

    for(int i=1;i<cnt;i++){
      
      for(int j=0;j<i;j++){
	if(t[j].first<t[i].first&&t[j].second<t[i].second){
	  dp[i]=max(dp[i],dp[j]+1);
	}
      }
      ans=max(ans,dp[i]);
      //cout<<t[i].first<<' '<<t[i].second<<' '<<dp[i]<<endl;
    }
    cout<<ans<<endl;
    
  }
  return 0;
}

Measured memory_bytes: 1164
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7; 

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF_INT (1<<30)
#define INF_LL (1ll<<62)

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

int a,b;

int main(){
    cin>>a>>b;
    if(a>b){
        rep(i,a)cout<<b;
    }
    else{
        rep(i,b)cout<<a;
    }
    cout<<endl;
    
}

Measured memory_bytes: 256
#include<iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <functional>
#include <vector>

using namespace std;
int main()
{
	long long N = 0;
	long long M = 0;
	long long Ans = 0;

	cin >> N >> M;

	if (2*N >= M) {
		Ans = M / 2;
	}
	else {
		Ans = N + (M - 2 * N) / 4;
	}

	cout << Ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

        Scanner s = new Scanner(System.in);
	    int N = s.nextInt();
	    int anser = 0;
	    for(int i=1; i<N+1; i++) {
	    	if(String.valueOf(i).length() %2 == 1) {
	    		anser++;
	    		
	    	}
	    }
	    
	    System.out.println(anser);
		
	}
}


Measured memory_bytes: 27732