akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void){
    char s[100005];
    int i;
    i = 0;

    scanf("%s", s);

    while (s[i] > 96 && s[i] < 123){
        printf("%c", s[i]);
        i += 2;
    }

    printf("\n");

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a[10000];

int main()
{
	int n; 
	while (cin >> n)
	{
		bool flag = true;
		for (int i = 1; i <= n; i++) {
			cin >> a[i];
			if ((a[i]&1)==0)
				if (a[i] % 3 != 0 and a[i] % 5 != 0)
					flag = false;
		}
		if (flag)
			cout << "APPROVED" << endl;
		else
			cout << "DENIED" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Main {
   public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
  String shop[] ={"A","B","C","D","E"};
 for(;;){  
  int sell[] = new int[5];
  int most=0; int ms=0;
  for(int i=0; i<5; i++){
	  sell[i]+=sc.nextInt();
	  sell[i]+=sc.nextInt();
	if(sell[i]==0)System.exit(0);
	if(most<sell[i]){
   most=sell[i];  ms=i;
		}
  }
  System.out.println(shop[ms]+" "+most);
   }
}
}

Measured memory_bytes: 21108
#include<bits/stdc++.h>
#define ll long long
#define pi acos(-1)
using namespace std;
inline ll rd(){
	ll x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=0;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
	return f?x:-x;
}ll a,b,ans;
int main(){
	a=rd(),b=rd();ll i,j;
	if(a==b){
		puts("1");
		return 0;
	}
	for(i=60;i>=0;i--){
		if((b>>i&1)^(a>>i&1)) break;
		if(a>>i&1) a^=1ll<<i;
	}
	for(j=i-1;j>=0;j--){
		if(b>>j&1){
			ans+=(1ll<<j+1)-1;
			break;
		}
	}ans+=((1ll<<i)-a)<<1;
	if(j!=-1&&a<=(1ll<<j+1)-1)
		ans-=(1ll<<j+1)-a;
		printf("%lld\n",ans+(i!=0)); 
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<string, ll> s_l;
#define YORN(f) puts((f)?"YES":"NO")
ll n;
//ld ;
//string s;

int main() {
    cin >> n;
    priority_queue<ll,std::vector<string>,std::greater<string>> s;
    string s2[n];
    vector<string> smax;
    for(ll i=0;i<n;i++){
        string stemp;
        cin >> stemp;
        s.push(stemp);
    }
    string skeep;
    ll maxi1 = 1;
    ll maxi2 = 1;
    for(ll j=0;j<n;j++){
        if(skeep == s.top()){
            maxi1++;
        }else{
            maxi2 = max(maxi1,maxi2);
            maxi1 = 1;
            skeep = s.top();
        }
        if(j==n-1){
            maxi2 = max(maxi1,maxi2);
        }
        s2[j] = skeep;
        s.pop();
    }
    for(ll ii=0; ii<n-maxi2+1; ii++){
        if(s2[ii] == s2[ii+maxi2-1]){
            cout << s2[ii] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 15856
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
int n;
int main(void){
    cin>>n;
    if(n%2==0)cout<<n/2-1<<endl;
    else cout<<n/2<<endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, M; 
  cin >> A >> B >> M;
  vector<int> as(A), bs(B); 
  for (auto &a : as) cin >> a; for (auto &b : bs) cin >> b;
  int ans = *min_element(begin(as), end(as)) + *min_element(begin(bs), end(bs));
  while (M--) {
    int x, y, c; cin >> x >> y >> c;
    ans = min(ans, as[--x] + bs[--y] - c);
  }
  cout << ans << endl;
}

Measured memory_bytes: 4004
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
const ll MOD = 2019;
#define all(s) (s).begin(), (s).end()

ll binexp(ll x, ll y 
) {
    ll res = 1;
    while (y > 0) {
        if (y & 1)
            res = (res * x) % MOD;
        y >>= 1;
        x = (x * x) % MOD;
    }
    return res;
}

int main(void)
{
  	ios_base::sync_with_stdio(false);
  	cin.tie(nullptr), cout.tie(nullptr);
  	string s;
    cin >> s;
    reverse(all(s));
  	vector<int> arr(s.size()), prefixes(s.size());
  	for (int i = 0; i < s.size(); i++)
      arr[i] = ((int)(s[i] - '0') * binexp(10, i)) % 2019;
    prefixes[0] = arr[0];
    for (int i = 1; i < s.size(); i++)
        prefixes[i] = (prefixes[i - 1] + arr[i]) % MOD;
    map<ll,ll> mp;
    ll ans = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if (prefixes[i] == 0)
            ans++;
        ans += mp[prefixes[i]];
        mp[prefixes[i]]++;
    }
    cout << ans << endl;
	return 0; 
}

Measured memory_bytes: 5144
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,a,b;
	while(true){
	cin>>n;
	if(n==0)
		break;
	b=0;
	for(int i=0;i<n/4;i++){
		cin>>a;
		b+=a;
	}
	cout<<b<<endl;
	}
    return 0;
}

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

using namespace std;

int N, ma, mb;
vector <int> a, b, c;
int dp[50][500][500];

int main(){
        cin>>N>>ma>>mb;
        int aa, bb, cc;
        for(int i=0;i<N;i++){
                cin>>aa>>bb>>cc;
                a.push_back(aa);
                b.push_back(bb);
                c.push_back(cc);
        }
        for(int i=0;i<50;i++){
                for(int j=0;j<500;j++){
                        for(int k=0;k<500;k++){
                                dp[i][j][k]=1e9;
                        }
                }
        }
        dp[0][0][0]=0;
        int res=1e9;
        //rec(0, 0, 0);
        for(int i=0;i<49;i++){
                for(int j=0;j<500;j++){
                        for(int k=0;k<500;k++){
                                if(dp[i][j][k]<1e9){
                                        dp[i+1][j][k]=min(dp[i+1][j][k], dp[i][j][k]);
                                        if(j+a[i]<500&&k+b[i]<500){
                                                dp[i+1][j+a[i]][k+b[i]]=min(dp[i+1][j+a[i]][k+b[i]], dp[i][j][k]+c[i]);
                                        }
                                }
                        }
                }
        }
        for(int aa=ma, bb=mb;aa<500&&bb<500;aa+=ma, bb+=mb){
                res=min(res, dp[N][aa][bb]);
        }
        if(res==1e9)
                res=-1;
        cout<<res<<endl;
        return 0;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int a,b;
	while(cin>>a>>b){
		int sum=a+b;
		int cnt=0;
		while(sum){
			++cnt;
			sum/=10;
		}
		cout<<cnt<<"\n"s;
	}
}


Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;   
#define ll long long
#define pb push_back
#define mk make_pair
#define fir first
#define sec second
#define i1 insert
#define all(v)  v.begin(),v.end()
#define scan(a,n) for(ll i=0;i<n;i++)cin>>a[i]
#define scan1(a,n) for(ll i=0;i<n;i++){  ll z; cin>>z; a.pb(z);}
#define print(a) for(ll i=0;i<a.size();i++){    cout<<a[i]<<" " ;}
#define f(i,k,n) for(ll i=k;i<n;i++)
#define pi 6.28318530717958623200
ll gcd(ll a,ll b)
{
	ll m2=max(a,b);
	ll m1=min(a,b);
	if(m1==0)
	  return m2;
	  else
	   return gcd(m2%m1,m1);
}
ll fac(ll x)
{
	if(x==0||x==1)
	 return 1;
	 else
	   return x*fac(x-1);
}
bool check_prime(ll x)
{
	if(x<=1)
	 return false;
	 if(x<=3)
	  return true;
	if(x%2==0||x%3==0)
	  return false;
	else
	{
		for(int i=5;i*i<=x;i+=6)
		  {
		  	if(x%i==0||x%(i+2)==0)
		  	return false;
		  }
	}
	return true;
}
map<string,int> mp;
set<char> st;
int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int q=1;
   // cin>>q;

    while(q--)
    {
      int n,k;
      cin>>n>>k;
      set<int> s;
      for(int i=0;i<k;i++)
      {
      	int d;
      	cin>>d;
      	for(int i=0;i<d;i++)
      	 {
      	 	int o;
      	 	cin>>o;
      	 	s.insert(o);
		   }
	  }
	  
	  cout<<n-s.size()<<endl;
	}
 	return 0;
} 

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;

int main(){
    ll N, K; cin >> N >> K;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];

    vector<vector<ll>> dp(51, vector<ll>(2,-1));
    dp[0][0] = 0;
    for (int d = 0; d < 50; d++){
        ll mask = 1LL<<(50-d-1);
        int num = 0;
        // Aでd桁目にビットが立っているものの個数を算出
        for(int i = 0; i < N; ++i) if (A[i] & mask) ++num;

        // Xのd桁目を0,1にしたときのコスト
        ll cost0 = mask*num;
        ll cost1 = mask*(N-num);

        // i桁目がK未満の場合
        if (dp[d][1] != -1){
            dp[d+1][1] = max(dp[d+1][1], dp[d][1]+ max(cost0, cost1));
        }

        // i-1桁目がKでi桁目がK未満の場合
        if (dp[d][0] != -1){
            if (K & mask){
                dp[d+1][1] = max(dp[d+1][1], dp[d][0] + cost0);
            }
        }

        // i-1桁目もi桁目もKの場合
        if (dp[d][0] != -1){
            if (K & mask) dp[d+1][0] = max(dp[d+1][0], dp[d][0] + cost1);
            else dp[d+1][0] = max(dp[d+1][0], dp[d][0] + cost0);
        }
    }

    cout << max(dp[50][0], dp[50][1]) << endl;


}

Measured memory_bytes: 4000
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

var sc *bufio.Scanner

const BufferSize = 1024

func nextInt() int {
	if !sc.Scan() {
		panic(nil)
	}
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	if !sc.Scan() {
		panic(nil)
	}
	return sc.Text()
}

type re struct {
	index int
	name  string
	score int
}

type res []re

func (b res) Len() int {
	return len(b)
}

func (b res) Swap(i, j int) {
	b[i], b[j] = b[j], b[i]
}

func (b res) Less(i, j int) bool {
	if b[i].name != b[j].name {
		return b[i].name < b[j].name
	} else {
		return b[i].score > b[j].score
	}
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, 1e+6)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	r := make([]re, n)
	for i := 0; i < n; i++ {
		r[i].index = i + 1
		r[i].name = nextString()
		r[i].score = nextInt()
	}
	sort.Sort(res(r))

	for i := 0; i < n; i++ {
		_, _ = fmt.Fprintf(writer, "%d", r[i].index)
		if i != n-1 {
			_, _ = fmt.Fprint(writer, "\n")
		}
	}
}

func main() {
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 640
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<fstream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

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

    // input
    ll A, B;
    cin >> A >> B;

    if(B<A){
        swap(A, B);
    }

    ll score = B;
    B--;

    score += max(A, B);
    p(score);
    
    return 0;
}

Measured memory_bytes: 384
// D.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <numeric>
#include <deque>


using lolo=long long;
using namespace std;
using vec=vector<lolo>;
using pari=pair<lolo, lolo>;
using vvec=vector<vec>;
using vecb=vector<bool>;
#define FOR(i,n) for (lolo i=0; i<n; ++i)
#define FORIT(it,v) for (auto it=v.begin(); it!=v.end(); ++it)
#define FORANGE(it, v) for (auto it : v)
#define REVCNT(i, const_cnt, v) for (lolo i=v.size()-1, cnt=const_cnt; cnt > 0; --cnt, --i)
//#define REVCNT(i,N,cnt) for(auto i=N-1; cnt-- > 0; --i)
//#define REVCNT(i,N,cnt) for(auto i=N-1, )
using Rpriority_queue=priority_queue<lolo, vector<lolo>, greater<lolo>>;

#define FORN(i,a,b) for (lolo i=a; i<b; ++i)
#define REV(i,a,b) for (lolo i=a; i>b; --i)
#define ALL(x) x.begin(), x.end()
template <class T>
void chmax(T& ans, const T& b)
{
	if (ans < b) {
		ans = b;
	}
}


int main()
{
	lolo N, K;
	cin >> N >> K;
	deque<lolo> V(N);
	FOR(i, N) cin >> V[i];
	lolo ans = 0;

	FOR(left, K + 1) {
		FOR(rigt, K - left + 1) {
			auto cnt_canskip = K - left - rigt;

			Rpriority_queue Q;
			if (left + rigt >= N) {
				FORANGE(v, V)
					Q.push(v);
			}
			else {
				FOR(i, left)
					Q.push(V[i]);

				REVCNT(i,rigt, V)
					Q.push(V[i]);
			}
			
			while (cnt_canskip-- > 0 and (!Q.empty()) and  Q.top() < 0) 
				Q.pop();
			
			lolo sum = 0;
			while (!Q.empty())
			{
				sum += Q.top(); Q.pop();
			}
			
			chmax(ans, sum);
			
		}
	}

			
	cout << ans << endl;
	
}



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

int main(){
    int m,n;
    scanf("%d%d",&m,&n);

    if(m*10000<n){
        printf("-1 -1 -1");
        return 0;
    }
    if(m*1000>n){
        printf("-1 -1 -1");
        return 0;
    }
    if(n%1000!=0){
        printf("-1 -1 -1");
        return 0;
    }
    for(int i=0;i<=m;i++)
     for(int j=0;j<=m;j++)
      for(int k=0;k<=m,i+j+k<=m;k++)
       {
            if(i+j+k==m && i*1000+j*5000+k*10000==n)
            {
                printf("%d %d %d",k,j,i);
                return 0;   
            }
       }
    printf("-1 -1 -1");
    return 0;
}

Measured memory_bytes: 256
import math

N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

def min_seq(N):

    Seq = 0
    keta=1
    for i in range (N):
        num = N * keta
        Seq = Seq + num
        N=N-1
        keta=keta*10
    print(Seq)
    return Seq


def connect_PQ(A):
    A_Seq = []
    for i in range (N):
        A_Seq.append(A[i])
    A_Seq = ''.join(A_Seq)
    #print(A_Seq)
    return A_Seq

def sort_seq(A, N):
    sort_num = 1
    for i in range(N):
        alrady_used_num = 0
        for j in range(i):
            if (A[i] > A[j]):
                alrady_used_num = alrady_used_num + 1
        sort_num = sort_num + (A[i]-1-alrady_used_num)*math.factorial(N-1-i)
    #print(sort_num)
    return sort_num


#Seq = min_seq(N)
#P_Seq = connect_PQ(P)
#Q_Seq = connect_PQ(Q)
P_sort_num = sort_seq(P, N)
Q_sort_num = sort_seq(Q, N)

result = abs(P_sort_num - Q_sort_num)
print(result)

Measured memory_bytes: 3064
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
// clang-format on

const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x = 0) : x(x % mod) {}
  mint& operator+=(const mint a)
  {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
};

mint c[4005][4005];

void init()
{
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i + 1][j] += c[i][j];
      c[i + 1][j + 1] += c[i][j];
    }
  }
}

mint comb(int n, int k) { return c[n][k]; }
mint f2(int n, int k) { return comb(n + k - 1, k - 1); }
mint f(int n, int k)
{
  if (n < k) return 0;
  if (n == 0 && k == 0) return 1;
  if (k < 1) return 0;
  return f2(n - k, k);
}

int main(void)
{
  init();
  int n, k;
  cin >> n >> k;
  ll cnt = 1;
  for (int i = 1; i <= k; i++) {
    mint blue = f(k, i);
    mint red = 0;
    {
      red += f(n - k, i - 1);
      red += f(n - k, i);
      red += f(n - k, i);
      red += f(n - k, i + 1);
    }
    mint ans = blue * red;
    printf("%lld\n", ans.x);
  }
  return 0;
}


Measured memory_bytes: 125944
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using vint = vector<int>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }
void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }

int main() {
    string s; cin >> s;
    int c[26]; fill_n(c, 26, 0);
    rep(i, 4) c[s[i] - 'A']++;
    rep(i, 26) if(c[i] != 2 && c[i] != 0) no();
    yes();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    vector<int> a(3);
    for(int i = 0; i < 3; i++) cin >> a.at(i);
    sort(a.begin(), a.end());
    cout << a.at(0) << " " << a.at(1) << " " << a.at(2) << endl;
}


Measured memory_bytes: 3148
/*input
a
z
*/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <climits>

using namespace std; 

int GCD(int x,int y){return y?GCD(y,x%y):x;}
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define repm(i,a,b) for(int i=(a);i>(b);i--)
#define rept(v) for(auto it=v.begin();it<v.end();it++)
#define all(v) v.begin(),v.end()
const int INF = 1<<30;
typedef long long ll;
typedef pair<int,int> pii;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
	string s, t;
	cin >> s >> t;
	int dp[s.size()+1][t.size()+1];
	memset(dp, -1, sizeof(dp));
	rep(i, s.size()+1) {
		rep(j, t.size()+1) {
			if(!i||!j) dp[i][j]=0;
			if(i&&j&&s[i-1]==t[j-1]) dp[i][j]=1+dp[i-1][j-1];
			if(i) dp[i][j]=max(dp[i][j], dp[i-1][j]);
			if(j) dp[i][j]=max(dp[i][j], dp[i][j-1]);
		}
	}
	int i=s.size(), j=t.size();
	vector<char> lsub;
	while(i&&j) {
		int best = max({dp[i-1][j], dp[i][j-1], dp[i-1][j-1]+(s[i-1]==t[j-1])});
		if(best==dp[i-1][j-1]+(s[i-1]==t[j-1]) && s[i-1]==t[j-1]) {
			lsub.push_back(t[j-1]);
			i--;
			j--;
		}
		else if(best==dp[i-1][j]) i--;
		else j--;
	}
	reverse(all(lsub));
	for(char ch: lsub) cout << ch;
	return 0;
}

Measured memory_bytes: 38784
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    int n,a,b;
    cin >> n;
    if(n==1){
    cout<<"Hello World"<<endl;
    }
    else{
        cin >> a >> b;
        cout << a+b << endl;
    }
    return 0;
}


Measured memory_bytes: 256
//	long long int result = 1;
//	
//	scanf ("%d", &a);
//	long long int angka[a];
//	
//	for (int i= 0 ; i<a ;i++){
//		scanf ("%lld", angka [i]);
//	}
//	
//	for (int i=0; i <a; i++){
//		if (angka[i] == 0){
//			printf ("0");
//			return 0;
//		}
//	}
//	
//		for (int i= 0 ; i<a ;i++){
//			if (angka[i] <= 1e18/result){
//				result = result * angka [i];
//				
//			} else {
//				printf ("-1");
//				return 0;
//			}
//	
//}
//printf ("%lld\n", result);
//return 0;

#include <stdio.h>

int main() {
  int n;
  scanf("%d", &n);
  long long int arr[n], max = 1e18, prod = 1, flag = 0, zero = 0;
  
  for (int i = 0; i < n; i++) {
    scanf("%lld", &arr[i]);
    flag = (arr[i] > max) ? 1 : flag;
    prod *= arr[i];
    (arr[i]) ? max /= arr[i] : zero = 1;
  }

  (zero) ? puts("0") : ((flag) ? puts("-1") : printf("%lld\n", prod));
  return 0;
}


Measured memory_bytes: 2452
#include <iostream>
#include <string>
#include <vector>

using namespace std;

#define int long long

signed main()
{
    string str;

    cin >> str;

    for (int i = 1; i <= 5; ++i)
    {
        string x;
        x = "";
        for (int k = 0; k < i; ++k)
        {
            x += "hi";
        }

        if (str == x)
        {
            std::cout << "Yes" << endl;
            return 0;
        }

        // cout << x << endl;
    }
    cout << "No" << endl;
}


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

using namespace std;

typedef unsigned long long int ullint;

/******************************************************************************
	Main
******************************************************************************/
int main()
{
    ullint n, a, b;
    cin >> n >> a >> b;
    assert(n >= 1 && n <= pow(10, 18));
    assert(a >= 0 && b >= 0 && a + b <= pow(10, 18));
	
    // a+b をひたすら並べる n/(a+b) + r 個並ぶから、n - (int(n/(a+b)) * (a+b) + a) は青い球
    ullint x = floor(double(n) / double(a+b));
    ullint answer = a * x;
    if (a > 0 && x * (a+b) != n) {
        ullint r = n - x * (a+b);
        if (r >= a) {
            answer += a;
        } else {
            answer += r;
        }
    }
	cout << answer << endl;

	return 0;
}


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

using ll = long long;

void check(vector<vector<int>> s) {
    rep(i, s.size()) {
        rep(j, s[i].size()) {
            cout << s[i][j] << " ";
        }
        cout << "\n";
    }
    cout << "\n";
}

int main() {
    int H;
    cin >> H;
    while (H > 0) {
        vector<vector<int>> s(H, vector<int>(6, 0));
        rep(i, H) {
            rep(j, 5) {
                cin >> s[i][j];
            }
        }
        int ans = 0;
        bool f = true;
        while (f) {
            f = false;
            //3つ以上並んだところを消す
            rep(i, H) {
                int l = 0, r = 0;
                rep(j, 5) {
                    if (s[i][j] != 0 && s[i][j] == s[i][j + 1]) {
                        r = j + 1;
                    } else {
                        if (l + 1 < r) {
                            f = true;
                            ans += (r - l + 1) * s[i][l];
                            for (int k = l; k <= r; k++) {
                                s[i][k] = 0;
                            }
                        }
                        l = j + 1;
                        r = j + 1;
                    }
                }
            }
            //check(s);
            //石落下
            bool g = true;
            while (g) {
                g = false;
                rep(j, 5) {
                    for (int i = H - 1; i > 0; i--) {
                        if (s[i][j] == 0) {
                            for (int k = i; k > 0; k--) {
                                s[k][j] = s[k - 1][j];
                                if (s[k][j] > 0) g = true;
                            }
                            s[0][j] = 0;
                        }
                    }
                }
            }
            //check(s);
        }
        cout << ans << "\n";
        cin >> H;
    }
}


Measured memory_bytes: 3176
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <string>
#include <iomanip>
#include <set>
#include <map>
#include <queue>
#include <stack>

using namespace std;

typedef long long li;
typedef unsigned long long uli;
typedef pair<int, int> pii;
typedef long double ld;

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define fr first
#define sc second
#define pb push_back
#define forn(i, n) for(int i = 0; i < int(n); ++i)
#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
#define forb(i, n) for(int i = int(n) - 1; i >= 0; --i)

const int INF = 1e9 + 1000;
const li INF64 = 1e15 + 1000;
const int M = 100 + 10;
const int N = 3 * 1000 + 100;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = 3.14159265359;

li gcd(li a, li b) {
    return a == 0 ? b : gcd(b % a, a);
}

int dp[N][N];

int main() {
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    string s, t;
    cin >> s >> t;

    int n = s.size(), m = t.size();

    fore(i, 1, n + 1) {
        fore(j, 1, m + 1) {
            if (s[i - 1] == t[j - 1]) {
                dp[i][j] = dp[i - 1][j - 1] + 1;
            }
            dp[i][j] = max(dp[i][j], max(dp[i - 1][j], dp[i][j - 1]));
        }
    }

    string sbstr;
    int x = n;
    int y = m;

    while (x > 0 && y > 0) {
        if (s[x - 1] == t[y - 1] && dp[x - 1][y - 1] + 1 == dp[x][y]) {
            sbstr += s[x - 1];
            x -= 1;
            y -= 1;
        }
        else if (dp[x - 1][y] == dp[x][y]) {
            x -= 1;
        }
        else {
            y -= 1;
        }
    }

    reverse(all(sbstr));

    cout << sbstr << '\n';
    
}

Measured memory_bytes: 37120
cat<<EOF>Source.cpp
#include <iostream>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

int max(int a,int b){
	return a>b?a:b;
}
int x[100000],y[100000],x_mod_k[100000],x_div_k[100000];
char s[100000][2];
int n,k;

void add(int*cnt,int x,int t){
	if((x_div_k[x]&1)==0){
		if(t==0){
			cnt[0]++;
			cnt[k-x_mod_k[x]]--;
		}
		else{
			cnt[k-x_mod_k[x]]++;
		}
	}
	else{
		if(t==0){
			cnt[k-x_mod_k[x]]++;
		}
		else{
			cnt[0]++;
			cnt[k-x_mod_k[x]]--;
		}
	}
}
int ans[2000];
int main(){
	scanf("%d%d",&n,&k);
	rep(i,n){
		scanf("%d%d%s",&x[i],&y[i],s[i]);
		x_mod_k[i]=y[i]%k;
		x_div_k[i]=y[i]/k;
	}
	int Max=0;
	#pragma omp parallel for num_threads(4)
	rep(i,k){
		int cnt[max(n,k)];
		rep(j,max(n,k))cnt[j]=0;
		rep(j,n){
			if(s[j][0]=='B'){
				if(((x[j]+i)/k)%2==0){
					add(cnt,j,0);
				}
				else{
					add(cnt,j,1);
				}
			}
			else{
				if(((x[j]+i)/k)%2==0){
					add(cnt,j,1);
				}
				else{
					add(cnt,j,0);
				}
			}
		}
		rep(j,k){
			if(j)cnt[j]+=cnt[j-1];
			ans[i]=max(ans[i],max(cnt[j],n-cnt[j]));
		}
	}
	rep(i,k)Max=max(Max,ans[i]);
	cout<<Max<<endl;
}
EOF
g++ -O3 Source.cpp -o Source -fopenmp -std=c++11
./Source

Measured memory_bytes: 32148
#include <bits/stdc++.h>
using namespace std;
const string S="RRRRRR";
int main()
{
	string s;
	cin>>s;
	int maxlen=0;
	for(int i=0;i<s.size();i++)
	{
		for(int len=0;i+len<=s.size();len++)
		{
			string sub=s.substr(i,len);
			if(sub==S.substr(0,len)&&len>maxlen)
			{
				maxlen=len;
			}
		}
	}
	cout<<maxlen; 
	return 0;
}

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

#define LL long long

#define FOR(INDEX, START, END) for (LL INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (LL INDEX = 0; INDEX < (COUNT); ++INDEX)

int main()
{
	LL N;
	cin >> N;

	set<string> S;
	REP(i, N) {
		string s;
		cin >> s;

		S.insert(s);
	}

	cout << S.size() << endl;

	return 0;
}


Measured memory_bytes: 19188
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	ll n, l;
	vector<ll> v;
	ll sum = 0;
	vector<ll> ans;

	cin >> n >> l;

	REP(i, n) {
		ll a;
		cin >> a;
		v.push_back(a);
		sum += a;
	}

	ll mid;
	bool flag = false;

	REP(i, n - 1) {
		if (v[i] + v[i + 1] >= l) {
			mid = i + 1;
			flag = true;
			break;
		}
	}

	if (flag) {
		cout << "Possible" << endl;

		FOR(i, 1, mid) {
			cout << i << endl;
		}

		RFOR(i, mid + 1, n) {
			cout << i << endl;
		}

		cout << mid << endl;
	}
	else {
		cout << "Impossible" << endl;
	}
}

Measured memory_bytes: 1780
using System;

public class hello
{
    public static void Main()
    {
        string w;
        for (; (w = Console.ReadLine()) != null;)
        {
            string[] line = w.Trim().Split(' ');
            var a = int.Parse(line[0]);
            var b = int.Parse(line[1]);
            var c = int.Parse(line[2]);
            var d = int.Parse(line[3]);
            var e = int.Parse(line[4]);
            var f = int.Parse(line[5]);
            var x0 = (double)(c * e - b * f) / (a * e - b * d);
            var x1 = Math.Round(x0, 3, MidpointRounding.AwayFromZero);
            var y0 = (double)(a * f - c * d) / (a * e - b * d);
            var y1 = Math.Round(y0, 3, MidpointRounding.AwayFromZero);
            Console.WriteLine("{0:0.000} {1:0.000}", x1, y1);
        }
    }
}



Measured memory_bytes: 13968
S = [int(i) for i in input().split("/")]
answer = ""
if(S[0] < 2019):
    answer = "Heisei"
elif(S[0] > 2019):
    answer = "TBD"
else:
    if(S[1] <= 4):
        answer = "Heisei"
    else:
        answer = "TBD"
print(answer)

Measured memory_bytes: 3060
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long int;
 
#define REP(i,n) for(ll i=0;i<(ll)(n);i++) //REP(i, 5) cout<<i;
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define MOD 1000000007 //10^9+7
//#define MOD 1
 
ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
const int MAX = 2000;

long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


void sosuu(ll n, vector<ll> &v){

  vector<ll> num(n, 0);

  FOR(i, 1, sqrt(n)){
    if(num[i]==0){
      FOR(j, 0, n/i){
        num[i+(j*i)] = 1;
      }
    }
  }
  REP(i, n){
    if(num[i]==0) v.push_back(i+1);
  }
}

ll GetDigit(ll num){
    ll digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}


int main(void){

  ll n;
  cin>>n;

  queue<pair<char, string>> q;
  q.push(make_pair('a', "a"));
  
  while(q.size()!=0){
    pair<char, string> now = q.front();
    q.pop();

   if((now.second).size()==n){
     cout<<now.second<<endl;
   }else{
     char max = 'a';
     REP(i, (now.second).size()){
       //cout<<max<<" ";
       if(now.second[i]>max) max = now.second[i];
     }
    for(char X='a';X<=max+1;X++){
      q.push(make_pair(X, now.second+X));
    }
   }
  }

  return 0;
  
}

Measured memory_bytes: 10624
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
typedef long long ll;

int main()
{
	int r, g, b;
	cin >> r >> g >> b;
	if ((g * 10 + b) % 4 == 0) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}


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

#define inf (pow(10,9))
typedef pair<int,int> pii ;

int V = 0 ;
int E = 0 ;
vector<pii> graph[20] ; // from,{to,cost}
int dp[ 1 << 15 ][15] = {0} ;

int DP(int bit ,int v )
{
    if(dp[bit][v] != inf)return dp[bit][v];

    if ( bit == (1 << V) - 1 && v == 0 )return  dp[bit][v] = 0 ;
    if ( bit == (1 << V))return dp[bit][v] = inf;

    int res = inf - 1;
    for( int i = 0; i < graph[v].size(); i++)
    {
        pii cmp = graph[v][i] ;
        if ( !( (bit >> cmp.first) & 1 ) )
        {
            res = min( res, DP( bit | ( 1 << cmp.first ), cmp.first ) + cmp.second ) ;
        }
    }

    return dp[bit][v] = res ;
}

int solve()
{
    for ( int i = 0 ; i < (1 << V) ; i++ )
    {
        for ( int j = 0 ; j < V ; j++ )
        {
            dp[i][j] = inf ;
        }
    }
    return DP( 0, 0 ) ;
}

int main()
{
    cin >> V >> E ;
    for ( int i = 0 ; i < E ; i++ )
    {
        int s ,t ,d ;
        cin >> s >> t >> d ;
        graph[s].push_back(pii(t,d));
    }
    if(solve() < (inf-1))printf("%d\n", solve()) ;
    else puts("-1");
    return 0 ;
}

Measured memory_bytes: 5008
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <sstream>

#define DEBUG 0
#define fi first
#define se second
#define pb push_back
#define fore(i, a, b) for (int i = (a), _b = (b); i < (_b); ++i)
#define fort(i, a, b) for (int i = (a), _b = (b); i <= (_b); ++i)
#define ford(i, a, b) for (int i = (a), _b = (b); i >= (_b); --i)

using namespace std;

typedef long long LL;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

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

int main() {
    if (DEBUG) {
        freopen("CP.inp", "r", stdin);
        //freopen("CP.out", "w", stdout);
    }
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
  	vi a(n); for (int &x : a) cin >> x;
  	vi b(a.begin(), a.end());
  	sort(b.begin(), b.end());
  	int cnt = 0;
  	fore(i, 0, n) cnt += (a[i] != b[i]);
  	if (cnt == 2 || cnt == 0) cout << "YES\n";
  	else cout << "NO\n";
    return 0;
}


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

int main () {
  int N, K;
  cin >> N >> K;
  vector<int> d(K);
  vector<vector<int>> A(K);

  for (int i=0; i<K; i++) {
    cin >> d.at(i);
    for (int j=0; j<d.at(i); j++) {
      int x;
      cin >> x;
      A.at(i).push_back(x);
    }
  }

  // for (int i=0; i<K; i++) {
  //   for (int j=0; j<d.at(i); j++) {
  //     cout << A.at(i).at(j);
  //   }
  //   cout << endl;
  // }

  vector<int> members(N, 0);
  int count = 0;
  for (int i=0; i<K; i++) {
    for (int j=0; j<d.at(i); j++) {
      members.at(A.at(i).at(j)-1) = 1;
    }
  }

  for (int i=0; i<members.size(); i++) {
    if (members.at(i) == 0) count++;
  }
  
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3684
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int e[12],i,f=1;
  for(i=0;i<12;i++)
    cin>>e[i];
  sort(e,e+12);
  for(i=0;i<12;i+=4)
    if(!(e[i]==e[i+1]&&e[i+1]==e[i+2]&&e[i+2]==e[i+3]))
      f=0;
  if(f)
    cout<<"yes\n";
  else
    cout<<"no\n";
}



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

using namespace std;

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  bool isEven = false;
  if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0){
    isEven = true;
  }

  if(isEven){
    cout << 0 << endl;
  }else{
    long long num[3];
    num[0] = a;
    num[1] = b;
    num[2] = c;
    sort(num,num+3);
    cout << num[0]*num[1] << endl;
  }
  return 0;
}

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

typedef long long ll;
#define endl "\n"

int h,w,k;

void solve(){
	cin>>h>>w>>k;
	vector<bitset<6>> grid(h);
	for (int i=0; i<h; ++i){
		for (int j=0; j<w; ++j){
			char c; cin>>c;
			grid[i][j]=(c=='#');
		}
	}
	int ans=0;
	for (int x=0; x<(1<<h); ++x){
		vector<bitset<6>> ngrid=grid;
		for (int i=0; i<h; ++i){
			if (x & (1<<i)){
				for (int tmp = 0; tmp<w; ++tmp)
					ngrid[i][tmp]=0;
			}	
		}
		for (int y=0; y<(1<<w); ++y){
			vector<bitset<6>> ngrid2=ngrid;
			for (int i=0; i<w; ++i){
				if (y & (1<<i)){
					for (int tmp=0; tmp<h; ++tmp)
						ngrid2[tmp][i]=0;
				}
			}
			int cnt=0;
			for (int i=0; i<h; ++i)
				cnt+=ngrid2[i].count();
			if (cnt==k)
				ans++;
		}
		
	}
	cout<<ans;
}

int main(){
	// INT VS LL
    // freopen("input.txt", "r", stdin);
    //	INT VS LL
    ios::sync_with_stdio(0);
    cin.tie(0);

    solve();
    return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
int a,aa[1000],b=0;
signed main()
{
	cin>>a>>b;
	if(b%a==0){
		cout<<a+b;
	}else{
		cout<<b-a;
	}
}

Measured memory_bytes: 256
// AOJ 2731 Shifting a Matrix
// 2018.2.11 bal4u

#include <stdio.h>
#include <ctype.h>
#include <string.h>

#define SIZE 700

int N, N2;
short ans[10001], t0[10001], tmp[10001];
short mat[SIZE+1][10001];
char used[SIZE+1]; int top;
char s[1002], *p;

char *seq(short *res, char *s);

// malloc
int new() { int i, k;
	used[k=i=top] = 1;
	while (++i < SIZE) if (!used[i]) { top = i; break; }
	return k;
}

// free
void dis(int k) { used[k] = 0; if (k < top) top = k; }

char *in(int *res, char *p) { int n = 0;
	while (isdigit(*p)) n = (n<<3)+(n<<1) + (*p++ & 0xf); *res = n; return p;
}

void calc(short *a, short *b)
{
	int i;
	for (i = 0; i < N2; i++) tmp[i] = a[b[i]];
	memcpy(a, tmp, sizeof(tmp));
}

char *ope(short *a, char *s)
{
	int k, r, c;
	char x;

	x = *s++;
	s = in(&k, s), k--;

	memcpy(a, t0, sizeof(t0));
	if      (x == 'L') { for (c = 0; c < N; c++) a[k*N+c] = k*N+c+1; a[k*N+N-1] = k*N; }
	else if (x == 'R') { for (c = 0; c < N; c++) a[k*N+c] = k*N+c-1; a[k*N] = k*N+N-1; }
	else if (x == 'U') { for (r = 0; r < N; r++) a[r*N+k] = (r+1)*N+k; a[(N-1)*N+k] = k; }
	else               { for (r = 0; r < N; r++) a[r*N+k] = (r-1)*N+k; a[k] = (N-1)*N+k; }
	return s;
}

char *rep(short *a, char *s)
{
	int n, _b;
	short *b;

	b = mat[_b=new()];
	s = seq(b, s)+1;
	s = in(&n, s);
	memcpy(a, t0, sizeof(t0));

	while (n) {
		if (n & 1) calc(a, b);
		calc(b, b);
		n >>= 1;
	}
	dis(_b);
	return s;
}

char *seq(short *res, char *s)
{
	int _t;
	short *t;

	memcpy(res, t0, sizeof(t0));
	t = mat[_t=new()];
	memcpy(t, t0, sizeof(t0));
	while (*s == '(' || isalpha(*s)) {
		if (*s == '(') s = rep(t, s + 1);
		else           s = ope(t, s);
		calc(res, t);
	}
	dis(_t);
	return s;
}

int main()
{
	int L, i, r, c, _r;
	
	fgets(p=s, 16, stdin), p = in(&N, p), in(&L, p+1), N2 = N*N;
	fgets(s, 1002, stdin);
	for (i = 0; i < N2; i++) t0[i] = i;

	seq(ans, s);
	for (_r = 0, r = 0; r < N; r++, _r += N) {
		printf("%d", 1+ans[_r]);
		for (c = 1; c < N; c++)	printf(" %d", 1+ans[_r+c]);
		putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 15012
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9+1
typedef pair<int,int> mypair;
int main(){
	int v,e,r;
	cin>>v>>e>>r;
	vector<vector<mypair> > g(v);
	int s,t,d;
	for(int i=0;i<e;i++){
	cin>>s>>t>>d;
	g[s].push_back(mypair(t,d));
	}
	priority_queue<mypair,vector<mypair>,greater<mypair> > q;
	vector<int> ans(v,inf);
	q.push(mypair(0,r));
	while(!q.empty()){
	mypair now = q.top();
	q.pop();
	if(now.first > ans[now.second]) continue;
	else{
		ans[now.second] =now.first;
		for(int i=0;i<g[now.second].size();i++){
		q.push(mypair(now.first+g[now.second][i].second,g[now.second][i].first));
		}
	}
	}

	for(int i=0;i<v;i++)if(ans[i]==inf)cout<<"INF"<<endl;else cout<<ans[i]<<endl;


	return 0;
}




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

typedef long long ll;
typedef pair<int,int> ii;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int r,g,b; cin>>r>>g>>b;
	cout << ((100*r+10*g+b)%4==0 ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
#define MAX_N 100002
 
typedef struct { char *p; int tm; } Q;
Q que[(MAX_N<<1)+2]; int top, end;
char name[MAX_N][20];
 
char buf[20], *p;
int in()
{
    int n = 0;
    while (*p >= '0') n = 10*n + (*p++ & 0xf);
    p++;
    return n;
}
 
int main()
{
    int  n, q, tm, i;
    Q  t;
 
    fgets(p=buf, 20, stdin);
    n = in(), q = in();
    for (i = 0; i < n; i++) {
        fgets(p=name[i], 20, stdin);
        while (*p > ' ') p++; *p++ = 0;
        que[i].p = name[i], que[i].tm = in();
    }
 
    tm = 0, top = 0, end = n;
    while (top != end) {
        t = que[top]; if (++top == MAX_N) top = 0;
        if (t.tm <= q) {
            printf("%s %d\n", t.p, tm+t.tm);
            tm += t.tm;
        } else {
            t.tm -= q;
            que[end] = t; if (++end == MAX_N) end = 0;
            tm += q;
        }
    }
    return 0;
}


Measured memory_bytes: 4200
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int redNum = Integer.parseInt(sc.next());
        List<String> nameList = new ArrayList();
        List<String> redList = new ArrayList();
        for(int x = 1; x<= redNum; x++) {
            String name = sc.next();
            nameList.add(name);
            redList.add(name);
        }
        
        int blueNum = Integer.parseInt(sc.next());
        List<String> blueList = new ArrayList();
        for(int x = 1; x<= blueNum; x++) {
            String name = sc.next();
            nameList.add(name);
            blueList.add(name);
        }
        
        int x=1;
        
        int res = 0;
        loop:for(String name :nameList) {
            for(int y=1; y<x; y++) {
                if (nameList.get(y-1).equals(name)) {
                    x++;
                    continue loop;
                }
            }
            int money = 0;
            for(String blueName : blueList) {
                    if(blueName.equals(name)) {
                     money--;   
                }
            }
            for(String redName : redList) {
                if(redName.equals(name)) {
                    money++;   
                }
            }
            res = res >= money?res:money;
        }
        
        System.out.println(res);
    }
}


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

int main() {
  int a,b;
  char c;
  cin >> a >> c >> b;
  
  if(c == '+'){
    a += b;
  }
  else if(c == '-'){
    a -= b;
  }
  
  cout << a << endl;
}

Measured memory_bytes: 256
import math

Q = int(input())

AB = []
for _ in range(Q) :
    a, b = map(int, input().split())
    if a > b :
        a, b = b, a
    AB.append((a, b))

for a, b in AB :
    if a == b :
        print(2 * a - 2)
        continue

    C = int(math.sqrt(a * b))
    if C * C == a * b :
        C -= 1

    if C * (C + 1) >= a * b :
        print(2 * C - 2)
    else :
        print(2 * C - 1)


Measured memory_bytes: 3060
#include "bits/stdc++.h"

using namespace std;

#define int long long int
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define se second
#define fi first

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

const int inf = 1e18;
const int mod = 1e9+7;

inline int add(int x, int y) { x += y; if (x >= mod) x -= mod; return x;}
inline int sub(int x, int y) { x -= y; if (x < 0) x += mod; return x;}
inline int mul(int x, int y) { return ((x % mod) * (y % mod)) % mod;}
inline int power(int a, int b) {
    int x = 1;
    while (b) {
        if (b & 1) x = mul(x, a);
        a = mul(a, a);
        b >>= 1;
    }
    return x;
}
inline int inv(int a) { return power(a, mod - 2);}

int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    int n; cin >> n;
    int ans=0,x;
    for(int i=0;i<n;i++) {
        cin >> x;
        ans = __gcd(ans,x);
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

int cntw[2020][4040], cntb[2020][4040];
int dp[2020][2020];
char c[4040];
int a[4040];

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

	int N;
	cin >> N;
	map<pair<char,int>, int>mp;
	for (int i = 0; i < 2 * N; i++) {
		cin >> c[i] >> a[i];
		mp[{c[i],a[i]}] = i;
	}

	for (int x = 2 * N - 2; x >= 0; x--) {
		if (c[x + 1] == 'W') {
			for (int i = 1; i <= N; i++) {
				if (i < a[x + 1])cntw[i][x] = cntw[i][x+1];
				else cntw[i][x] = cntw[i][x+1] + 1;
				cntb[i][x] = cntb[i][x+1];
			}
		}
		else {
			for (int i = 1; i <= N; i++) {
				if (i < a[x + 1])cntb[i][x] = cntb[i][x + 1];
				else cntb[i][x] = cntb[i][x + 1] + 1;
				cntw[i][x] = cntw[i][x + 1];
			}
		}
	}


	
	for (int w = 0; w <= N;w++){
		for (int b = 0; b <= N;b++){
			if (w == 0 && b == 0)continue;
			int idxw = mp[{'W',w}];
			int idxb = mp[{'B',b}];
			int c1 = 100000000;
			int c2 = 100000000;
			if (w > 0)c1 = dp[w - 1][b] + cntw[w - 1][idxw] + cntb[b][idxw];
			if (b > 0)c2 = dp[w][b - 1] + cntb[b - 1][idxb] + cntw[w][idxb];
			dp[w][b] = min(c1, c2);
		}
	}
	puts(dp[N][N]);
	
	return 0;
}



Measured memory_bytes: 80000
h, w = map(int, input().split())
m=[]
for _ in range(h):
  temp = input()
  if temp.count("#") == 0:
    continue
  m.append(temp)

ku=[]
for i in range(w):
  for j in m:
    if j[i] == "#":
      break
  else:
    ku.append(i)

k = list(set([i for i in range(w)]) - set(ku))
for i in m:
  temp=""
  for j in k:
    temp += i[j]
  print(temp)

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

using namespace std;

#define LOG(...) fprintf(stderr,__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main() {
    int n, m;
    while (cin >> n >> m, n|m) {
        vi h(n+1);
        vi w(m+1);
        h[0] = 0;
        w[0] = 0;
        REP(i, n) cin >> h[i+1];
        REP(i, m) cin >> w[i+1];

        map<int, int> square;

        int y = 0;
        for (int dy : h) {
            y += dy;
            int x = 0;
            for (int dx : w) {
                x += dx;
                square[x-y]++;
            }
        }

        int cnt = 0;
        for (map<int, int>::iterator it = square.begin(); it != square.end(); it++) {
            int n = it->second;
            if (n > 1) {
                cnt += 1.0/2 * n * (n-1);
            }
        }

        cout << cnt << endl;
    }
}

Measured memory_bytes: 28008