akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;

namespace ABC067_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var sss = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var num = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse).ToList();
            num.Sort((a, b) => b - a);
            var sum = 0;
            for (var i = 0; i < sss[1]; i++)
            {
                sum += num[i];
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 13268
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define INF = 1000000100;

int main(){
    string S,T;
    cin >> S >> T;
    cout << T+S << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    string s;
    cin >> s;
    int sum = 0, stone = 0, paper = 0;
    repi(i, s){
        if(*i == 'p' && paper < stone){
            ++paper;
        
        }else if(*i == 'p'){
            sum--;
            stone++;
        }else if(*i == 'g' && paper < stone){
            ++paper;
            ++sum;
        }else{
            ++stone;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 512
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD

H,A = imn()

print(math.ceil(H/A))

Measured memory_bytes: 5808
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>


using namespace std;


int main()
{
	char s[5];
	for(int i=0;i<4;i++){
		cin >> s[i];
	}
	
	if(s[0] == s[1] && s[2] == s[3] && s[0] != s[2])cout << "Yes" << endl;
	else if(s[0] == s[2] && s[1] == s[3] && s[0] != s[1])cout << "Yes" << endl;
	else if(s[0] == s[3] && s[1] == s[2] && s[0] != s[1])cout << "Yes" << endl;
	else cout << "No" << endl;
		
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
 
#define MAX 500000
 
typedef struct{
  int key,le,ri;
}Node;
  
Node tree[MAX+1];
int size;
  
void insert(int);
void inorder(int);
void preorder(int);
 
int main(int argc, char *argv[]){
  int n, i, first;
  first = 1;
 
  scanf("%d", &n);
 
  for(i=0;i<=n;i++) 
 tree[i].key = tree[i].le = tree[i].ri = -1;
 
  size = 0;
 
  while(n--){
    char str[100];
    scanf("%s", str);
    if(!strcmp(str, "insert")){
      int in;
      scanf("%d", &in);
      if(first){
        tree[size++].key = in;
        first = 0;
      }
      else insert(in);
    }else{
      inorder(0);
      printf("\n");
      preorder(0);
      printf("\n");
    }
  }
  return 0;
}
 
void insert(int x){
  int p = 0;
  while(1){
    if(x < tree[p].key){
      if(tree[p].le == -1){
        tree[p].le = size;
        tree[size++].key = x;
        break;
      }else p = tree[p].le;
    }else{
      if(tree[p].ri == -1){
        tree[p].ri = size;
        tree[size++].key = x;
        break;
      }else p = tree[p].ri;
    }
  }
}
  
void inorder(int p){
  if(tree[p].le != -1) inorder(tree[p].le);
  printf(" %d", tree[p].key);
  if(tree[p].ri != -1) inorder(tree[p].ri);
}
  
void preorder(int p){
  printf(" %d", tree[p].key);
  if(tree[p].le != -1) preorder(tree[p].le);
  if(tree[p].ri != -1) preorder(tree[p].ri);
}



Measured memory_bytes: 7528
/*input
11 30
12 1
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long 
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back

#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#define REP(i,n) for (int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)

#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

int raise(int a,int n,int m = MOD){
  if(n == 0)return 1;
  if(n == 1)return a;
  int x = 1;
    x *= raise(a,n/2,m);
    x %= m;
    x *= x;
    x %= m;
    if(n%2)x*= a;
    x %= m;
    return x;
}

int floor1(int n,int k){
    if(n%k == 0 || n >= 0)return n/k;
    return (n/k)-1;
}

int ceil1(int n,int k){
    return floor1(n+k-1,k);
}

void solve(){
  	int a,b,c,d;cin >> a >> b >> c >> d;
  	cout << (a != c);
}

signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  //freopen(".in","r",stdin);freopen(".out","w",stdout);
  int t = 1;
  //cin >> t;
  while(t--){
    solve();
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
const unsigned int M= 1000000007;
using namespace std;

int main()
{
 long long int n,k;
  cin>>n>>k;
  long long int ans=0;
 
  long long int sm[200005]={0};
  for(int i=1;i<200005;i++)sm[i]=sm[i-1]+i;
  for(int i=k;i<=(n);i++)
  {
    long long int mini=sm[i-1];
    long long int maxi=sm[n]-sm[n-i];
    
    ans+=(maxi-mini+1);
    
    ans%=M;
    
  }
          cout<<(ans+1)%M<<endl;
  
}

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

int main()
{
    int H, N;
    int D = 0;
    cin >> H >> N;
    vector<int> data(N);
    for (int i = 0; i < N; i++)
    {
        cin >> data.at(i);
        D += data.at(i);
    }
    if (H <= D)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 640
N = int(input())
S = input()

ans = ''
l = 0
for i in range(N):
    if S[i] == '(':
        l += 1
        ans = ans + '('
    else:
        if l > 0:
            ans = ans + ')'
            l -= 1
        else:
            ans = '(' + ans + ')'
ans = ans + ')'*l
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 1010101010101010;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(){
  ll a,b; cin>>a>>b;
  if(a>b) swap(a,b);
  while(b%a!=0){
    b=b%a;
    if(a>b) swap(a,b);
    if(a==0) break;
  }
  //cout<<sqrt(a)<<endl;
  int cnt=1;
  ll c=a;
  for(int i=2;i<=sqrt(a);i++){
    bool judge=false;
    while(a%i==0){
      a/=i;
      judge=true;
    }
    if(judge){
      cnt++;
      //cout<<i<<endl;
    }
  }
  if(a>1) cnt++;
  cout<<cnt<<endl;
}


Measured memory_bytes: 3664
//Volume5-0521
import java.util.Scanner;

class Main {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);


		final int[] t   = {500,100,50,10,5,1};
		final int   EOF = 1000;
		      int   c,num;

		while(true){
			num = 0;
			c = 1000-sc.nextInt();
			if(c==EOF){break;}
			for(int i=0;i<t.length;i++){
				if(c/t[i]!=0){num+=c/t[i];c=c%t[i];}
			}
			System.out.println(num);
		}
	}
}

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

using namespace std;

const long long MOD=998244353;

long long add_mod(long long x,long long y){
	return (x+y)%MOD;
}

long long sub_mod(long long x,long long y){
	return (x-y+MOD)%MOD;
}

long long mul_mod(long long x,long long y){
	return x*y%MOD;
}

long long inv_mod(long long x){
	if(x == 1) return 1;
	long long d = MOD/x+1;
	return d*inv_mod(x-(MOD%x))%MOD;
}

long long div_mod(long long x, long long y){
	return x*inv_mod(y)%MOD;
}

long long pow_mod(long long x,long long y){
	long long r = 1;
	for(long long n = x;y != 0;y /= 2,n = mul_mod(n,n)){
		if(y % 2){
			r = mul_mod(r,n);
		}
	}
	return r;
}

int i,j,n;
long long dp[99999],dpi[99999];

int main(){
  long long ans = 0;
  cin >> n;
  vector<long long> a(n);
  for(i = 0;i < n;i++) cin >> a[i];
  long long s = 0;
  for(i = 0;i < n;i++) s += a[i];
  dp[0] = 1;
  dpi[0] = 1;
  for(i = 0;i < n;i++){
    for(j = 300*i;j >= 0;j--){
      dp[j+a[i]] = add_mod(mul_mod(2,dp[j+a[i]]),dp[j]);
      dpi[j+a[i]] = add_mod(dpi[j+a[i]],dpi[j]);
    }
    for(j = a[i]-1;j >= 0;j--){
      dp[j] = mul_mod(2,dp[j]);
    }
  }
  ans = pow_mod(3,n);
  for(i = 0;i <= 300*n;i++){
    if(i*2 >= s){
      ans = sub_mod(ans,mul_mod(3,dp[i]));
    }
  }
  if(s%2 == 0){
    ans = add_mod(ans,mul_mod(3,dpi[s/2]));
  }
  cout << ans << endl;
}


Measured memory_bytes: 1664
#include <iostream>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int x, y; cin>>x>>y;
	for(int i=0;i<=x;i++){
		if(2*i + (x-i)*4 == y){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
}

Measured memory_bytes: 3040
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[600][600];

int main(){
  cin >> n >> m;
  if(2 * n > m)print(m / 2);
  else{
    ll ans = n;
    m -= 2*n;
    print(ans + m/4);
  }
  return 0;
}

Measured memory_bytes: 256
S = input()

count = 0
for i in range(len(S)):
    if S[i] == 'W':
        continue
    else:
        break
S = S[i:]

count = 0
score = 0
for i in range(len(S)):
    if S[i] == 'W':
        score += (i - count)
        count += 1
print(score)

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

using namespace std;
typedef long long LL;

int main(){
  int N;
  cin >> N;
  vector<LL> A(N), B(N), C(N);
  rep(i,N) cin >> A[i];
  rep(i,N) cin >> B[i];
  rep(i,N) cin >> C[i];
  sort(A.begin(),A.end());
  sort(B.begin(),B.end());
  sort(C.begin(),C.end());
  vector<LL> Cnum(N);
  rep(i,N) Cnum[i]=N-(upper_bound(C.begin(),C.end(),B[i])-C.begin());
  vector<LL> Csum(N);
  Csum[0]=Cnum[0];
  rep(i,N-1) Csum[i+1]=Csum[i]+Cnum[i+1];
  LL ans=0;
  rep(i,N){
    int a=A[i];
    int bn=upper_bound(B.begin(),B.end(),a)-B.begin();
    if(bn>0) ans+=Csum[N-1]-Csum[bn-1];
    else ans+=Csum[N-1];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define Fst first
#define Snd second
#define RG register
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int UI;
typedef unsigned long long ULL;
template<typename T> inline void read(T& x) {
	char c = getchar();
	bool f = false;
	for (x = 0; !isdigit(c); c = getchar()) {
		if (c == '-') {
			f = true;
		}
	}
	for (; isdigit(c); c = getchar()) {
		x = x * 10 + c - '0';
	}
	if (f) {
		x = -x;
	}
}
template<typename T, typename... U> inline void read(T& x, U& ... y) {
	read(x), read(y...);
}
const int N=1e5+10,P=1e9+7;
int n;
char s[N];
int A[N],F[N][2];
int DP(int pos,int pre,int lim) {
  if(!pos) return 1;
  if(!lim&&~F[pos][pre]) return F[pos][pre];
  int r=lim?A[pos]:1,res=0;
  for(int i=0;i<=r;++i) (res+=DP(pos-1,i,lim&&i==r)*(i?2:1)%P)%=P;
  if(!lim) F[pos][pre]=res;
  return res;
}
//#define rua
int main() {
//	ios::sync_with_stdio(false);
#ifdef rua
	freopen("GG.in","r",stdin);
#endif
  scanf("%s",s+1);
  n=strlen(s+1);
  for(int i=1;i<=n;++i) A[i]=s[i]-'0';
  reverse(A+1,A+n+1);
  mem(F,-1);
  int res=0;
  for(int i=0;i<2;++i) (res+=DP(n-1,i,i)*(i?2:1)%P)%=P;
  printf("%d\n",res);
  return 0;
}


Measured memory_bytes: 9344
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <set>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif
template<class T> ostream& operator<<(ostream& os, vector<T> const& v){
    rep(i,v.size()) os << v[i] << (i+1==v.size()?"":" ");
    return os;
}

typedef int Weight;
struct Edge {
    int src, dst;
    Weight weight;
    Edge(int src, int dst, Weight weight) :
        src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
    return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
        e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;

Graph g;
bool vis[20000];

int dfs(int v){
    vis[v] = true;
    if(g[v].size()==0) return 1;
    int res = 0;
    for(auto & e : g[v]){
        if(!vis[e.dst]) res += dfs(e.dst);
    }
    return res;
}

typedef vector<string> vs;

int main(){
#ifdef DEBUG
    freopen("in","r",stdin);
#endif
    int n;
    while(cin>>n && n){
        vs node(n);
        vector<vs> ch(n);
        vs app;
        g.clear();
        rep(i,n){
            string s; cin >> s;
            rep(j,s.size()) if(!isalpha(s[j])) s[j]=' ';
            stringstream ss(s);
            ss >> node[i];
            app.pb(node[i]);
            string x;
            while(ss >> x){
                ch[i].pb(x);
                app.pb(x);
            }
        }
        sort(all(app));
        app.erase(unique(all(app)), app.end());
        int V = app.size();
        g.assign(V,{});
        int root;
        rep(i,n){
            int src = lower_bound(all(app), node[i])-app.begin();
            if(i==0) root = src;
            rep(j,ch[i].size()){
                int dst = lower_bound(all(app), ch[i][j])-app.begin();
                g[src].eb(src,dst,0);
            }
        }
        rep(i,V) vis[i] = false;
        cout << dfs(root) << endl;
    }
}

Measured memory_bytes: 1372
// {{{ by unolight
#pragma region
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define RALL(x) rbegin(x),rend(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

namespace { namespace unolight {
// Read Input
template<class T> void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( int64_t &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }
void R() {}
template<class T, class... U> void R( T& head, U&... tail ) { _R(head); R(tail...); }
// Write Output
template<class T> void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
void _W( const int64_t &x ) { printf("%" PRId64,x); }
void _W( const double &x ) { printf("%.16f\n",x); }
void _W( const char &x ) { putchar(x); }
void _W( const char *x ) { printf("%s",x); }
template<class T> void _W( const vector<T> &x ) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W( const T& head, const U&... tail ) { _W(head); putchar(sizeof...(tail)?' ':'\n'); W(tail...); }

#ifdef UNOLIGHT
#include "dump.hpp"
#else
#define dump(...)
#endif

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}
#pragma endregion
// }}}

void main() {
    int n;
    R(n);
    vector<PII> vs(n);
    REP(i,n) R(vs[i].first, vs[i].second);
    sort(ALL(vs));
    int ans=n;
    REP(i,n) {
        REP1(j,i+1,n-1) {
            int cnt=0;
            int dx=vs[j].first-vs[i].first;
            int dy=vs[j].second-vs[i].second;
            REP(k,n) {
                int x=vs[k].first, y=vs[k].second;
                auto it=lower_bound(ALL(vs), MP(x+dx, y+dy));
                if ( it!=vs.end()&&*it==MP(x+dx, y+dy) ) cnt++;
            }
            chmin(ans,n-cnt);
        }
    }
    W(ans);
}

}} // {{{ main
int main() { unolight::main(); return 0; }
// }}}


Measured memory_bytes: 3756
N=input()
b=input().split()
sum=0
bigsum=0
for i in b:
    sum+=eval(i)
standard=sum/2
for i in b:
    bigsum+=eval(i)
    if bigsum>standard:
        smallsum=bigsum-eval(i)
        break
if bigsum-standard>standard-smallsum:
    print(sum-2*smallsum)
else:
    print(2*bigsum-sum)


Measured memory_bytes: 20168
/*　　　　　　　{:i:i:|i:i:/l/l--　 　 　--l/li:i:i|i:i:i:i}
　　　　　　 　 {:rx|:i:i ィi芥ミ 　 　 .ィi芥ミｉ:ｉ|ﾍ:i:i:}
.　　　 　 　 　 ｛ﾏ|ｉ:  {::’:} 　 　 　{:‘::} :ｉ:i:|〉｝:/
　　 　 　 　 　 乂|:i:| ｀¨¨¨¨´ 　 　　｀¨¨¨´  :i:ｉ:|ｼ/
　 　 　 　 　 　 ﾉ:|:i|　　　　　　′　　　 　   |:i:i:|ﾂ
　　　　　　　　/:/|:i:| ､　　　 　_ _ 　　　　  |:i:i:|
　 　 　　 　 /:/ .|:i:|/ ＼　　　 　 　     ｨ〔|:i:/
　　 　 　  　 〈;/ く刈＿ 个 　   -   　＜}　./|/_〉
　　     　　 r-っ'~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ|___
　　 　     /／ニつ　　　　　　 ､　　　　　　　ノﾆﾆ　＼
.　　　     |　　ニ⊃ 　./　/　 ──   /　/　　..⊆ﾆﾆ　　:|
.　　　     |　　丁´　 /|￣|￣  ─‐ /|￣|￣ 　 .￣|丁 　|
.　　　     |　　ﾉ.  　 |￣|￣  ─‐  |￣|￣ 　 　.|八 　|
.　　　     |　　||. 　 |￣|￣ |￣| |￣|￣ 　   .|　|
.　 　 　   |  　||   　￣￣￣　￣ 　￣￣￣　　  .|　|  |
.　 　 　  　    ||＿＿＿＿＿＿＿＿＿＿＿＿______|__　　 ',
　 　      ,′　 | ７ﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆ}  ,′
.　　     {　　　|/　}ﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆ{/ 　 　
*///讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐。
#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 <cmath>
#include <limits>

using namespace std;

#define rep(a) _rep(0,int(a))
#define repj(a) for(int j=0;j<int(a);j++)
#define repk(a) for(int k=0;k<int(a);k++)
#define _rep(a,b) for(int i=int(a);i<int(b);i++)
#define ll long long
#define fst first
#define snd second
#define pf(b) printf("%.12f\n",(double)b)
#define _GLIBCXX_DEBUG
const double pai = 3.1415926535897;
#define _cos(n) cos(n*pai/180)
#define l_b lower_bound
#define u_b upper_bound
#define b_s binary_search

//factorial(練習)　階乗
int fact(int n) {
	int a = 1;
	for (int i = 1;i <= n;i++) a *= i;
	return a;
}
int sa(int n, int m) {      //差！
	if (n < m)return m - n;
	else return n - m;
}
int keta(int num) {
	int n = 0;
	if (num == 0) {
		return 1;
	}
	while (num != 0) {
		num /= 10;
		n++;
	}
	return n;
}

int x, n,p[123],a,b,A,B;
signed main() {
	cin >> x >> n;
	rep(n)cin >> p[i];
	sort(p, p + n);
	int i = x;
	while (1) {
		int z=0;
		repj(n) {
			if (p[j] == i) {
				z=1;
			}
		}
		if (z==1)i++;
		else {
			a = sa(i, x);
			A = i;
			break;
		}
	}
	i = x;
	while (1) {
		bool z = 0;
		repj(n) {
			if (p[j] == i) {
				z=1;
			}
		}
		if (z==1)i--;
		else {
			b = sa(i, x);
			B = i;
			break;
		}
	}
	if (a < b)cout << A << endl;
	else cout << B << endl;
}


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

template<typename T> struct LiChaoTree {
    struct Line {
        T a, b;
        Line(T a, T b) : a(a), b(b) {}
        // f(x) = ax + b
        inline T f(T x) const { return a * x + b; }
        inline bool cmp(const Line &o, const T &x) const {
            return f(x) < o.f(x);
        }
    };
    vector<T> xs;
    vector<Line> seg;
    int sz; T INF;
    LiChaoTree(T MAX_INT, T INF) : INF(INF) {
        for (T i = 0; i <= MAX_INT; i++) xs.emplace_back(i);
        build();
    }
    LiChaoTree(const vector<T> &x, T INF) : xs(x), INF(INF) { build(); }
    void build() {
        sz = 1;
        while (sz < xs.size()) sz <<= 1;
        while (xs.size() < sz) xs.emplace_back(xs.back()+1);
        seg.assign(2*sz-1, Line(0, INF));
    }
    void update(Line &x, int k, int l, int r) {
        int m = (l + r) / 2;
        bool lef = x.cmp(seg[k], xs[l]), mid = x.cmp(seg[k], xs[m]);
        if (mid) swap(seg[k], x);
        if (r - l <= 1) return;
        else if (lef != mid) update(x, 2*k+1, l, m);
        else update(x, 2*k+2, m, r); 
    }
    void add_line(T a, T b) {
        Line l(a, b);
        update(l, 0, 0, sz);
    }
    // query : get min_value of f(xs[k])
    T query(int k) {
        const T x = xs[k];
        k += sz - 1;
        T ret = seg[k].f(x);
        while (k) {
            k = (k - 1) / 2; ret = min(ret, seg[k].f(x));
        }
        return ret;
    }
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	long long c; cin >> c;
    vector<long long> h(n+1, 0);
	for (int i = 0; i < n; i++) cin >> h[i+1];
	LiChaoTree<long long> lct(h, 1e18);
	vector<long long> dp(n+1, 0);
	for (int i = n; i > 0; i--) {
		lct.add_line(-2*h[i], dp[i]+h[i]*h[i]+c);
		dp[i-1] = lct.query(i-1) + h[i-1] * h[i-1];
	}
	cout << dp[1] << endl;
	return 0;
}

Measured memory_bytes: 14692
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>

int main(){
  int N; cin >> N;
  cout << 1000*((N+999)/1000) - N << endl;
    

  // cout << fixed << setprecision(10);
  
  return 0;
}


Measured memory_bytes: 3596
#include<iostream>
using namespace std;
int n,q;
string s[1000];
int start[1000],len[1000];
main()
{
	while(cin>>n>>q,n)
	{
		for(int i=0;i<n;i++)
		{
			cin>>s[i]>>len[i]>>start[i];
			start[i]-=len[i]-1;
		}
		for(int i=0;i<q;i++)
		{
			int t;cin>>t;
			bool f=0;
			for(int j=0;j<n;j++)
			{
				if(start[j]<=t&&t<start[j]+len[j])
				{
					cout<<s[j]<<" "<<(t-start[j]+1)<<endl;
					f=1;
					break;
				}
			}
			if(!f)cout<<"Unknown"<<endl;
		}
	}
}



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

int main(){
	string s, t;
  	cin >> s >> t;
  	int n = s.size(), m = t.size();
  	vector<vector<int>> is(26);
  	rep(i, n) is[s[i]-'a'].push_back(i);
   	rep(i, n) is[s[i]-'a'].push_back(i+n);
	
  	ll ans = 0;
  	int p = 0;
  	rep(i, m){
    	int c = t[i]-'a';
      	if(is[c].size() == 0){
        	puts("-1");
          	return 0;
        }
      
      	p = *lower_bound(is[c].begin(), is[c].end(), p)+1;
      	if(p >= n){
        	p -= n;
          	ans += n;
        }
    }
  	ans += p;
  	cout << ans << endl;
}

Measured memory_bytes: 4624
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  int n; cin >> n;
  int d, x; cin >> d >> x;
  int ans = x;
  for (int i = 0; i < n; i++) {
    int a; cin >> a;
    int cur = 1;
    while (cur <= d) {
      ans++;
      cur += a;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
//桁
int kt(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
signed main(){
  int a,b;
  cin>>a>>b;
  vector<string> c(a);
  rep(i,a){
  cin>>c.at(i);
  }
  rep(i,b+2){
  cout<<'#';
    if(i==b+1)
      cout<<endl;
  }
  rep(i,a)
    cout<<'#'<<c.at(i)<<'#'<<endl;
  rep(i,b+2)
    cout<<'#';
}

Measured memory_bytes: 256
#include <iostream>
#define MAX_N 1299709 + 1
using namespace std;

bool t[MAX_N];
int k;

bool isPrime(int x) {
  if(x == 2) return true;
  if(x < 2 || x % 2 == 0) return false;
  int i = 3;
  while(i * i <= x) {
    if(x % i == 0) return false;
    i += 2;
  }
  return true;
}

void table() {
  for(int i = 1; i < MAX_N; ++i) {
    if (isPrime(i)) t[i] = 1;
  }
}

void solve() {
  int p = k, n = k;
  while(t[p] != 1) p--;
  while(t[n] != 1) n++;
  cout << n - p << endl;
}

int main() {
  table();
  while(cin >> k && k) {
    solve();
  }
  return 0;
}



Measured memory_bytes: 4360
#include<bits/stdc++.h>
#define rep(i, x, y) for(register int i = x; i <= y; ++i)
#define repd(i, x, y) for(register int i = x; i >= y; --i)
#define repl(i, x) for(register int i = fi[x]; i; i = l[i].next)
using namespace std;
typedef long long ll;
const int maxn = 200010;
int n;
char s[maxn];
int read(){
	int num = 0, flag = 1; char c = getchar();
	for(; c < '0' || c > '9'; c = getchar())
		if(c == '-') flag = 0;
	for(; c >= '0' && c <= '9'; c = getchar())
		num = (num<<3)+(num<<1)+c-48;
	return flag? num: -num;
}

void init(){
	scanf("%s", s+1);
}

void work(){
	n = strlen(s+1);
	int cnt = 0; ll ans = 0;
	rep(i, 1, n) if(s[i] == 'W') ++cnt, ans += i-cnt;
	printf("%lld\n", ans);
}

int main(){
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	init();
	work();
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

using namespace std;

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

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

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

ll gcd(ll  a,ll b){
    ll r;
    if(a < b){
        ll tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return b;
}
/*
ll Integer_factorization(ll n){
    ll num = 0;
    ll ndash = n;
    if(n == 1) return 1;
    ll a = 2;
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    return num;
}
*/

ll r_fuct[2000];
ll fuct[2000];

//MOD逆元
void conb(ll n,ll k){
    fuct[0] = 1;
    for(int i = 1;i < k+1;i++){
        fuct[i] *= fuct[i-1]%MOD;
        
        ll b = MOD, u = 1, v = 0;
        ll value = fuct[i];
        while (b) {
            ll t = value / b;
            value -= t * b;
            swap(value, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        if (u < 0) u += MOD;
        r_fuct[i] = u;
    }
}

ll factrial(ll n){
    if(n == 0) return 1;
    ll p = factrial(n-1)*n%MOD;
    return p;
}

//MOD逆元
ll farmat(ll n,ll p){    
    if(p == 0) return 1;
    else if(p == 1) return n%MOD;
    ll d = farmat(n,p/2);
    if(p%2 == 0){
        return (d*d)%MOD;
    }else{
        return ((n*d)%MOD*d)%MOD;
    }
}

ll conbination(ll n,ll k){
    ll a = factrial(n);
    ll b = factrial(k);
    ll c = factrial(n-k);
    return (a*farmat(b,MOD-2)%MOD*farmat(c,MOD-2))%MOD;
}

int memo[10000000];

int fib(int i){
    if(i <= 1) return i;
    if(memo[i] != 0) return memo[i];
    return memo[i] = fib(i-1)+fib(i-2);
}

ll dig(ll n){
    ll d = 0;
    while(n != 0){
        n/=10;
        d++;
    }
    return d;
}

void solve() {
  int n;
  cin >> n;
  cout << n/3 << endl;
}




int main() {

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



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

int main()
{
    int n, m;
    int a, b;

    cin >> n >> m;

    int max = m;
    for( int i = 0 ; i < n; i++ )
    {
        cin >> a >> b;
        if( m < 0 )
            max = 0;
        else
        {
            m += a - b;
            if( max < m )
                max = m;
        }
    }

    cout << max << endl;

    return 0;
}


Measured memory_bytes: 3120
n = int(input())
a, b = map(int, input().split())
p_array = [int(x) for x in input().split()]
ans = 0
res = True
while res:
    if len(p_array) < 3:
        break
    for i in sorted(p_array):
        if a >= i:
            p_array.remove(i)
            break
    else:
        res = False

    for j in p_array:
        if a+1 <= j <= b:
            p_array.remove(j)
            break
    else:
        res = False


    for k in p_array:
        if b+1 <= k:
            p_array.remove(k)
            break
    else:
        res = False

    if res:
        ans += 1
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for (;;) {
            int a = sc.nextInt();
            char op = sc.next().charAt(0);
            int b = sc.nextInt();
            if (op == '+') {
                System.out.println(a + b);
            } else if (op == '-') {
                System.out.println(a - b);
            } else if (op == '*') {
                System.out.println(a * b);
            } else if (op == '/') {
                System.out.println(a / b);
            } else if (op == '?') {
                break;
            }
        }
    }
}


Measured memory_bytes: 26304
#include <iostream>
#define N 1001
using namespace std;
void func(int,int,int);
int n,k[N];
string str[N];

int main(){
  cin>>n;
  for(int i=1;i<=n;i++) cin>>k[i]>>str[i];
  cout<<str[1]<<endl;
  func(2,1,1);
  return 0;
}

void func(int d,int q,int p){
  if(d==n+1) return ;
  if(q==k[d]){
    for(int i=0;i<p;i++) cout<<'.';
    cout<<str[d]<<endl;
    func(d+1,d,p+1);
  }
  func(d+1,q,p);
}

Measured memory_bytes: 1408
<?php
//error_reporting(0);
$N = trim(fgets(STDIN));
//list($A,$B,$T) =  explode(" ",trim(fgets(STDIN)));
$A = explode(" ",trim(fgets(STDIN)));
$C = explode(" ",trim(fgets(STDIN)));

$res = 0;
for($i=0;$i<$N;$i++) {
  $res += max($A[$i]-$C[$i],0);
}
printf("%d\n",$res);


Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int INF = 1e9+10;
int main()
{
    int n;
    cin >> n;
    vector<set<int>> s(n);
    for(int i = 1; i < n; i++)
    {
        int a;
        cin >> a;
        a--;
        s[a].insert(i);
    }
    function<int(int)> dfs = [&](int v)
    {
        multiset<int> tmp;
        for(int nx : s[v])
        {
            tmp.insert(dfs(nx));
        }
        int cnt = 1;
        int res = 0;
        for(auto itr = tmp.rbegin(); itr != tmp.rend(); itr++)
        {
            res = max(res, *itr + cnt);
            cnt++;
        }
        return res;
    };
    cout << dfs(0) << endl;
}


Measured memory_bytes: 26564
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, X);
    OUT(lcm(X, 360) / X);
}

Measured memory_bytes: 3588
#include<iostream>
#include<cstdio>
#include<string>
#include<math.h>
#include<vector>
using namespace std;

int main()
{
	int A[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int i,k;
	cin >> k;
	for(i=0;i<32;i++){
		if(k-1==i){
			cout<<A[i]<<endl;
			return 0;
		}
	}
		
	return 0;
}

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

int main(){
    int n,count=0;
    cin>>n;
    string s;
    cin>>s;
    
    for(int i=0;i<=n-3;i++){
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
            count++;
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int a[500005];int ans=0;
int L[500005/2+2],R[500005/2+2];
const int INF=1e9;
void Merge(int a[],int l,int m,int r)
{
    int n1=m-l;
    int n2=r-m;
    for(int i=0;i<n1;i++)L[i]=a[l+i];
    for(int i=0;i<n2;i++)R[i]=a[m+i];
    L[n1]=R[n2]=INF;
    int i=0,j=0;
    for(int k=l;k<r;k++)
    if(L[i]<R[j])
    {
        a[k]=L[i++];
        ans++;
    }
    else
    {
        a[k]=R[j++];
        ans++;
    }
}
void mergeSort(int a[],int l,int r)
{
    if(l+1<r)
    {
        int m=l+r>>1;
        mergeSort(a,l,m);
        mergeSort(a,m,r);
        Merge(a,l,m,r);
    }
}
int main()
{
    int n;
    while(cin>>n)
    {
        for(int i=0;i<n;i++)cin>>a[i];
        mergeSort(a,0,n);
        for(int i=0;i<n;i++)
        {
            if(i)cout<<' ';
            cout<<a[i];
        }
        cout<<endl;
        cout<<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 6900
#include <iostream>
#include <utility>

int main()
{
    while(true){
        int x, y;
        std::cin >> x >> y;
        if(x == 0 && y == 0) break;
        if(x > y) std::swap(x, y);
        std::cout << x << " " << y << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3004
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
#define debug(x) cerr<<#x<<"="<<x<<endl;
#define m(a,b) memset(a,b,sizeof(a))
typedef long long ll;
const int maxn=1e5+100;

int main(){
    int a,b;
    scanf("%d%d",&a,&b);
    if ((a+b)%2==0)
        printf("%d\n",(a+b)/2);
    else
        printf("%d\n",(a+b)/2+1);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    string str;
    cin >> str;
    
    int ans=0;
    int cnt=0;
    bool flag=true;
    for(int i=0; i<str.size(); i++) {
        if(flag) {
            if(str[i]=='A' || str[i]=='C' || str[i]=='G' || str[i]=='T') {
                cnt++;
            } else {
                flag=false;
                if(ans<cnt) {
                    ans = cnt;
                }
            }
        } else {
            if(str[i]=='A' || str[i]=='C' || str[i]=='G' || str[i]=='T') {
                flag=true;
                cnt=1;
            }
        }

        if(str.size()-1==i) {
            if(ans<cnt) {
                ans = cnt;
            }
        }
    }

    cout << ans << endl;


    return 0;
    
}

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

int main(){
  int H , W ;
  cin >> H>>W;
  while (H!=0 && W!=0){
  
    for(int i = 0; i<H; i++){
      for(int j=0; j<W; j++){
        cout << "#";
      }cout<< "\n";
    }cout<< "\n";
    cin >> H>>W;
  }

return 0;
}


Measured memory_bytes: 3068
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
using namespace std;
int main(){
	string s;
    int co = 0, co1 = 1;
    long long ans = 0;
    long long num;
    string sub;
	cin >> s;
    int n = s.size() - 1;
    bool ho[20];
    for (int bit = 0; bit < (1 << n); bit++) {
        for (int i = 0; i < n; i++) {
            if (bit & (1 << i)) {
                ho[i] = 1;
            }
            else {
                ho[i] = 0;
            }
        }
        for (int j = 0; j < n; j++) {
            if (ho[j] == 1) {
                sub = s.substr(co, co1);
                num = stoll(sub.c_str());
                ans += num;
                co = co + co1;
                co1 = 1;
            }
            else {
                co1++; 
            }
        }
        sub = s.substr(co, co1);
        num = stoll(sub.c_str());
        ans += num;
        co = 0;
        co1 = 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <map>

int main(void) {
	int a, b, c;

	std::cin >> a >> b >> c;

	if (a < b) {
		std::swap(a, b);
	}

	if (b < c) {
		std::swap(b, c);
	}

	if (a < b) {
		std::swap(a, b);
	}

	std::cout << a * 10 + b + c << std::endl;

	return 0;
}

Measured memory_bytes: 256
/*
 * atcoder/abc100_2nd/c.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
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 N;
void solve() {
  cin >> N;
  ll a;
  ll total = 0;
  loop(n,0,N) {
    cin >> a;
    while (a > 0 and a%2==0) {
      total++;
      a /= 2;
    }
  }
  cout << total << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


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

int main()
{
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	cout << max(a*b,c*d) << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#pragma endregion

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  ll a, b;
  cin >> a >> b;
  cout << (a * b % 2 == 1 ? "Odd\n" : "Even\n");

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define maxs(x,y) x = max(x, y)
#define mins(x,y) x = min(x, y)
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    string S;
    cin >> S;
    
    int s = 0;
    int N = stoi(S);
    for(int i = 0; i < S.size(); i++) {
        s += S[i] - '0';
    }

    cout << ((N % s == 0) ? "Yes" : "No") << endl;

    //cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# Refer to:
# https://qiita.com/mochizukikotaro/items/c335e6dcc5020ead0b92
class PriorityQueue
  def initialize(array = [])
    @data = []
    array.each{|a| push(a)}
  end

  def push(element)
    @data.push(element)
    bottom_up
  end
  
  # added by univ
  def top
    if size == 0
      return nil
    else
      @data[0]
    end
  end

  def pop
    if size == 0
      return nil
    elsif size == 1
      return @data.pop
    else
      min = @data[0]
      @data[0] = @data.pop
      top_down
      return min
    end
  end
  
  # added by univ
  def sum
    @data.inject(:+)
  end
  
  def size
    @data.size
  end
  
  # added by univ
  def empty?
    @data.size == 0
  end
  
  private

  def swap(i, j)
    @data[i], @data[j] = @data[j], @data[i]
  end

  def parent_idx(target_idx)
    (target_idx - (target_idx.even? ? 2 : 1)) / 2
  end

  def bottom_up
    target_idx = size - 1
    return if target_idx == 0
    parent_idx = parent_idx(target_idx)
    while (@data[parent_idx] > @data[target_idx])
      swap(parent_idx, target_idx)
      target_idx = parent_idx
      break if target_idx == 0
      parent_idx = parent_idx(target_idx)
    end
  end

  def top_down
    target_idx = 0

    # child がある場合
    while (has_child?(target_idx))

      a = left_child_idx(target_idx)
      b = right_child_idx(target_idx)

      if @data[b].nil?
        c = a
      else
        c = @data[a] <= @data[b] ? a : b
      end

      if @data[target_idx] > @data[c]
        swap(target_idx, c)
        target_idx = c
      else
        return
      end
    end
  end

  # @param Integer
  # @return Integer
  def left_child_idx(idx)
    (idx * 2) + 1
  end

  # @param Integer
  # @return Integer
  def right_child_idx(idx)
    (idx * 2) + 2
  end

  # @param Integer
  # @return Boolent
  def has_child?(idx)
    ((idx * 2) + 1) < @data.size
  end
end

mod = 10 ** 9 + 7
def an(n,d=0) Array.new(n,d)end
def an2(n,m,d=0) Array.new(n){an(m,d)}end
def an3(n,m,l,d=0) Array.new(n){an2(m,l,d)}end

n, m = gets.split.map(&:to_i)

t = Array.new(10**5+1){[]}
n.times do |i|
  a, b = gets.split.map(&:to_i)
  t[a].push(b)
end

ans = 0
pq = PriorityQueue.new()
(1..m).each do |d|
  t[d].each{|b| b*=-1; pq.push(b) }
  if pq.size > 0
    b = pq.pop * -1
    ans += b
  end
end

puts ans

Measured memory_bytes: 11448
import java.util.Scanner;
public class Main {
public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        String str[];
        str = new String[3];
        int num[];
        num = new int[3];
        int num_yobi = 0;
        for(int i=0; i<=2; i++)
            {
            str[i] = in.next();
            num[i] = Integer.parseInt(str[i]);
            }
        for(int j=0; j<=1; j++)
            {
            for(int i=0; i<=1-j; i++)
                {if(num[i] > num[i+1])
                    {
                    num_yobi = num[i];
                    num[i] = num[i+1];
                    num[i+1] = num_yobi;
                    }
                }
            }
        System.out.println(num[0]+" "+num[1]+" "+num[2]);
    }
    
}

Measured memory_bytes: 26124