akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;


int main() {
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < s.size(); i++) {
        if (s == t) {
            cout << "Yes" << endl;
            return 0;
        }
        char c = s.at(0);
        s.erase(s.begin());
        s.push_back(c);
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n];
        int[] q = new int[n];
        for(int i = 0; i < n; i++){
            q[ sc.nextInt() - 1 ] = i;
        }
        int ans = n - 1;
        int tmp = 1;
        for(int i = 1; i < n; i++){
            if(q[i-1] < q[i]){
                tmp++;
            }else{
                tmp = 1;
            }
            ans = Math.min(ans, n - tmp);
        }
        System.out.println(ans);
    }
}

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

int main() {
  string N;
  cin >> N;
  string N2 = N;
  if (N.size() >= 2) {
    N2[0]--;
    for (int i = 1; i < N2.size(); i++) N2[i] = '9';
  }
  int ans1 = 0, ans2 = 0;
  for (int i = 0; i < N.size(); i++) ans1 += N[i] - '0', ans2 += N2[i] - '0';
  cout << max(ans1, ans2) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
#define Fast ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define deb(x) cout<<#x<<" "<<x<<endl;
#define all(v) v.begin(),v.end()
#define endl '\n'
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void judge() {
#ifndef ONLINE_JUDGE
	FILE_READ_IN
	FILE_READ_OUT
#endif
}

int main() {
	Fast;
	int t = 1;
	judge();
	// cin >> t;
	while (t--) {
		int n, d;
		cin >> n >> d;
		int ret = 0;
		for (int i = 0; i < n; i++) {
			double x, y;
			cin >> x >> y;
			double ans = x * x + y * y;
			ans = sqrt(ans);
			if (ans <= d)ret++;
		}
		cout << ret << endl;
	}
}

Measured memory_bytes: 3860
#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    int cnt = a;
    int ans = 1;
    while(cnt < b)
    {
        cnt = cnt + a - 1;
        ans++;
    }
    if(b == 1)cout << 0;
    else cout << ans;
    return 0;
}


Measured memory_bytes: 764
/***
 *      __  __            _    _       _
 *     |  \/  |          | |  | |     | |
 *     | \  / |_ __      | |  | |_ __ | | ___ __   _____      ___ __
 *     | |\/| | '__|     | |  | | '_ \| |/ / '_ \ / _ \ \ /\ / / '_ \
 *     | |  | | |     _  | |__| | | | |   <| | | | (_) \ V  V /| | | |
 *     |_|  |_|_|    (_)  \____/|_| |_|_|\_\_| |_|\___/ \_/\_/ |_| |_|
 *
 *
***/
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
/*---------------for_stuff-------------------*/
#define f(i,a,b) for (int i=a;i<=b;i++)
#define f_(i,a,b) for (int i=a;i>=b;i--)
/*---------------pair_stuff------------------*/
#define MP make_pair
#define ii pair<int,int>
#define Iii pair<int,ii>
#define ill pair<int,ll>
#define lli pair<ll,int>
#define iiI pair<ii,int>
#define llll pair<ll,ll>
#define fi first
#define se second
/*--------------vector_stuff-----------------*/
#define pb push_back
#define ppb pop_back
/*--------------const_stuff-----------------*/
const ll mod=1000000007;
/*--------------map_stuff--------------------*/
// why do you think I should write something in this part? :v

string s;
int main() {
//	freopen("","r",stdin);
//	freopen("","w",stdout);
	cin>>s;
	for (int i=1;i<s.size();i++) {
		if (s[i]==s[i-1]) {
			printf("%d %d", i, i+1);
			return 0;
		}
	}
	for (char c='a';c<='z';c++) {
		int pos=-1;
		for (int i=0;i<s.size();i++) {
			if (s[i]==c) {
				if (pos==-1) pos=i;
				else {
					if (i-pos==2) {
						printf("%d %d", pos+1, i+1);
						return 0;
					}
					pos=i;
				}
			}
		}
	}
	printf("-1 -1");
	return 0;
}

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

int main() {

  int a,b,c,d;
  
  cin >> a;
  
  b = (a%100)%10;
  c = (a - b)%100/10;
  d = (a - b - 10*c)/100;
  
  cout << b+c+d << endl;
  
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int numN = scan.nextInt();
		int numK = scan.nextInt();

		int count = numK;

		for (int i = 1; i < numN; i++) {
			count *= numK - 1;
		}

		System.out.println(count);
	}
}


Measured memory_bytes: 23508
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	vector<int>v[m];
	for(int i=0;i<m;i++)
	{
		int k;
		cin>>k;
		for(int j=0;j<k;j++)
		{
			int f;cin>>f;
			v[i].push_back(f);
		}
	}
	int p[m];
	for(int i=0;i<m;i++)
	{
		cin>>p[i];
	}
	queue<string> q; 
  
    q.push("1"); 
    
    int f=pow(2,n)-1;
    int count =0;
   
    while (f--) 
    { 
    int flag=0;
    	vector<int>arr(n,0);
        string s1 = q.front(); 
        q.pop(); 
        //cout<<s1;
        int sn=s1.length();
        //cout<<" "<<sn<<endl;
        for(int i=0;i<sn;i++)
        {
        	arr[n-sn+i]=s1[i]-'0';
        	//cout<<m-sn+i<<" "<<s1[i]<<endl;
		}
		//cout<<m<<endl;
		//for(int i=0;i<m;i++)
		//cout<<arr[i];
		//cout<<endl;
        for(int i=0;i<m;i++)
        {
        	int c=0;
		for(int j=0;j<v[i].size();j++)
  		{
  			if(arr[v[i][j]-1]==1)
			  c++;	
		  }
		  //cout<<c<<endl;
		  if(c%2!=p[i])
		  flag=1;
		  //cout<<count<<endl;
		}
		if(flag==0)
		count++;
        string s2 = s1;
    
        q.push(s1.append("0"));
        
        q.push(s2.append("1")); 
    } 
    	vector<int>arr(n,0);
    	int fla=0;
    	for(int i=0;i<m;i++)
        {
        
		  if(p[i]!=0)
		  fla=1;
		  //cout<<count<<endl;
		}
		if(fla==0)
		count++;
cout<<count;
}

Measured memory_bytes: 384
#include<stdio.h>
#define MAX 2000000

int H,A[MAX+1];

void swap(int *a,int *b){
  int c;

  c=*a;
  *a=*b;
  *b=c;

}

void maxHeapify(int i){
  int r,l,large;
  
  r=2*i+1;
  l=2*i;

  if(l<=H && A[l]>A[i]) large=l;
  else large=i;
  if(r<=H && A[r]>A[large]) large=r;

  if(large!=i){
    swap(&A[i],&A[large]);
    maxHeapify(large);
  }
}

int main(){
  int i;

  scanf("%d",&H);

  for(i=1;i<=H;i++) scanf("%d",&A[i]);
  
  for(i=H/2;i>=1;i--) maxHeapify(i);

  for(i=1;i<=H;i++) printf(" %d",A[i]);

  printf("\n");

  return 0;

}

Measured memory_bytes: 2552
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			String[] blue = new String[n];
			for (int i = 0; i < n; i++) {
				blue[i] = in.nextString();
			}
			int k = in.nextInt();
			String[] red = new String[k];
			for (int i = 0; i < k; i++) {
				red[i] = in.nextString();
			}

			Map<String, Integer> mapB = ArrayUtils.getCountMap(blue);
			Map<String, Integer> mapA = ArrayUtils.getCountMap(red);

			int ans = 0;
			for (Map.Entry<String, Integer> entry : mapB.entrySet()) {
				int b = entry.getValue();
				int r = 0;
				if (mapA.get(entry.getKey()) != null) {
					r = mapA.get(entry.getKey());
				}
				ans = Math.max(ans, b-r);
			}
			out.println(ans);
		}
	}

	static class ArrayUtils {
		public static Map<String, Integer> getCountMap(String[] array) {
			Map<String, Integer> map = new TreeMap<>();
			for (String x : array)
				map.merge(x, 1, Integer::sum);
			return map;
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

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

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

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

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


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

using namespace std;

using uint = unsigned int;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_p(x) cerr<<#x": "<<(x).first<<' '<<(x).second<<endl
#define dbg_v(x, n) {cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<(x)[_]<<' ';cerr<<endl;}
#define all(v) v.begin(), v.end()
#define fi first
#define se second
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
 
template<typename T1, typename T2>
ostream& operator <<(ostream &out, const pair<T1, T2> &item) {
	out << '(' << item.first << ", " << item.second << ')';
	return out;
}
 
template <typename T>
ostream& operator <<(ostream &out, const vector<T>& v) {
	for(const auto &item : v) out << item << ' ';
	return out;
}

string s;

int main()
{
	ios_base::sync_with_stdio(false);
	cin>>s;
	for (auto i : s)
		cout<<'x';
	cout<<'\n';
	return 0;
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<double>;
using vvi = vector<vector<int>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

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

	cout << max(min(b, d) - max(a, c), 0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)1e5 + 7;
const int infint = (int)1e9;
const ll inf = (ll)1e18;
unordered_map<ll, char> M;
ll lcm(ll a, ll b)
{
	return a * b / __gcd(a, b);
}
ll n, m;
string s, t;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n >> m >> s >> t;
	ll c = lcm(n, m);
	for (int i = 0; i < n; i++)
		M[i * c / n] = s[i];
	for (int i = 0; i < m; i++)
		if(M.count(i * c / m) && M[i * c / m] != t[i])
			return cout << -1, 0;
	cout << c;
}

Measured memory_bytes: 4260
//
//  anti-division.cpp
//  my_programs
//
//  Created by Jiatuo Zou on 9/15/20.
//  Copyright © 2020 Jiatuo Zou. All rights reserved.
//

#include <iostream>

int main()
{
    using namespace std;
    
    long long a, b, lcm, c, d;
    cin >> a >> b >> c >> d;
    long long x = c, y = d;
    while(x != 0 && y != 0){
        x > y ? x %= y : y %= x;
        if(x == 0){
            lcm = c * d / y;
        } else if(y == 0){
            lcm = c * d / x;
        }
    }
    cout << b - a + 1 - b / c - b / d + b / lcm + (a - 1) / c + (a - 1) / d - (a - 1) / lcm << endl;
    return 0;
}


Measured memory_bytes: 3544
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n;
    cin>>n;
    int a[3];
    rep(i,3)cin>>a[i];
    vector<ll> l(12,inf);
    rep(i,n)cin>>l[i];
    n=12;
    int all=1<<(2*n);
    ll ans=inf;
    rep(i,all){
        vector<int> sum(3);
        ll ret=-30;
        rep(j,n){
            int u = (i>>(2*j))&3;
            if(u!=3){
                sum[u]+=l[j];
                ret+=10;
            }
        }
        rep(j,3){
            ret+=abs(a[j]-sum[j]);
            if(!sum[j])ret+=1e7;
        }
        ans=min(ans,ret);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

template<class Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight; //親との差分
 
    UnionFind(int n = 1, Abel SUM_UNITY = 0){
        init(n, SUM_UNITY);
    }
 
    void init(int n = 1, Abel SUM_UNITY = 0){
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for(int i=0; i<n; i++) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }
 
    int root(int x){
        if(par[x] == x){
            return x;
        }
        else{
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }
 
    Abel weight(int x){
        root(x);
        return diff_weight[x];
    }
 
    bool issame(int x, int y){
        return root(x) == root(y);
    }
 
    // weight[y] - weight[x] = w になるようにマージする（x yがそれぞれの木でrootになってるわけではないことに注意）
    bool merge(int x, int y, Abel w){
        // xとyそれぞれについて、rootとの重み差分を補正
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if(x == y) return false;
        if(rank[x] < rank[y]) swap(x, y), w = -w;
        if(rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }
 
    Abel diff(int x, int y){
        return weight(y) - weight(x);
    }
};

int main(){
    int N, M; cin >> N >> M;
    UnionFind<int> uni(N+1);

    for(int i=0; i<M; i++){
        int l, r, d; cin >> l >> r >> d;
        if(uni.issame(l, r)){
            if(uni.diff(l, r) != d){
                cout << "No" << endl;
                return 0;
            }
        } else {
            uni.merge(l, r, d);
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1536
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

int main(){
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);

  if((c-1)/b <= (a-1)/d){
    printf("Yes\n");}
  else{
    printf("No\n");}
  
  return 0;
}


Measured memory_bytes: 1660
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[] marks = new int[n + 1];
    int[] distances = new int[n + 1];

    Arrays.fill(distances, -1);
    distances[1] = 0;

    ArrayList<Integer> toVList[] = new ArrayList[n + 1];
    for(int i = 0; i <= n; i++){
      toVList[i] = new ArrayList<>();
    }
    ArrayDeque<Integer> queue = new ArrayDeque<>();

    for(int i = 0; i < m; i++){
      int a = sc.nextInt();
      int b = sc.nextInt();
      toVList[a].add(b);
      toVList[b].add(a);
    }
    queue.add(1);
    while(!queue.isEmpty()) {
      Integer v = queue.pollFirst();
      ArrayList<Integer> list = toVList[v.intValue()];
      for(Integer to_v : list){
        if(distances[to_v.intValue()] == -1){
          distances[to_v.intValue()] = distances[v.intValue()] + 1;
          marks[to_v.intValue()] = v.intValue();
          queue.add(to_v);
        }
      }
    }
    System.out.println("Yes");
    for(int i = 2; i <= n; i++){
      System.out.println(marks[i]);
    }
  }
}

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

using namespace std;

int main(void){
    string s;
    cin>>s;
    int count=0;
    for(int i=0;i<s.size();i++){
        if(s[i]!=s[s.size()-1-i]) count++;
    }
    cout<<count/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
string S;

int main() {
  INCANT;
  cin >> S;
  bool flag1=false;
  bool flag2=false;
  rep(i, S.size()) {
    if (S[i]=='C') flag1 = true;
    if (flag1 && S[i]=='F') flag2 = true;
  }
  string ans = flag1&&flag2?"Yes":"No";
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  long long x, y, a, b, c;
  cin >> x >> y >> a >> b >> c;
  long long p[a], q[b], r[c+x+y];
  for(long long i = 0; i < a; i++)cin >> p[i];
  sort(p, p+a);
  for(long long i = 0; i < a; i++)if(i<a-x)p[i]=-1;
  for(long long i = 0; i < b; i++)cin >> q[i];
  sort(q, q+b);
  for(long long i = 0; i < b; i++)if(i<b-y)q[i]=-1;
  for(long long i = 0; i < c; i++)cin >> r[i];
  for(long long i = 0; i < x; i++)r[i+c]=p[a-1-i];
  for(long long i = 0; i < y; i++)r[i+c+x]=q[b-1-i];
  sort(r, r+c+x+y);
  long long sum=0;
  for(long long i = 0; i < x+y; i++)sum+=r[c+x+y-1-i];
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3968
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

using ll = long long;

ll N;

int main()
{
  scanf( "%lld", &N );

  ll ans = 1;

  while( ans*ans <= N )
    ++ans;

  --ans;

  printf( "%lld\n", ans*ans );

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void) {
	char O[50], E[50];
	int i;
	scanf("%s", O);
	scanf("%s", E);
	for (i = 0; i < strlen(O); i++) {
		printf("%c", O[i]);
		if(E[i]!='\0')printf("%c", E[i]);
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<sstream>
#include<string>
using namespace std;
int main(){
long a,b,c;
stringstream ss;
string s;
for(;;){
getline(cin,s);
if(s=="0")break;
ss.str("");ss.clear();
ss<<s;
b=c=0;
while(ss>>a){
if(a==1){c++;b+=11;}
else if(a>9)b+=10;
else b+=a;
}
while(b>21&&c>0){
b-=10;c--;
}
if(b>21)b=0;
cout<<b<<endl;
}
return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  if (a > 9 || b > 9) {
    cout << -1 << endl;
    return 0;
  }

  cout << a * b << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque


def input(): return sys.stdin.readline().strip()


L = []
T = deque()
A = deque()
left = 0
total = 0

s = input()
for i, c in enumerate(s):
    if c == '\\':
        T.append(i)
    elif c == '/':
        if len(T) == 0:
            continue
        if i == 0:
            continue
        left = T.pop()
        area = (left, i - left)
        A.append(area)
        total += area[1]

while len(A) > 0:
    if len(A) == 1:
        a1 = A.pop()
        L.append(str(a1[1]))
        break
    a1 = A.pop()
    a2 = A.pop()
    if a1[0] < a2[0]:
        A.append((a1[0], a1[1] + a2[1]))
    else:
        L.append(str(a1[1]))
        A.append(a2)

print(total)
L.reverse()
print((str(len(L)) + ' ' + ' '.join(L)).strip())



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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    ll n, m;
    cin >> n >> m;

    OP(pow(2, m) * (1900 * m + 100 * (n - m)));
    return 0;
}

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

typedef pair<int, int> P;

int H, W;
int field[1010][1010];
int ctr[1010][1010];

int count_emp(int x, int y) {
  int c = 0;
  for (int xs=-1; xs<=1; xs++) {
    for (int ys=-1; ys<=1; ys++) {
      if (xs == 0 && ys == 0) continue;
      if (field[x+xs][y+ys] == 0) c++;
    }
  }
  return c;
}
void re_count(int x, int y) {
  field[x][y] = 0;
  for (int xs=-1; xs<=1; xs++) {
    for (int ys=-1; ys<=1; ys++) {
      if (xs == 0 && ys == 0) continue;
      ctr[x+xs][y+ys]++;
    }
  }
}


int main() {
  cin >> H >> W;
  for (int y=0; y<H; y++) {
    for (int x=0; x<W; x++) {
      char c;
      cin >> c;
      int t = 0;
      if (c != '.') t = (int)c - (int)'0';
      field[x][y] = t;
    }
  }

  // count all
  vector<P> updates;
  for (int x=1; x<W-1; x++) {
    for (int y=1; y<H-1; y++) {
      ctr[x][y] = count_emp(x, y);
      int t = field[x][y];
      if (t > 0 && ctr[x][y] >= t) {
        updates.push_back(P(x, y));
      }
    }
  }

  int ans = 0;
  if (!updates.empty()) {
    // O(N^2 log(N))
    while (true) {
      ans++;
      for (auto p : updates) {
        re_count(p.first, p.second);
      }
      vector<P> tmp;
      for (auto p : updates) {
        for (int xs=-1; xs<=1; xs++) {
          for (int ys=-1; ys<=1; ys++) {
            if (xs == 0 && ys == 0) continue;
            int x = p.first + xs, y = p.second + ys;
            int t = field[x][y];
            if (t > 0 && ctr[x][y] >= t) {
              if (find(tmp.begin(), tmp.end(), P(x, y)) == tmp.end())
                tmp.push_back(P(x, y));
            }
          }
        }
      }
      updates.clear();
      for (auto p : tmp) updates.push_back(p);
      if (updates.empty()) break;
    }
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 11032
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

typedef pair<int, int> pii;

int maps[3001][3001]; 
int w, h;

bool check(int x, int y) {
	return x >= 0 && x < w && y >= 0 && y < h;
}

int compress(vector<int> &xa, vector<int> &xb, int maxSize) {
	vector<int> cx;
	REP(i, xa.size()) {
		FOR(j, -1, 2) {
			if (xa[i] + j >= 0 && xa[i] + j < maxSize) cx.push_back(xa[i] + j);
			if (xb[i] + j >= 0 && xb[i] + j < maxSize) cx.push_back(xb[i] + j);
		}
	}
	cx.push_back(0);
	cx.push_back(maxSize - 1);
	
	sort(cx.begin(), cx.end());
	cx.erase(unique(cx.begin(), cx.end()), cx.end());
	
	REP(i, xa.size()) {
		xa[i] = find(cx.begin(), cx.end(), xa[i]) - cx.begin();
		xb[i] = find(cx.begin(), cx.end(), xb[i]) - cx.begin();
	}
	
	return cx.size();
}

int main() {
	while (cin >> w >> h, w || h) {
		fill(maps[0], maps[3001], 0);
		int n;
		cin >> n;
		
		vector<int> x1, y1, x2, y2;
		REP(i, n) {
			int a1, b1, a2, b2;
			scanf("%d %d %d %d", &a1, &b1, &a2, &b2);
			x1.push_back(a1);
			y1.push_back(b1);
			x2.push_back(a2);
			y2.push_back(b2);
		}
		w = compress(x1, x2, w);
		h = compress(y1, y2, h);
		
		REP(i, n) {
			maps[y1[i]][x1[i]]++;
			maps[y2[i]][x1[i]]--;
			maps[y1[i]][x2[i]]--;
			maps[y2[i]][x2[i]]++;
		}
		
		REP(i, h) FOR(j, 1, w) maps[i][j] += maps[i][j - 1];
		REP(i, w) FOR(j, 1, h) maps[j][i] += maps[j - 1][i];
		
		REP(i, h) REP(j, w) maps[i][j] = maps[i][j] > 0 ? 1 : 0;
		
		//REP(i, h) REP(j, w) printf("%2d%c", maps[i][j], j == w - 1 ? '\n' : ' ');
		
		int ans = 0;
		queue<pii> que;
		REP(i, h) REP(j, w) if (maps[i][j] == 0) {
			ans++;
			que.push(pii(j, i));
			while (!que.empty()) {
				pii now = que.front(); que.pop();
				int x = now.first, y = now.second;
				
				if (!check(x, y) || maps[y][x] == 1) continue;
				maps[y][x] = 1;
				
				int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
				REP(k, 4) que.push(pii(x + dx[k], y + dy[k]));
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 38360
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s, t;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> s >> t;
  t += s;
  Cout(t);
  return 0;
}

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

#define FOR(i,a,b)   for(int i=(a)  ;i<(b) ;i++)
#define RFOR(i,a,b)  for(int i=(b)-1;i>=(a);i--)
#define rep(i,n)     for(int i=0    ;i<(n) ;i++)
#define rrep(i,n)    for(int i=(n)-1;i>=0  ;i--)
#define each(i,a,b)  for(int i=(a)  ;i<=(b);i++)
#define reach(i,a,b) for(int i=(b)  ;i>=(a);i--)
#define all(a)       (a).begin(), (a).end()
#define rall(a)      (a).rbegin(), (a).rend()

int main() {
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  
  long long ans;
  ans =  max(a*c, b*d);
  ans = max(ans, a*c);
  ans = max(ans, a*d);
  ans = max(ans, c*b);
  cout << ans << endl;
  /*if (max(c, d) < 0 and max(a, b) < 0){
    cout << a*c << endl;
  } else if(max(c, d) < 0 or max(a, b) < 0) {
    cout << max(a*d, c * b) << endl;
  } else {
    cout << max(a *c, b*d) << endl;
  }*/

  return 0;
}

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

using namespace std;

const int max_num = 10'000;

void couting_sort(vector<int>& sequence, vector<int>& sorted) {
  vector<int> less_or_equal_counts(max_num + 1, 0);

  // Count duplication
  for(int i = 0; i < sequence.size(); i++) {
    less_or_equal_counts[sequence[i]]++;
  }

  // Count less than or equal to myself
  for(int i = 1; i < less_or_equal_counts.size(); i++) {
    less_or_equal_counts[i] += less_or_equal_counts[i - 1];
  }

  // Set sorted
  for(int i = sequence.size() - 1; i >= 0; i--) {
    int less_or_equal_num = less_or_equal_counts[sequence[i]];
    sorted[less_or_equal_num - 1] = sequence[i];

    less_or_equal_counts[sequence[i]]--;
  }
}

int main() {
  int sequence_num;
  vector<int> sequence, sorted;

  cin >> sequence_num;
  sequence.resize(sequence_num);
  sorted.resize(sequence_num);

  for(int i = 0; i < sequence_num; i++) {
    cin >> sequence[i];
  }

  couting_sort(sequence, sorted);

  for(int i = 0; i < sequence_num; i++) {
    cout << sorted[i];

    if(i != sequence_num - 1) {
      cout << " ";
    }
  }
  cout << endl;
}



Measured memory_bytes: 18336
N=int(input())
t=[input() for i in range(N)]
a,b,c,d=0,0,0,0
for j in range(N):
  if t[j]=="AC":
    a+=1
  if t[j]=="WA":
    b+=1
  if t[j]=="TLE":
    c+=1
  if t[j]=="RE":
    d+=1
print("AC x",a)
print("WA x",b)
print("TLE x",c)
print("RE x",d)

Measured memory_bytes: 79172
#include <bits/stdc++.h> 
#define ll long long
#define M 1000000007
using namespace std;
int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
    ll n,m,d,x,count=0;
    cin>>x;
    for(int i=1;i<=1000;i++)
    {
        for(int j=-1000;j<=i;j++)
        {   
            d=pow(i,5)-pow(j,5);
            if(d==x)
            {
                cout<<i<<" "<<j;return 0;
            }
        }
        
    }
     

}

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

const double pi = 3.14159265359;

int main() {
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
	int r;
	cin >> r;
	cout << 2 * pi * (double) r  << endl;
	return 0;
}

Measured memory_bytes: 3780
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

int n;
int t[50], sum;
//int sum[3];
bool dp[2][2505][2505];

int main() {
  cin >> n; 
  sum = 0;
  for(int i = 0; i < n; i++) {
    cin >> t[i];
    sum += t[i];
  }
  memset(dp, 0, sizeof(dp));
  dp[0][0][0] = 1;
  for (int i = 0; i < n; ++i) {
    int ci = i & 1, ni = (i + 1) & 1;
    memset(dp[ni], 0, sizeof(dp[ni]));

    for (int A = 0; A <= 2500; ++A) {
      for (int B = 0; B <= 2500; ++B) {
	if (!dp[ci][A][B]) continue;
	dp[ni][A][B] = 1;
	dp[ni][A + t[i]][B] = 1;
	dp[ni][A][B + t[i]] = 1;
      }
    }
  }

  int ans = 1e9;
  for (int A = 0; A <= 2500; ++A) {
    for (int B = 0; B <= 2500; ++B) {
      if (!dp[n & 1][A][B]) continue;
      ans = min(ans, max(A, max(B, sum - A - B)));
    }
  }

  cout << ans << endl;

  /*
  sort(t, t + n);
  
  for(int i = n-1; i >= 0; i--){
    sort(sum,sum+3);
    sum[0] += t[i];
  }

  sort(sum, sum + 3);

  cout << sum[2] << endl;
  */
}

Measured memory_bytes: 13428
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()

#define endl "\n"
#define pb push_back
#define elif else if
#define cout_db cout << fixed

#define MOD 1000000007LL
#define PI 3.1415926

typedef long long ll;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	int n, h, w;
	cin >> n >> h >> w;

	cout << (n-h+1) * (n-w+1) << endl;
	return 0;
}

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

ll dp[110][2][10];

int main() {
    string n;
    int k;
    cin >> n >> k;

    dp[0][0][0] = 1;
    int l = n.size();
    for (int i = 0; i < l; i++) {
        for (int smaller = 0; smaller < 2; smaller++) {
            for (int j = 0; j <= 3; j++) {
                for (int x = 0; x <= (smaller ? 9 : (int)(n[i] - '0')); x++) {
                    dp[i + 1][smaller || x < (int)(n[i] - '0')][j + (x != 0)] += dp[i][smaller][j];
                }
            }
        }
    }
    cout << dp[l][0][k] + dp[l][1][k] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = ((ll)(x) - 1); i >= 0; i--)
#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back

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

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

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}

int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const ll mod = 1e9 + 7;
const double PI = 3.14159265358979323846;


// ****************************************CODE***************************************//


int n, k, d[10];
bool h[10];

bool nohate(int v)
{
        while(v){
                if(h[v%10]) return false;
                v /= 10;
        }
        return true;
}

int main(){
        cin >> n >> k;
        for(int i = 0; i < 10; i++) h[i] = false;
        for(int i = 0; i < k; i++){
                cin >> d[i];
                h[d[i]] = true;
        }
        for(;;){

                if(nohate(n)){
                        cout << n << endl;
                        break;
                }
                n++;
        }
        return 0;
}


Measured memory_bytes: 256
// Problem : A - ∴ (Therefore)
// Contest : AtCoder - AtCoder Beginner Contest 168
// URL : https://atcoder.jp/contests/abc168/tasks/abc168_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// Muallif: Azimjon Mehmonali o'g'li

#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

#define sqr(x) (x) * (x)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define ALL(a) a.begin(), a.end()
#define rALL(a) a.rbegin(), a.rend()
#define SORT(a) sort(ALL(a))
#define sc scanf
#define pr printf
#define xatop(a) cerr << #a << " = " << a << endl;
#define jsatr xatop(__LINE__)
#define INF 1000000000
#define mod 1000000007

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

	int r = n % 10;

	if (r == 2 || r == 4 || r == 5 || r == 7 || r == 9)
		cout << "hon" << endl;
	else if (r == 0 || r == 1 || r == 6 || r == 8)
		cout << "pon" << endl;
	else if (r == 3)
		cout << "bon" << endl;

	return 0;
}


Measured memory_bytes: 3636
def main():
    s = [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]
    k = int(input())
    print(s[k-1])

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
class Dice
	def initialize()
		# top bottom N E S W
		@number = gets.split.map(&:to_i)

		@dice_number = [1, 6, 5, 3, 2, 4]
	end

	def rotate(command)
		swap_number = []

		case command
		when 'N'
			swap_number = [2, 1, 4]
			swap(swap_number)
		when 'E'
			swap_number = [3, 1, 5]
			swap(swap_number)
		when 'S'
			swap_number = [4, 1, 2]
			swap(swap_number)
		when 'W'
			swap_number = [5, 1, 3]
			swap(swap_number)
		end
	end

	def rotate_horizontal
		tmp = @dice_number[2]
		(2..4).each {|i| @dice_number[i] = @dice_number[i+1]}
		@dice_number[5] = tmp
	end

	def swap(number)
		number.map do |n|
			@dice_number[0], @dice_number[n] = @dice_number[n], @dice_number[0]
		end
	end

	def number
		number_return = []
		(0..5).each do |e|
			number_return << @number[@dice_number[e]-1]
		end
		
		number_return
	end
end

def rotateToTop(dice, position)
	case position
	when 0 then
	when 1 then
		dice.rotate('N')
	when 2 then
		dice.rotate('W')
	when 3 then
		dice.rotate('E')
	when 4 then
		dice.rotate('S')
	when 5 then
		2.times { dice.rotate('S') }
	end
end

n = gets.to_i

dice = []
n.times do |i|
	dice << Dice.new
end

difference_flag = 0
n.times do |i|
	dice1 = dice[i].clone
	(i..(n-1)).each do |j|
		next if i == j

		match_flag = false
		(0..5).each do |e|
			dice2 = Marshal.load(Marshal.dump(dice[j].clone))

			rotateToTop(dice2, e)

			num_of_rotation = 0
			while (num_of_rotation+=1) <= 4 do
				if dice1.number == dice2.number then
					match_flag = true
					break
				end
		
				dice2.rotate_horizontal
			end
	
			if match_flag then
					difference_flag += 1
					break
			end
		end
	end
end

if difference_flag == 0 then
	puts "Yes"
else
	puts "No"
end

Measured memory_bytes: 6444
#include <iostream>
#include <cmath>
 
int main(void) {
    int n;
    int d;
 
    std::cin >> n >> d;
 
    unsigned int nb = 0;
 
    for(int i = 0; i < n; i++) {
        int x, y;
        std::cin >> x >> y;
 
        if(sqrt(pow(x, 2) + pow(y, 2)) <= d) {
            nb++;
        }
    }
 
    std::cout << nb;
 
    return 0;
}

Measured memory_bytes: 3636
import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class Main {
	
	final boolean isDebug = false;
	String fileName = "input.txt";
	FastScanner sc;
	PrintWriter out;
	final int MOD = (int)1e9+7;
	final int INF = Integer.MAX_VALUE / 2;
	
	void solve() throws Exception{
		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();
		System.out.println((H * W - h * W - H * w + h * w));
	}
	
	/* end solve */
	
	/* main */
	public static void main(String[] args) throws Exception {
		new Main().m();
	}
	
	void m() throws Exception {
		long S = System.currentTimeMillis();
		sc = (isDebug) ? new FastScanner(new FileInputStream(fileName)) : new FastScanner(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
		long G = System.currentTimeMillis();
		if(isDebug){
			System.out.println("---Debug---");
			System.out.printf("%8d ms", (G-S));
		}
	}
	/* end main */
}
/* end Main */

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}

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

using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vii = vector<vector<int>>;

int n, m, x;
int C[12];
int A[12][12];

int main(){
    cin >> n >> m >> x;
    rep(i,n){
        int c, a;
        cin >> c;
        C[i] = c;
        for(int j = 0; j < m; ++j){
            cin >> a;
            A[i][j] = a;
        }
    }

    // 全列挙
    int p = (int)pow(2.0, n);
    int minimum_money = 1000000000;
    for (int k = 0; k < p; k++)
    {
        int buy_[n];
        for(int i = 0; i < n; ++i){
            buy_[i] = (k >> i) & 1;
            // cout << "buy_[" << i  << "]:" << buy_[i] << endl;
        }

        int money_sum = 0;
        vi skill_sum(m, 0);
        for(int i = 0; i < n; ++i){
            if( buy_[i] ){
                money_sum += C[i];
                for(int j = 0; j < m; ++j){
                    skill_sum[j] += A[i][j];
                }
            }
        }

        bool ok = true;
        for(int j = 0; j < m; ++j){
            if( skill_sum[j] < x ){
                ok = false; break;
            }
        }

        if( ok ) minimum_money = min(minimum_money, money_sum);
    }
    cout << ((minimum_money==1000000000) ? -1 : minimum_money);
    return 0;
}

Measured memory_bytes: 4000
#include<stdio.h>
int main(){
    int n1,n2;
    char op;
    while(1){
        scanf("%d %c %d",&n1,&op,&n2);
        if(op == '?')
        break;
        if(op == '+')
        printf("%d\n",n1+n2);
        if(op == '-')
        printf("%d\n",n1-n2);
        if(op == '*')
        printf("%d\n",n1*n2);
        if(op == '/')
        printf("%d\n",n1/n2);
    }
    return 0;
}



Measured memory_bytes: 2064
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		boolean[] prime = new boolean[100000];
		for (int i = 0; i < prime.length; i++)
			prime[i] = true;
		for (int i = 2; i < prime.length; i++)
			if (prime[i])
				for (int j = i + i; j < prime.length; j += i)
					prime[j] = false;
		while (true) {
			int m = sc.nextInt();
			int a = sc.nextInt();
			int b = sc.nextInt();
			if (m == 0 && a == 0 && b == 0)
				break;
			int p = 0, q = 0;
			out: for (int i = m; i > 0; i--) {
				for (int j = 2; j < (int) Math.sqrt(i) + 1; j++) {
					if (i % j == 0 && prime[i / j] && prime[j]
							&& a * i <= b * j * j) {
						p = j;
						q = i / j;
						break out;
					}
				}
			}
			System.out.println(p + " " + q);
		}
		sc.close();
	}
}

Measured memory_bytes: 29356
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+1;
int n,A[N],b=0;
list <int> L;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<n+1;i++){
        scanf("%d",&A[i]);
    }
    for(int i=1;i<n+1;i++){
        if(b%2==0)
            L.push_back(A[i]);
        else
            L.push_front(A[i]);
        b++;
    }
    if(n%2==0){
        while(!L.empty()){
            printf("%d ",L.front());
            L.pop_front();
        }
        return 0;
    }
    while(!L.empty()){
        printf("%d ",L.back());
        L.pop_back();
    }
    return 0;
}


Measured memory_bytes: 9216
#include <iostream>

using namespace std;

int main() {
	int r, c, **s;
	cin >> r >> c;
	s = new int*[r+1];
	for (int i = 0; i < r; i++) {
		s[i] = new int[c+1];
		int sum = 0;
		for (int j = 0; j < c; j++) {
			cin >> s[i][j];
			sum += s[i][j];
		}
		s[i][c] = sum;
	}
	s[r] = new int[c+1];
	for (int i = 0; i < c+1; i++) {
		int sum = 0;
		for (int j = 0; j < r; j++)
			sum += s[j][i];
		s[r][i] = sum;
	}

	for (int i = 0; i < r+1; i++) {
		for (int j = 0; j < c+1; j++) {
			if (j != 0)
				cout << " ";
			cout << s[i][j];
		}
		cout << endl;
	}

	for (int i = 0; i < r+1; i++)
		delete[] s[i];
	delete[] s;

	return 0;
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX_N 100005
const ll INF = (1LL<<60);

ll max(ll a,ll b,ll c){
  return max(a,max(b,c));
}

int N;
ll A[MAX_N];
ll dp[MAX_N][3];

int main(){
  for(int i=0;i<MAX_N;i++)
    for(int j=0;j<3;j++)
      dp[i][j]=-INF;
  cin>>N;
  cin>>dp[0][0];
  
  for(int i=0;i<N-1;i++){
    char ch;
    ll x;
    cin>>ch>>x;

    if(ch=='+'){
      dp[i+1][0]=max(dp[i][0]+x,dp[i][1]+x);
      dp[i+1][1]=max(dp[i][1]-x,dp[i][2]-x);
      dp[i+1][2]=dp[i][2]+x;
    }else if(ch=='-'){
      dp[i+1][0]=-INF;
      dp[i+1][1]=max(dp[i][0]-x,dp[i][1]-x,dp[i][2]-x);
      dp[i+1][2]=max(dp[i][1]+x,dp[i][2]+x);
    }

  }
  cout<< max(dp[N-1][0], max(dp[N-1][1],dp[N-1][2])) <<endl;
  return 0;
}


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

int main() {
    int x, y, W, H, r;
    cin >> W >> H >> x >> y >> r;
    
    if (r <= x && x <= W - r && r <= y && y <= H - r) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3124
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 03/14/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  vector<int> V = {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 K; cin>>K;
  cout << V[K-1] << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int N;
  char S[100];
  char T[100];
  
  scanf("%d", &N);
  scanf("%s %s", S, T);
  
  for(int i=0; i<N; i++){
  	printf("%c", S[i]);
    printf("%c", T[i]);
  }
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int d(int i,int a) {
  if(i%2==1) {
    if(a>=5)return a*2%10+1;
    else return a*2;
  }
  return a;
}

int main() {
  int n;
  string s;
  cin >> n >> s;
  int m;
  cin >> m;
  int a[m];
  for(int i=0; i<m; i++) {
    cin >> a[i];
  }
  reverse(s.begin(),s.end());
  int dp[n][10];
  for(int i=0; i<n; i++) {
    for(int j=0; j<10; j++) dp[i][j]=0;
  }
  if(s[0]!='*') dp[0][(int)s[0]-48]=1;
  else for(int i=0;i<m;i++) dp[0][a[i]]=1;

  for(int i=1; i<n; i++) {
    for(int j=0; j<10; j++) {
      if(s[i]=='*') {
	for(int k=0; k<m; k++) dp[i][(d(i,a[k])+j)%10]+=dp[i-1][j];
      } else {
	int c=(int)s[i]-48;
	int x=d(i,c);
	dp[i][(x+j)%10]+=dp[i-1][j];
      }
    }
  }
  cout << dp[n-1][0] << endl;
  return 0;
}


Measured memory_bytes: 5236