akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;
#define ar array 
const int m = 1e9+7;
int countDivisors(int n) 
{ 
    int cnt = 0; 
    for (int i = 1; i <= sqrt(n); i++) { 
        if (n % i == 0) { 
            // If divisors are equal, 
            // count only one 
            if (n / i == i) 
                cnt++; 
  
            else // Otherwise count both 
                cnt = cnt + 2; 
        } 
    } 
    return cnt; 
} 

void test_case() {
	int count = 0;
	int N; cin >> N;
	for(int i = 1 ; i < N ; i++)
		count+=countDivisors(i);
	cout<<count;
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T = 1;
	//cin >> T;
	while(T--){
		test_case();
	}
}


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

long long int table[200000];

int main(){

    long long int n,a,s,ans,tmpans;

    cin >> n;

    a = 0;

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

    ans = 8000000000;

    s = 0;


    for(int i=0;i<n-1;i++){
      s += table[i];
      a -= table[i];
      tmpans = a-s;
      if(tmpans < 0){
        tmpans *= -1;
      }
      ans = min(ans,tmpans);
    }

    cout << ans << endl;



    return 0;
}


Measured memory_bytes: 1792
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split("\n");
  var num = Number(input[0]);
  var b = {};
  var array = input[1].split(" ");

  // 各数字がいくつあるのか配列で管理する
  for (var i = 0; i < num; i++) {
    if (b[array[i]]){
      b[array[i]]++;
    } 
    else b[array[i]] = 1;
  }
  // 全て0のパターンの場合は存在する
  if (b[0] === num) return console.log("Yes");
  // ３の倍数でないとパターンが存在しない
  if(num%3)return console.log("No");
  
  // ３の倍数のパターン、かつ全て０でないパターン
  // 連続する 3 つの帽子に書かれた数のビットごとの排他的論理和が 0
  var f = 1;
  var x = 0;
  Object.keys(b).forEach((element, index) => {
    // x ⊕ y ⊕ z = 0 が成立するような 3 つの相異なる整数 x, y, z が書かれた帽子がそれぞれ N/3 枚
    if (b[element] !== num / 3) {
      f = 0;
      return true;
    }
    x ^= element;
  });
  
  if (f && x === 0) return console.log("Yes");

  var f = 0;
  Object.keys(b).forEach((element, index) => {
    // 0 が書かれた数が N/3 枚
    if (element == 0  && b[element] === num / 3){
      f++;
    } 
    // x が書かれた帽子が 2N/3 枚
    if (b[element] === num * 2 / 3){
      f++;
    } 
  });
  return console.log(f === 2 ? "Yes" : "No");
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 40704
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, p, ans = 0;
    cin >> n;
    bool read = true;
    for (int i = 1; i <= n; i++) {
        cin >> p;
        if (!read) { read = true; continue; }
        if (read && i == p) { ans++; read = false; }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define swap(a,b) do{ll w=a;a=b;b=w;}while(0)
#define swapd(a,b) do{double w=a;a=b;b=w}while(0)
#define in(a) scanf("%lld", &(a))
#define ind(a) scanf("%lf", &(a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a));
//def   puts(a) printf("%s\n", a) 文字はこっち
int cmp(const void *a, const void *b);
//your code here!

int main(void){
    ll p=0, idx[3]={0};
    char s[3][101];
    rep(i,3) scanf("%s", s[i]);
    while(1){
        if(s[p][idx[p]]=='\0'){
            putchar('A'+p);
            return 0;
        }
        if(s[p][idx[p]]=='a'){
            idx[p]++;
            p=0;
        }
        else if(s[p][idx[p]]=='b'){
            idx[p]++;
            p=1;
        }
        else {
            idx[p]++;
            p=2;
        }
    }
}

int cmp(const void *a, const void *b){
    ll A=*(ll *)a, B=*(ll *)b;
    if(A==B)return 0;
    else return A>B ? 1:-1;//昇順ソート 1,2....9
}


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

int main()
{
  int a;
  string s;
  cin >> a;
  cin >> s;
  if(a>=3200){
    cout << s << endl;
  } else {
    cout << "red" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 typedef long long ll;
int main() {
  ll N, M, A;
  cin >> N >> M;
  priority_queue<ll> p;
  for(ll i = 0; i < N; i++) {
    cin >> A;
    p.push(A);
  }
  ll ans, x = 0;
  for(ll j = 0; j < M; j++) {
  x = p.top()/2;
  p.pop();
  p.push(x); 
  }
  for(ll k = 0; k < N; k++) {
    ans += p.top();
    p.pop();
  }
  cout << ans;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const int MOD = (1e9 + 7);
int add(int a, int b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
	return a;
}
int mult(int a, int b)
{
	return (a*1LL*b)%MOD;
}
	
int R[1111111];
int C[1111111];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,m; cin>>n>>m;
	memset(R,-1,sizeof(R)); memset(C,-1,sizeof(C));
	for(int i=0;i<n;i++) 
	{
		int x; cin>>x; x--; R[x]=i;
	}
	for(int i=0;i<m;i++)
	{
		int x; cin>>x; x--; C[x]=i;
	}
	int ans=1;
	int r=0; int c=0; 
	for(int i=n*m-1;i>=0;i--)
	{
		if(R[i]>=0&&C[i]>=0)
		{
			r++; c++; 
		}
		else if(R[i]>=0)
		{
			r++; ans=mult(ans,c);
		}
		else if(C[i]>=0)
		{
			c++; ans=mult(ans,r);
		}
		else
		{
			int fre = r*c-(n*m-1-i);
			if(fre<=0){ans=0; break;}
			ans=mult(ans,fre);
		}
	}
	cout<<ans<<'\n';
}


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

int main(){
  int n,r;
  cin >> n >> r;
  
  if(n>=10)cout << r;
  else cout << r+100*(10-n);
  return 0;
}

Measured memory_bytes: 256
N = int(input())
a = list(map(int,input().split()))
ans = 0
idx = []
for i,x in enumerate(a):
    if x > 10**5:
        ans += 1
        idx += [i]
for i in reversed(idx):
    del a[i]

import sys
if len(a) == 0:
    print(ans)
    sys.exit()

counts = [0] * (10 ** 5 + 1)

for i in a:
    counts[i] += 1
    
for i in range(len(counts)):
    if counts[i] == 0:continue
    if counts[i] < i:
        ans += counts[i]
    elif counts[i] > i:
        ans += counts[i]-i
        
print(ans)

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

int pn(int x) {
    int i;
    for (i = 2; i <= sqrt(x); i++) {
        if (!(x%i))
            return 0;
    }
    return 1;
}

int main() {
    int n, count = 0;
    scanf("%d", &n);
    while (n--) {
        int x;
        scanf("%d", &x);
        if (pn(x))
            count++;
    }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ld EPS=10e-8;
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

vector<pair<ll,pair<ll,ll>>> V;
ll length=0,N;
ll chek[107];
ll A[107][107];

void dfs(ll pt,ll c){
    chek[pt]=1;
    if(c==N){
        return;
    }
    rep(i,N){
        if(pt!=i){
            V.pb(mp(A[pt][i],mp(pt,i)));
        }
    }
    sort(ALL(V));
    rep(i,V.size()){
        if(chek[V[i].second.second]==0){
            length+=V[i].first;
            dfs(V[i].second.second,c+1);
            break;
        }
    }
}
 
int main(){
    cin>>N;
    rep(i,N){
        rep(j,N){
            cin >> A[i][j];
            if(A[i][j]==-1){
                A[i][j]=MOD;
            }
        }
    }
    rep(i,N){
        if(0!=i){
            V.pb(mp(A[0][i],mp(0,i)));
        }
    }
    dfs(0LL,0LL);
    cout  << length << endl;
}


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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

class UnionFind
{
public:
    UnionFind(int n)
        : mN(n)
    {
        REP(i, n)
        {
            mNodeTbl.push_back(i);
            mRankTbl.push_back(0);
        }
    }

    int find(int x)
    {
        if (x == mNodeTbl[x])
            return x;
        return mNodeTbl[x] = find(mNodeTbl[x]);
    }
    bool same(int x, int y)
    {
        return find(x) == find(y);
    }
    void unit(int x, int y)
    {
        x = find(x);
        y = find(y);
        if (x == y)
            return;
        if (mRankTbl[x] < mRankTbl[y])
        {
            mNodeTbl[x] = y;
        }
        else
        {
            mNodeTbl[y] = x;
            if (mRankTbl[x] == mRankTbl[y])
                mRankTbl[x]++;
        }
    }

private:
    int mN;
    vector<int> mNodeTbl;
    vector<int> mRankTbl;
};

int main()
{
    int N, M;
    cin >> N >> M;
    UnionFind uf(M);
    vector<int> L;
    REP(i, N)
    {
        int k;
        cin >> k;
        REP(j, k)
        {
            int l;
            cin >> l;
            if (j > 0)
                uf.unit(L[L.size() - 1], l);
            L.push_back(l);
        }
    }
    sort(L.begin(), L.end());
    L.erase(unique(L.begin(), L.end()), L.end());
    REP(i, L.size() - 1)
    {
        if (uf.same(L[i], L[i + 1]))
            continue;
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 1780
import java.util.*;

class Main{
	
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		if(N==3 || N==5 || N==7)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
//setprecision(12)
#include <cassert>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
const long long MOD = 1000000007;
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; }
typedef long long ll;
#define pint pair<int,int>
#define pll pair<ll,ll>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m; cin >> n >> m;
    int all = 0;
    int cnt = 0;
    vector<int> v(n);
    rep(i,n) {
        cin >> v[i];
        all += v[i];
    }
    rep(i,n) {
        if(all<=4*m*v[i]) cnt++;
    }
    if(m<=cnt) cout << "Yes" << endl;
    else cout << "No" << 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;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x, y, z, k;
	cin >> x >> y >> z >> k;
	vector<ll> a(x), b(y), c(z);
	rep(i,x) cin >> a[i];
	rep(i,y) cin >> b[i];
	rep(i,z) cin >> c[i];
	vector<ll> ab;
	rep(i,x)rep(j,y){
		ab.push_back(a[i] + b[j]);
	}
	sort(ab.rbegin(), ab.rend());
	sort(c.rbegin(), c.rend());
	priority_queue<ll> pq;
	rep(i,min(k,x*y))rep(j,min(k,z)){
		pq.push(-(ab[i] + c[j]));
		if(pq.size() > k) pq.pop();
	}
	vector<ll> ans(k);
	for(int i = k-1; i >= 0; --i){
		ans[i] = -(pq.top());
		pq.pop();
	}
	rep(i,k) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 11580
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(i,j,n) for(ll i = (ll)(j); i < (ll)(n); i++)
#define mrep(i,n) for (ll i = (ll)(n-1); i >= 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main(){
	int a,b; cin >> a >> b;
	if(a%2==0||b%2==0) cout << "Even" << endl;
	else cout << "Odd" << endl;
}

Measured memory_bytes: 256
N = gets.to_i
AN = gets.split.map(&:to_i)
BC = gets.chomp.to_i.times.map { gets.split.map(&:to_i) }

sum = AN.sum
counts = AN.tally
counts.default = 0

BC.each do |bc|
  b, c = bc
  sum = sum + (c - b) * counts[b]
  counts[c] = counts[c] + counts[b]
  counts[b] = 0
  puts sum
end


Measured memory_bytes: 27804
#include<stdio.h>
int main()
{
	const int MASK = 0x10000000;
	unsigned n, i;
	while(scanf("%u", &n) == 1)
	{
		for(i = 1; i < 0x400; i<<=1)
		{
			if(n&i)
			{
				if(n&MASK)
					printf(" %d", i);
				else
					printf("%d", i), n|=MASK;
			}
		}
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) {return (n==0)?1:10*TEN(n-1);}

int main() {
    string s;
    cin >> s;
    bool f1 = count(s.begin(), s.end(), 'N');
    bool f2 = count(s.begin(), s.end(), 'W');
    bool f3 = count(s.begin(), s.end(), 'S');
    bool f4 = count(s.begin(), s.end(), 'E');
    if (f1 ^ f3 or f2 ^ f4) {
        printf("No\n");
    } else {
        printf("Yes\n");
    }
    return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {

    int n;
    cin >> n;
    vector<int> R(n);
    vector<int> C(n);
    REP(i,n) cin >> R[i] >> C[i];
    vector<vector<int>> dp(n,vector<int>(n,INF));

    REP(i,n) dp[i][i] = 0;

    FOR(w,1,n){
        FOR(l,0,n-w){
            int r = l+w; 
            FOR(m,l,r){
                dp[l][r] = min(dp[l][r], dp[l][m] + dp[m+1][r] + R[l]*C[m]*C[r]);
            }
        }

    }

    cout << dp[0][n-1] << endl;
    


    return 0;
}


Measured memory_bytes: 3188
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<typeinfo>
#include<functional>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;



ll gcd(ll a,ll b){
    if(a%b==0){return b;}
    return gcd(b,a%b);
}


int main(){
    ll n,m;
    cin>>n>>m;
    ll g=gcd(n,m);
    string s,t;
    cin>>s>>t;
    if(n==m){
        if(s!=t){cout<<-1<<endl;}
        else{cout<<n<<endl;}
        return 0;
    }
    if(s[0]!=t[0]){cout<<-1<<endl; return 0;}
    ll A=n/g;
    ll B=m/g;
    for(int i=0;i<g;i++){
        if(s[i*A]!=t[i*B]){cout<<-1<<endl; return 0;}
    }
    cout<<n*m/g<<endl;
    
    
    
    return 0;
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e10;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define mins(x, y) x = min(x, y)
#define maxs(x, y) x = max(x, y)

const int mod = 1000000007;

vector<int> seg = {
        0,
        2,
        5,
        5,
        4,
        5,
        6,
        3,
        7,
        6};
int n, m;
vector<int> options;


int minSeg() {

    int ans = 10;
    for (int option : options) {
        ans = min(ans, seg[option]);
    }
    return ans;

}


int maxLen() {


    return n / minSeg();

}


int f(string s) {
    int ans = 0;
    for (int i = 0; i < s.size(); i++) {
        ans += seg[s[i]];
    }
    return ans;
}

string fMax(string s, string t) {
    if (s == "-1") {
        return t;
    }
    if (t == "-1") {
        return s;
    }
    if (s.length() > t.length()) {
        return s;
    } else if (s.length() < t.length()) {
        return t;
    } else {
        if (s.compare(t) > 0) {
            return s;
        } else {
            return t;
        }
    }
}

int main() {

    cin >> n >> m;
    rep(i, m) {
        int a;
        cin >> a;
        options.push_back(a);
    }
    sort(options.rbegin(), options.rend());

    vector<string> dp(n + 1, "-1");
    for (int i = 0; i <= n; i++) {
        for (int option : options) {
            if (i < seg[option]) {
                continue;
            }
            if (i == seg[option]) {
                char c = '0' + option;
                string s = "";
                s += c;
                dp[i] = fMax(s, dp[i]);
                continue;
            }
            if (dp[i - seg[option]] == "-1") {
                continue;
            }
            dp[i] = fMax(dp[i], dp[i - seg[option]] + (char) ('0' + option));

        }
    }
    cout << dp[n] << endl;
}



Measured memory_bytes: 45056
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
void YESNO(bool), YesNo(bool);
template <class T1, class T2> bool chmin(T1 &l, const T2 &r);
template <class T1, class T2> bool chmax(T1 &l, const T2 &r);

void solve(long long N, long long K, std::vector<long long> a) {
  vector<int> dp(K+1);
  for(int i = 1;i<=K;i++){
    set<int> nx;
    rep(j, N){
      lli nxt = i - a[j];
      if(nxt>=0) nx.insert(dp[nxt]);
    }
    rep(j, 101)
    if(nx.find(j)==nx.end())
    {
      dp[i] = j;
      break;
    }
  }
  cout << (dp[K]?"First":"Second") << endl;
}

signed main() {
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  std::vector<long long> a(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
  }
  solve(N, K, std::move(a));
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2> bool chmin(T1 &l, const T2 &r) {
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2> bool chmax(T1 &l, const T2 &r) {
  return (l < r) ? (l = r, true) : false;
}


Measured memory_bytes: 640
N = int(input())
a_l = list(map(int, input().split()))
b_l = list(map(int, input().split()))

cnt = 0
for i in range(N):
    if a_l[i] <= b_l[i]:
        cnt += a_l[i]
        tmp1 = b_l[i] - a_l[i]
        if a_l[i+1] >= tmp1:
            cnt += tmp1
            a_l[i+1] -= tmp1
        else:
            cnt += a_l[i+1]
            a_l[i+1] = 0
    else:
        cnt += b_l[i]

print(cnt)


Measured memory_bytes: 82020
def calc(u,v,x,y):
    a = v - u
    b = abs(u-x) + abs(y-v) + 1
    c = abs(u-y) + abs(x-v) + 1
    # print(a,b,c, '-', u,v,x,y)
    return min(a,b,c)

n,x,y = map(int, input().split())
d = {}
for i in range(1,n):
    for j in range(i+1,n+1):
        dist = calc(i,j,x,y)
        if dist not in d:
            d[dist] = 0
        d[dist] += 1
        # print(i,j,dist)

for i in range(1,n):
    print(d.get(i,0))


Measured memory_bytes: 3572
package main

import (
	"fmt"
	"math"
)

func isPrime(n int) bool {
	if n == 1 || n == 2 {
		return true
	}
	for i := 2; i <= int(math.Sqrt(float64(n))); i++ {
		if n%i == 0 {
			return false
		}
	}
	return true
}

func main() {
	var X int
	fmt.Scan(&X)
	for i := X; ; i++ {
		if isPrime(i) {
			fmt.Println(i)
			return
		}
	}
}


Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
int main(void){
    // Your code here!
    char s[100];
    int i, n, m=0;
    
    scanf("%s",s);
    n=strlen(s);
    
    for(i=0;i<n;i++){
        if(s[i]!=s[n-1-i]){
            s[i]=s[n-1-i];
            m++;
        }
    }
    printf("%d\n",m);
    return 0;
}

Measured memory_bytes: 128
N,M=list(map(int,input().split()))
xyz=[list(map(int,input().split())) for _ in range(N)]

dp=[[[-10**15]*8 for _ in range(N+1)] for _ in range(N+1)]
sign={0:1,1:-1}
ans=0

for i in range(2**3):
    signlst=[1]*3

    for j in range(N):
        dp[j][0][i]=0

    for j in range(3):
        signlst[j]=sign[(i>>j)&1]
    
    for j in range(N):
        for k in range(N):
            dp[j+1][k+1][i]=max(dp[j][k+1][i],dp[j][k][i]+sum([signlst[l]*xyz[j][l] for l in range(3)]))
    
    ans=max(ans,dp[N][M][i])

print(ans)

Measured memory_bytes: 206388
class PriorityQueue
  MIN = -(1 << 60)

  attr_reader :size

  def initialize(capacity = nil, &block)
    @size = 0
    @heap = capacity.nil? ? Array.new : Array.new(capacity)
    @key = block || :itself.to_proc
  end

  def empty?
    size == 0
  end

  def push(x)
    i = @size
    @size += 1
    while i > 0
      parent = (i - 1) / 2
      break if (@key.call(@heap[parent]) <=> @key.call(x)) >= 0
      @heap[i] = @heap[parent]
      i = parent
    end
    @heap[i] = x
    nil
  end

  def pop
    return nil if @size <= 0
    ret = @heap[0]
    x = @heap[@size - 1]
    @size -= 1
    i = 0
    while i * 2 + 1 < @size
      l = i * 2 + 1
      r = i * 2 + 2
      largest = l
      largest = r \
        if r < @size && (@key.call(@heap[r]) <=> @key.call(@heap[largest])) > 0
      break if (@key.call(x) <=> @key.call(@heap[largest])) >= 0
      @heap[i] = @heap[largest]
      i = largest
    end
    @heap[i] = x
    ret
  end

  def top
    return nil if @size <= 0
    @heap[0]
  end

  def to_a
    @heap.take(@size)
  end
end

N, M = gets.split.map(&:to_i)
a_list = gets.split.map(&:to_i)
bc_list = M.times.map { gets.split.map(&:to_i) }
sorted = bc_list.sort_by { |(_, c)| -c }
pq = PriorityQueue.new { |a| -a } # 小さい値を優先
a_list.each { |a| pq.push(a) }
sorted.each do |(b, c)|
  while b > 0 && c > pq.top
    pq.pop
    pq.push(c)
    b -= 1
  end
end
ans = pq.to_a.reduce(&:+)
puts ans


Measured memory_bytes: 19984
#![allow(unused_macros, unused_imports, dead_code, non_snake_case)]

use std::io;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
            assert!(_it.next().is_none());
        }
    };
}

fn runlength(s: &String) -> Vec<(char, usize)> {
    let mut res = Vec::new();
    let mut cur: char = '$';
    let mut cnt = 0;
    for x in s.chars() {
        if x != cur {
            if cnt > 0 {
                res.push((cur, cnt));
            }
            cur = x;
            cnt = 1;
        } else {
            cnt += 1;
        }
    }
    if cnt > 0 {
        res.push((cur, cnt));
    }
    res
}

fn main() {
    let letters = vec![vec![],
                       vec![' ', '.', ',', '!', '?'],
                       vec!['c', 'a', 'b'],
                       vec!['f', 'd', 'e'],
                       vec!['i', 'g', 'h'],
                       vec!['l', 'j', 'k'],
                       vec!['o', 'm', 'n'],
                       vec!['s', 'p', 'q', 'r'],
                       vec!['v', 't', 'u'],
                       vec!['z', 'w', 'x', 'y']];


    from_line!(n:usize);
    for _ in 0..n {
        from_line!(s:String);
        let g = runlength(&s);
        let mut msg = String::new();
        let mut cur = '$';
        for &(c, t) in &g {
            let c: usize = c.to_digit(10).unwrap() as usize;
            if c == 0 && cur != '$' {
                msg.push(cur);
                cur = '$';
            } else if c > 0 {
                cur = letters[c][t % letters[c].len()];
            }
        }
        println!("{}", msg);
    }
}



Measured memory_bytes: 5036
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X,Y,Z,K;
    cin >> X >> Y >> Z >> K;
    ll A[1010], B[1010], C[1010];
    rep(i,0,X) cin >> A[i];
    rep(i,0,Y) cin >> B[i];
    rep(i,0,Z) cin >> C[i];
    sort(A, A+X);
    sort(B, B+Y);
    sort(C, C+Z);
    vector<ll> v;
    rep(i,0,X){
        rep(j,0,Y){
            v.push_back(A[i] + B[j]);
        }
    }
    sort(v.begin(), v.end(), greater<ll>());
    ll idx[1010] = {};
    rep(i,0,K){
        ll max_val = 0, max_pos = -1;
        rep(j,0,Z){
            if(idx[j] >= X*Y) continue;
            if(max_val < v[idx[j]] + C[j]){
                max_val = v[idx[j]] + C[j];
                max_pos = j;
            }
        }
        idx[max_pos]++;
        print(max_val);
    }



    



    
}

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

int main()
{
    int N, C;
    int D[33][33];
    int cnt[3][33] = {};

    cin >> N >> C;
    for ( int i = 0; i < C; i++ ) {
        for ( int j = 0; j < C; j++ ) {
            cin >> D[i][j];
        }
    }
    for ( int i = 0; i < N; i++ ) {
        for ( int j = 0; j < N; j++ ) {
            int val;
            cin >> val;
            cnt[(i + j) % 3][val - 1]++;
        }
    }

    int minv = (1 << 30) - 1;
    for ( int a = 0; a < C; a++ ) {
        for ( int b = 0; b < C; b++ ) {
            if ( a != b ) {
                for ( int c = 0; c < C; c++ ) {
                    if ( a != c && b != c ) {
                        int sum = 0;
                        for ( int i = 0; i < C; i++ ) {
                            sum += D[i][a] * cnt[0][i];
                        }
                        for ( int i = 0; i < C; i++ ) {
                            sum += D[i][b] * cnt[1][i];
                        }
                        for ( int i = 0; i < C; i++ ) {
                            sum += D[i][c] * cnt[2][i];
                        }
                        minv = min(minv, sum);
                    }
                }
            }
        }
    }
    cout << minv << endl;
    return ( 0 );
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
typedef long long ll;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,n,a) for(int i=n;i>=a;i--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
#define vi vector<int>
#define vvi vector<vector<int>>
#define pcnt(n) __builtin_popcount(n)
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const double PI = acos(-1);

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int x;
    cin>>x;
    int s = 100;
    int ans = 0;
    while(s<x){
        s+= 0.01*s;
        ans++;
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int r = 0;
        for(int i=1; i<=5; i+=2) {
            int max = Integer.parseInt(repeat("9", i));
            int min = Integer.parseInt("1"+repeat("0", i-1));
            if(min>n) {
                break;
            }
            if(n<=max) {
                r+=n-min+1;
                break;
            }
            else {
                r+=max-min+1;
            }
        }
        System.out.println(r);
    }
    private static String repeat(String s, int c) {
        if(c<=0) {
            return "";
        }
        // string repeat https://stackoverflow.com/questions/1235179/simple-way-to-repeat-a-string-in-java
        return new String(new char[c]).replace("\0", s);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
int main()
{
    ll N, M;
    cin >> N >> M;
    vll A(N), B(M), C(M), S(N);
    vector<pair<int, int>> P(M);
    rep(i, N)
    {
        cin >> A[i];
    }
    ll ans = 0;
    sort(all(A));

    rep(i, M)
    {
        cin >> B[i] >> C[i];
        P[i] = {C[i], B[i]};
    }
    sort(all(P), greater<pair<int, int>>());
    ll idx = 0;
    rep(i, N)
    {
        if (A[i] < P[idx].first and P[idx].second > 0)
        {
            P[idx].second--;
            A[i] = P[idx].first;
        }
        if (P[idx].second == 0)
        {
            idx++;
        }
    }
    rep(i, N)
    {
        ans += A[i];
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 4224
import static java.lang.Math.*;
import static java.util.Arrays.*;

import java.util.*;
import java.io.*;

public class Main {
	
	int[] v = {1000, 100, 10, 1};
	String s = "mcxi";
	
	void run() {
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		for(int t=0;t<T;t++) {
			String str1 = sc.next(), str2 = sc.next();
			System.out.println( int2str(str2int(str1) + str2int(str2)) );
		}
	}
	
	int str2int(String str) {
		int ret = 0, val=1;
		for(int i=0;i<str.length();i++) {
			if( '0' <= str.charAt(i) && str.charAt(i) <= '9')
				val = str.charAt(i) - '0';
			for(int j=0;j<s.length();j++) if(s.charAt(j) == str.charAt(i)){
				ret += val * v[j]; val = 1;
			}
		}
		return ret;
	}
	
	String int2str(int val) {
		String str = "";
		for(int i=0;i<v.length;i++) if(val / v[i] > 0){
			if(val/v[i] != 1) str += (val/v[i]);
			str += s.charAt(i);
			val %= v[i];
		}
		return str;
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 27248
#include<bits/stdc++.h>
using namespace std;
#define Khela_Sesh ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define llu long long unsigned int
#define pf printf
#define sf scanf
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define pii pair<int ,int>
const int sz =  1e3+10;
const int mod = 1e9+7;
int n,m;
int dp[sz][sz];
char str[sz][sz];
bool check(int x,int y)
{
    if(0<=x && x<n && 0<=y && y<m && str[x][y]=='.')  return true;
    else return false;
}
int cholo(int p,int q)
{
    int &ret=dp[p][q];
    if(~ret) return ret;
    ret=0;
    if(p==(n-1) && q==(m-1))  return (ret=1);
    else{
        int x=0,y=0;
        if(check(p,q+1)) x=cholo(p,q+1);
        if(check(p+1,q)) y=cholo(p+1,q);
        ret=(x+y)%mod;
        return ret;
    }

}
int main()
{
    Khela_Sesh
    int a,b,c,i,j,k,q,p,x,y,sum,ct,ct1,l,r,len,x1,y1,mn,t,mx;
    char ch;
    double d;
    string str1,str2;
    bool bl,bl1;
    while(cin>>n>>m)
    {
        for(i=0;i<n;i++)
            for(j=0;j<m;j++)  cin>>str[i][j];
        memset(dp,-1,sizeof dp);
        p=cholo(0,0);
        pf("%d\n",p);
    }


}


Measured memory_bytes: 5376
use whiteread::parse_line;

fn main() {
    let s: String = parse_line().unwrap();
    let mut ans: Vec<char> = Vec::new();

    for c in s.chars() {
        match c {
            '0' => ans.push('0'),
            '1' => ans.push('1'),
            'B' => {
                if !ans.is_empty() {
                    ans.pop();
                }
            }
            _ => unreachable!(),
        }
    }
    println!("{}", ans.iter().collect::<String>());
}


Measured memory_bytes: 2144
#include <stdio.h>
 
int main(void) {
	// your code goes here
	
	char s[100001];
	int k;
	
	scanf("%s",s);
	scanf("%d",&k);
	
	int i = 0;
	char* c;
	for(c = s; *c!='\0'; c++){
		if(*c == 'a') continue;
		int diff = ('z'+1 - *c);
		if(k>=diff){
			*c = 'a';
			k-=diff;
		}
	}
	c--;
	(*c) += (k%26);
	
	printf("%s",s);
 
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int a=0,b=1,r=0,n=0;
  string c;
  cin>>c;
  if(c[0]=='A') a=1;
  if(a){
    for(int i=1;i<c.size();i++){
      if(c[i]=='C'&&i!=1&&i!=c.size()-1) r++;
      else if(c[i]<'a') b=0;
    }
    if(r==1) n=1;
  }
  
  if(n&a&b) cout<<"AC";
  else cout<<"WA";
  cout<<"\n";
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	void solve(){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int W = scan.nextInt();
		int[] w = new int[n];
		long[] v = new long[n];
		for(int i = 0; i < n; i++) {
			w[i] = scan.nextInt();
			v[i] = scan.nextInt();
		}
		long[][] dp = new long[n + 1][W + 1];
		for(int i = 0; i < n; i++) {
			for(int j = 0; j <= W; j++) {
				if(j < w[i]) dp[i + 1][j] = dp[i][j];
				else dp[i + 1][j] = Math.max(dp[i][j], dp[i][j - w[i]] + v[i]);
			}
		}
		System.out.println(dp[n][W]);
		scan.close();
	}

	public static void main(String[] args){
		new Main().solve();
	}
}
 

Measured memory_bytes: 140384
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>
#include <queue>
#define _USE_MATH_DEFINES
#include <math.h>

typedef long long ll;

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

//最大・最小
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;
}

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}


//二分探索
bool isOk(ll index, ll key,vector<ll> &a){
	
	if(a[index]>key){
		return true;
	}
	
	return false;
}

ll bin_search(ll key, vector<ll> &a){
	
	ll l=-1;
	ll r=a.size();

	while(abs(r-l)>1){
		ll mid = (l+r)/2;
		if(isOk(mid, key, a)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	return r;
}


//深さ優先探索
void dfs(vector<string> &m,vector<vector<bool>> &seen, ll x, ll y, ll h, ll w){

	seen[y][x]=true;

	
	for(ll i=0;i<4;i++){
		ll nx=x,ny=y;
		if(i==0){ //up
			ny=y-1;
		}
		else if(i==1){ //down
			ny=y+1;
		}
		else if(i==2){ //right
			nx=x+1;
		}
		else{ //left
			nx=x-1;
		}

		if(nx<0 || nx>=w || ny<0 || ny>=h){
			continue;
		}
		if(seen[ny][nx]){
			continue;
		}
		
		if(m[ny][nx]=='#'){
			continue;
		}

		dfs(m,seen,nx,ny,h,w);
	}
}

const ll MOD=1000000007;

void solve(){

	string s;
	cin>>s;
	if(s=="ARC"){
		s="ABC";
	}
	else{
		s="ARC";
	}

	cout<<s<<endl;

}


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


Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  vector<int>d;
  int b;
  for(int i=0; i<n; i++){
    cin>>b;
    d.push_back(b);
  }
  int s = d.size();
  int ans = 0;
  for(int i=0; i<s-1; i++)for(int j=i+1; j<s; j++){
    ans += d[i]*d[j];
  }
  cout<<ans<<endl;
}

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

using namespace std;

int s, cnt[1000000];

int main(){
    cin >> s;
    cnt[s]++;
    for (int i = 2; i < 2000000; i++){
        int x;
        if (s&1) x = s*3 + 1;
        else x = s/2;
        cnt[x]++;
        s = x;
        if (cnt[x] == 2){
            cout << i;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
if n == 1:
    print('Hello World')
else:
    a = inp()
    b = inp()
    print(a+b)

Measured memory_bytes: 5064
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int[] t = new int[n];
		int sum=0;
		for (i = 0; i < n; i++) {
			t[i] = parseInt(sc.next());
			sum+=t[i];
		}
		int m = parseInt(sc.next());
		int[] p = new int[m];
		int[] x = new int[m];
		for (i = 0; i < m; i++) {
			p[i] = parseInt(sc.next());
			x[i] = parseInt(sc.next());
		}
		sc.close();
		PrintWriter pw = new PrintWriter(out);
		for (i = 0; i < m; i++) {
			pw.println(sum-t[p[i]-1]+x[i]);
		}
		pw.flush();;
	}
}


Measured memory_bytes: 21332
#include<bits/stdc++.h>
 
#define lol long long
#define gcd(x,y) __gcd(x,y)
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define fixed fixed<<setprecision(14)
using namespace std;
using pii=pair<int,int>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline lol abs(A &a) { return (a < 0 ? -a : a); }
bool inLine(int x,int y,int mx,int my){return (x>=0&&y>=0&&x<mx&&y<my);}
const lol inf=(1LL<<62);
const lol MOD=(1e9)+7;
const lol mod=998244353;
const int dx[]={1,0,-1,0,1,1,-1,-1};
const int dy[]={0,1,0,-1,1,-1,1,-1};
lol n,m,k,r;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  vector<int> a(n);
  vector<int> ans(n);
  for(auto&&o:a) cin >>o;
  lol tmp=0;
  for(int i=1;i<n;i++){
    tmp^=a[i];
  }
  ans[0]=tmp;
  for(int i=1;i<n;i++){
    tmp=a[i]^a[i-1]^ans[i-1];
    ans[i]=tmp;
  }
  for(int i=0;i<n-1;i++) cout <<ans[i]<<' ';
  cout <<ans[n-1]<<'\n';
  return (0);
}

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

int main(){
  int N;
  cin >> N;
  
  vector<int> vec(N);
  
 for( int i =0; i < N; i++){
   cin >> vec.at(i);
 }
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  int count = 1;
  for ( int j = 0; j < N-1; j++){
    if(vec.at(j) > vec.at(j+1)){
      count++;
    }
    else{
    }
  }
  cout << count << endl;
}
      

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#define endl "\n"
typedef long long ll;
using namespace std;
void LANCER_SHARK() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
bool isPrime(ll n){
	if (n == 2 || n == 3 || n == 5)
		return true;
	else if (n % 2 == 0 || n % 3 == 0 || n % 5 == 0 || n == 1)
		return false;
	else {
		for (int i = 5; i <= sqrt(n); i += 2){
			if (n%i == 0)
				return false;
		}
		return true;
	}
}

int frq[50];
int main(){
	LANCER_SHARK();
	ll n, m, c, a,sum, res = 0;
	cin >> n >> m >> c;
	vector<int>vec(m);
	for (int j = 0; j < m; j++)
		cin >> vec[j];

	for (int i = 0; i < n; i++){
		sum = 0;
		for (int j = 0; j < m; j++){
			cin >> a;
			sum += (a*vec[j]);
		}
		sum += c;
		res = sum > 0 ? ++res : res;
	}
	cout << res;
	cout << endl;
	return 0;
}


Measured memory_bytes: 3676
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include<cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include<iostream>
#include<list>
#include<queue>
#include<set>
#include<string>
#include <vector>

#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REPR(i,n)   FORR(i,n,0)

using namespace std;

int main(){
	int N;
	scanf("%d", &N);
	if (N % 2 == 0){
		printf("%d\n", N);
	}
	else{
		printf("%d\n", 2 * N);
	}


	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

const int MAX = 1e6+1;

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(ll n, ll k){
  if(n >= MAX){
    ll tmp = 1;
    rep(i,k){
      tmp *= (n-i);
      tmp %= MOD;
    }
    return tmp*finv[k]%MOD;
  }

  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll POW(ll x, ll n){
  ll ret = 1;

  if(n < 0){// n < 0 にも対応
    n *= -1;
    x = inv[x];
  }

  while(0 < n){
    if(n%2 == 0){
      x = x*x%MOD;
      n /= 2;
    }
    else{
      ret = ret*x%MOD;
      n--;
    }
  }

  return ret;
}

//dp

int main(){
  int n; string s;
  cin >> n >> s;
  vvi dp(n+1,vi(n+1));

  rrep(i,n) rrep(j,n) {
    if(s[i] == s[j]) dp[i][j] = dp[i+1][j+1] + 1;
  }
  int ans = 0;
  rrep(i,n) rrep(j,n) {
    chmax(ans,min(dp[i][j],abs(i-j)));
  }
  cout << ans << endl;
}


Measured memory_bytes: 98304
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#define FOR(idx, begin, end) for(int idx = (int)(begin); idx < (int)(end); ++idx)

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

using namespace std;
typedef long long lint;

const int MOD = 1000000007, INF = 1111111111;
const double EPS = 1e-9;

int main() {

	cin.tie(0);

	string A, B;
	cin >> A >> B;

	if (A == B) cout << "EQUAL";
	else if (A.length() > B.length()) cout << "GREATER";
	else if (A.length() < B.length()) cout << "LESS";
	else {
		int cnt = 0;

		while (A[cnt] == B[cnt]) {
			cnt++;
		}
		if(A[cnt] > B[cnt]) cout << "GREATER";
		else cout << "LESS";
	}

	return 0;
}

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

#define rep(i, n) for(int i = 0, i_length = (n); i < i_length; i++)
#define MOD 1000000007

int main() {
	int n, m;
	cin >> n >> m;
	multiset<int> a;
	rep(i, n) {
		int x;
		cin >> x;
		a.insert(x);
	}

	long long ans = 0;

	rep(i, m) {
		auto itr = --a.end();
		int x = *itr;
		a.erase(itr);
		x /= 2;
		a.insert(x);
	}

	for (auto itr = a.begin(); itr != a.end(); itr++) ans += *itr;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  char c = 'a';
  for(int i=0;i<s.size();i++){
  	if(s[i] < c) continue;
  	if(s[i] == c) c++;
    if(s[i] > c) break;
  }
  if(c == 'z'+1) cout << "None" << endl;
  else cout << c << endl;
}

Measured memory_bytes: 512
import java.util.*

/**
 * Created by niyaz on 07.06.17.
 */

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt() * 2
    val a = IntArray(n, { sc.nextInt() })
    a.sortDescending()
    println((1..n - 1 step 2).map { a[it] }.sum())
}


Measured memory_bytes: 35964