akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

namespace AtCoder {
    class Program {
        static void Main(string[] args) {

            var s = Console.ReadLine();
            bool isMatch = Regex.IsMatch(s, @"^A[a-z]+C[a-z]+$");
            Console.WriteLine(isMatch ? "AC" : "WA");

        }
    }
}

Measured memory_bytes: 15948
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;


public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    final double h = scanner.nextDouble();
    final double a = scanner.nextDouble();

    System.out.println((int) Math.ceil(h/a));
  }
}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    llint n, m, k;
    cin >> n >> m >> k;

    vector<llint> asum(n+1);
    vector<llint> bsum(m+1);
    llint atmp, btmp;
    for(int in=0;in<n;in++) {
        cin >> atmp;
        asum.at(in+1) = asum.at(in) + atmp;
    }
    for(int im=0;im<m;im++) {
        cin >> btmp;
        bsum.at(im+1) = bsum.at(im) + btmp;
    }

    llint ans = 0, anstmp;
    for(llint in=0;in<=n;in++) {
        if(k-asum.at(in)<0) continue;
        vector<llint>::iterator im = upper_bound(bsum.begin(), bsum.end(), k-asum.at(in));
        anstmp = in + im - bsum.begin() - 1LL; // max unused?
        if(ans<anstmp) ans = anstmp;
        // cout << im - bsum.begin() - 1LL << endl;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6432
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#include<stdio.h>
#include<functional>
#include<queue>

using ll = long long;

using namespace std;

ll mod = 1000000007;

ll n_pow(ll a, ll n) {
	if (n == 0)return 1;
	ll t = n_pow(a, n / 2);
	t *= t;
	t %= mod;
	if (n % 2 == 1)t *= a;
	return t % mod;
}

const int INF = 1001001001;


int main() {
	int n;
	cin >> n;
	vector<vector<ll>>task(n, vector<ll>(3));
	for (int i = 0; i < n; i++) {
		cin >> task[i][0] >> task[i][1] >> task[i][2];
	}
	vector<vector<ll>>  dp(n + 1, vector<ll>(3));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				if (j == k)continue;
				if (dp[i + 1][j] < dp[i][k] + task[i][j]) {
					dp[i + 1][j] = dp[i][k] + task[i][j];
				}
			}
		}
	}
	auto ans = max_element(dp[n].begin(),dp[n].end());
	cout << *ans << endl;
	return 0;
}

Measured memory_bytes: 11136
# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < int > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vll vector < ll >
# define pii pair < int , int >
//# pragma GCC target ("sse4")
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    string s;
    fi>>s;
    for (int i = 0;i < 4;++i)
        fo << s[0],s.erase(s.begin());
    fo << ' ' << s << '\n';
    return 0;
}

Measured memory_bytes: 256
s=input()
t=input()
dp=[[0]*(len(t)+1) for i in range(len(s)+1)]

for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        if s[i-1]==t[j-1]:
            dp[i][j]=dp[i-1][j-1]+1

        else:
            dp[i][j]=max(dp[i-1][j],dp[i][j-1])
    # print(dp[i])
ans=''
i,j=len(s),len(t)
while i > 0 and j > 0:
  if s[i-1]==t[j-1]:
    ans=s[i-1]+ans
    i=i-1
    j=j-1
  else:
    if dp[i-1][j]>dp[i][j-1]:
      i-=1
    else:
      j-=1
print(ans)


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

typedef long double ld;
typedef long long ll;

const int Maxn = 55;

int n;
int X[Maxn], Y[Maxn];
ld res = 1e100l;

void getLine(int x1, int y1, int x2, int y2, int &A, int &B, int &C)
{
    A = y2 - y1;
    B = x1 - x2;
    C = A * x1 + B * y1;
}

ld getMax(ld x, ld y)
{
    ld res = 0;
    for (int i = 0; i < n; i++)
        res = max(res, sqrt(ld(x - X[i]) * (x - X[i]) + ld(y - Y[i]) * (y - Y[i])));
    return res;
}

ld Check2(int a, int b)
{
    return getMax((X[a] + X[b]) / 2.0l, (Y[a] + Y[b]) / 2.0l);
}

ld Check3(int a, int b, int c)
{
    int A1, B1, C1; getLine(X[a], Y[a], X[b], Y[b], A1, B1, C1);
    int A2, B2, C2; getLine(X[b], Y[b], X[c], Y[c], A2, B2, C2);
    swap(A1, B1); A1 = -A1;
    C1 = (X[a] + X[b]) / 2 * A1 + (Y[a] + Y[b]) / 2 * B1;
    swap(A2, B2); A2 = -A2;
    C2 = (X[b] + X[c]) / 2 * A2 + (Y[b] + Y[c]) / 2 * B2;
    ll det = ll(A1) * B2 - ll(A2) * B1;
    if (det == 0) return 1e100l;
    ld x = (ld(B2) * C1 - ld(B1) * C2) / ld(det);
    ld y = (ld(A1) * C2 - ld(A2) * C1) / ld(det);
    return getMax(x, y);
}

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d %d", &X[i], &Y[i]);
        X[i] *= 2; Y[i] *= 2;
    }
    for (int i = 0; i < n; i++)
        for (int j = i + 1; j < n; j++) {
            res = min(res, Check2(i, j));
            for (int k = j + 1; k < n; k++)
                res = min(res, Check3(i, j, k));
        }
    cout << fixed << setprecision(9) << res / 2 << endl;
    return 0;
}


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

#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for ( int i = 0 ; i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1e18+1;

signed main() {
	int a, b, c;
	int x, y;

	cin >> a >> b >> c;
	cin >> x >> y;

	int ans = INF;
	for ( int i = 0; i <= 200000; i+=2 ) {
		ans = min(ans, c*i + max(0LL, x-i/2)*a + max(0LL, y-i/2)*b);
	}

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


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){

			int N = scan.nextInt();
			int[] L = new int[N];
			Map<Integer,Integer>map = new TreeMap<Integer,Integer>();
			for(int i = 0;i<N;i++) {
				L[i] = scan.nextInt();
				if(map.containsKey(L[i])) {
					map.put(L[i], map.get(L[i])+1);
				}else {
					map.put(L[i],1);
				}
			}

			if(2>=N) {
				System.out.println(0);
				return;
			}

			ArrayList<Integer> are = new ArrayList<Integer>();


			for(Integer key:map.keySet()) {
				are.add(key);
				//System.out.println(key);
			}

			int count = 0;
			for(int i = 0;i<are.size()-2;i++) {
				for(int j = i+1;j<are.size()-1;j++) {
					for(int z = j+1;z<are.size();z++) {
						int a = are.get(i);
						int b = are.get(j);
						int c = are.get(z);

						if(Math.abs(b-c)<a&&a<b+c) {
							int co=1;
							if(map.get(a)>=2)co*=map.get(a);
							if(map.get(b)>=2)co*=map.get(b);
							if(map.get(c)>=2)co*=map.get(c);
							count+=co;
							}
					}
				}
			}


			System.out.println(count);













		}


	}


}


Measured memory_bytes: 46688
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<numeric>
#include<deque>
using namespace std;
typedef long long ll;
ll qpmod(ll a, ll n, ll MOD)
{
	ll ret = 1;
	while (n)
	{
		if (n & 1)
			ret = (ret * a) % MOD;
		a = (a * a) % MOD;
		n >>= 1;
	}
	return ret;
}
ll C(ll n, ll m, ll MOD)
{
	if (m > n)
		return 0;
	if (m > n - m)
		m = n - m;
	ll a = 1, b = 1;
	while (m)
	{
		a = (a * n) % MOD;
		b = (b * m) % MOD;
		m--;
		n--;
	}
	return a * qpmod(b, MOD - 2, MOD) % MOD;
}
ll Lucas(ll n, ll k, ll MOD)
{
	if (k == 0)
		return 1;
	return C(n % MOD, k % MOD, MOD) * Lucas(n / MOD, k / MOD, MOD) % MOD;
}
int main()
{
	ll n, a, b;
	ll M = 1e9 + 7;
	cin >> n >> a >> b;
	ll ans=(qpmod(2, n, M) - 1 + M - Lucas(n, a, M) + M - Lucas(n, b, M) + M) % M;
	cout << ans << endl;
}

Measured memory_bytes: 256
line = gets
line.chomp!

/(\d+)\/(\d+)\/(\d+)/ =~ line
y = $1.to_i             
m = $2.to_i
d = $3.to_i

if (y < 2019) then
  print "Heisei"
elsif (y == 2019) then
  if (m < 4) then
    print "Heisei"
  elsif (m == 4) then
    if (d <= 30) then
      print "Heisei"
    else
      print "TBD"
    end
  else
    print "TBD"
  end
else
  print "TBD"
end


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

using namespace std;
typedef long long ll;
long long mod = 1000000007;
const int INF = 100100100;

int main(){
  ll a,b;
  cin >> a >> b;
  if(a>b) swap(a,b);
  ll c = __gcd(a,b);
  cout << a * b / c << endl;
} 

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

using namespace std;

int main() {
    vector<int> cnt(100001, 0);
    vector<int> primes;
    primes.push_back(2);
    for(int n=3; n<=100000; n++) {
        cnt[n] += cnt[n-1];
        if(n%2==0) continue;
        
        bool flag=true;
        for(int i=0; i<primes.size(); i++) {
            if(primes[i]*primes[i]>n) break;
            if(n%primes[i]==0) {
                flag=false;
                break;
            }
        }
        if(flag) {
            primes.push_back(n);
            
            bool ff=true;
            for(int i=0; i<primes.size(); i++) {
                if(primes[i]*primes[i]>(n+1)/2) break;
                if(((n+1)/2)%primes[i]==0) {
                    flag=false;
                    break;
                }
            }
            if(flag) {
                cnt[n]++;
            }
        }
        
    }
    
    int Q;
    cin >> Q;
    for(int q=0; q<Q; q++) {
        int l, r;
        cin >> l >> r;
        l--;
        cout << cnt[r]-cnt[l] << endl;
    }



    return 0;
    
}

Measured memory_bytes: 1152
N = int(input())
h = [int(n) for n in input().split()]


cost = [0] * (N+1)

for i in range(N):
    if i == 0:
        cost[i] = 0
    elif i == 1:
        cost[i] = abs(h[i] - h[i-1])

    if i >= 2:
        cost[i] = min(cost[i-1] + abs(h[i] - h[i-1]), cost[i-2] + abs(h[i] - h[i-2]))

print(cost[N-1])

Measured memory_bytes: 13928
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define CLR(array) memset( array, 0, sizeof array )
typedef long long int ll;

int main(){
	int h,a;

	std::cin >> h >> a;

	if( h % a == 0 )
		printf("%d\n", h/a );
	else
		printf("%d\n", h/a+1 );
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a, b, i,c[7];
	for (i = 0; i < 7; i++) {
		scanf("%d %d", &a, &b);
		c[i]=a-b;
	}
	for(i=0;i<7;i++){
		printf("%d\n",c[i]);
	}
	return 0;
}

Measured memory_bytes: 600
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#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;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MAXN = 200005;
int n,subs[MAXN],p2[MAXN],p[MAXN];
vi adj[MAXN];

int modpow(int x, int n, int m) {
    if (n == 0) return 1%m;
    long long u = modpow(x,n/2,m);
    u = (u*u)%m;
    if (n%2 == 1) u = (u*x)%m;
    return u;
}

void dfs(int s, int pre ){
  subs[s]=1;
  p[s]=pre;
  for(auto t:adj[s]){
    if(t!=pre){
      dfs(t, s);
      subs[s]+=subs[t];
    }
  }
}

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
        
    cin >> n;
    p2[0]=1;
    for(int i=1;i<=n;i++)p2[i]=p2[i-1]*2%mod;
    for(int i=1;i<n;i++){
      int x,y;
      cin >> x >> y;
      adj[x].pb(y);
      adj[y].pb(x);
    }
    dfs(1,-1);
    int ans = 0;
    for(int i=1;i<=n;i++){
      int sum = 0;
      int cur = (p2[n-1]-1+mod)%mod;
      for(auto t:adj[i]){
        if(t==p[i])continue;
        cur = (cur - ( p2[subs[t]]-1+mod)+2*mod)%mod;
        sum+=subs[t];
      }
      sum = n-sum-1;
      cur = ( cur - (p2[sum]-1+mod) + 2*mod )%mod;
      // cout << cur << endl;
      ans = (ans+cur)%mod;
    }
    // cout<<ans<<endl;
    ans = ans*modpow(p2[n],mod-2,mod)%mod;
    cout<<ans<<endl;


return 0;
}
///....


Measured memory_bytes: 22912
#include <iostream>
#include <vector>
#include <map>
#include <queue>

using namespace std;
using pii = pair<int,int>;
using ll = long long;

const int MAX = 2e5+10;
const int INFTY = 2e9;
vector<pii> G[MAX*3];
map<pii, int> ids;
int id = 0;
int P[MAX], Q[MAX], C[MAX];

int getId(int x, int c){
    pii p(x,c);
    if(ids.find(p) != ids.end()) return ids[p];
    return ids[p] = id++;
}

void addEdge(int p, int q, int c){
    int u = getId(p, c);
    int v = getId(q, c);
    G[u].emplace_back(make_pair(v,0));
    G[v].emplace_back(make_pair(u,0));
}

int main(){
    int N,M; cin >> N >> M;
    for(int i=0;i<M;i++){
        cin >> P[i] >> Q[i] >> C[i];
        P[i]--; Q[i]--;
        addEdge(P[i],Q[i],C[i]);
    }

    for(int i=0;i<M;i++){
        int u = getId(P[i], C[i]);
        int v = getId(Q[i], C[i]);
        G[u].emplace_back(make_pair(id + P[i], 1));
        G[v].emplace_back(make_pair(id + Q[i], 1));
        G[id + P[i]].emplace_back(make_pair(u, 1));
        G[id + Q[i]].emplace_back(make_pair(v, 1));
    }

    vector<int> dist(id + N, INFTY);
    dist[id] = 0;

    priority_queue<pii, vector<pii>, greater<pii> > Q;
    Q.push(make_pair(dist[id], id));

    while(!Q.empty()){
        auto p = Q.top(); Q.pop();
        int u = p.second;
        int cost_u = p.first;
        if(cost_u > dist[u]) continue;

        for(auto v : G[u]){
            if(dist[v.first] > dist[u] + v.second){
                dist[v.first] = dist[u] + v.second;
                Q.push(make_pair(dist[v.first], v.first));
            }
        }
    }

    int ans = dist[id + N -1];
    if(ans == INFTY) cout << -1 << endl;
    else             cout << ans/2 << endl;
    return 0;
}

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


int main(){
   int N,H,W;
   cin>>N>>H>>W;
   vector<int>A(N);
   vector<int>B(N);
   int count=0;
   rep(i,N){
       cin>>A[i]>>B[i];
       if(H<=A[i]&&W<=B[i]){
           count++;
       }
   }
   cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define inf1 INT_MAX
#define inf2 LLONG_MAX
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define sbit __builtin_popcount
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define rit(it,x) for(auto it=x.begin();it!=x.end();it++)
#define cases(t) int t; cin>>t; rep(casn,1,t+1)
#define fill(a,b) memset(a,b,sizeof(a))
#define dbg(x) cerr<<#x<<" "<<x<<endl;
#define dbga(arr,n) cerr<<#arr<<": "; rep(tt,0,n)cerr<<arr[tt]<<" "; cerr<<endl;
#define infile ifstream fin; fin.open("input.txt")
#define outfile ofstream fout; fout.open("output.txt")
#define vec vector<int>
#define pii pair<int,int>
#define plii pair<ll,int>
#define pll pair<ll,ll>
#define p_queue priority_queue< plii,vector< plii >,greater< plii > > 
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define sp(x) setprecision(x)
#define si(x) scanf("%d",&x)
#define sc(x) scanf("%c",&x)
#define sl(x) scanf("%lld",&x)
#define sst(x) scanf("%s",x)
#define pl(x) printf("%lld\n",x)
#define pi(x) printf("%d\n",x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

inline ll binex(ll a,ll b)
{
    ll ans=1,temp=a%mod;
    while(b!=0){
        if(b&1) ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b=b>>1;
    }
    return ans;
}

inline ll solve(int n,ll w,ll val[],ll wt[])
{
    ll dp[w+1][n];
    rep(i,0,n) dp[0][i]=0;
    rep(i,0,w+1){
        if(wt[0]<=i) dp[i][0]=val[0];
        else dp[i][0]=0;
    }
    rep(i,1,w+1){
        rep(j,1,n){
            if(i>=wt[j]) dp[i][j]=max(val[j]+dp[i-wt[j]][j-1],dp[i][j-1]);
            else dp[i][j]=dp[i][j-1];
        }
    }
    
    /*rep(i,0,w+1){
        rep(j,0,n) cerr<<dp[i][j]<<" "; cerr<<endl;
    }*/
    
    return dp[w][n-1];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n; ll w; cin>>n>>w;
    ll val[n],wt[n];
    rep(i,0,n) cin>>wt[i]>>val[i];
    cout<<solve(n,w,val,wt)<<endl;
}

Measured memory_bytes: 78336
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e18;
const int MAX=3000;

signed main(){
    char a,b;cin>>a>>b;
    if((a=='H'&&b=='H')||(a=='D'&&b=='D'))cout<<"H"<<endl;
    else cout<<"D"<<endl;
}

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

#define rep(i, N) for (ll i = 0; i < N; i++)
#define rep1(i, N) for (ll i = 1; i <= N; i++)
#define MOD (int)1e9+7;

using ll = long long;
using namespace std;

int main() {
    int N,Y;
    cin >> N >> Y;
    int x = N, y = 0, z = 0;
    if(Y > 10000*N || Y < 1000*N) {
        printf("-1 -1 -1\n");
        return 0;
    }

    bool flag = false;
    rep(i, N+1) {
        for(int j = i; j < N+1 ; j++) {
            x = N - j;
            y = j - i;
            z = i;
            if(10000*x+5000*y+1000*z == Y) {
                flag = true;
                break;
            }
        }
        if(flag) break;
    }
    
    if(!flag) {
        x = -1; y = -1; z = -1;
    }
    printf("%d %d %d\n",x,y,z);
    return 0;
}


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

int main() {
  int h, w; cin >> h >> w;
  string a[h];
  for (int i = 0; i < h; i++) cin >> a[i];
  for (int i = 0; i < w+2; i++) cout << '#';
  cout << endl;
  for (int i = 0; i < h; i++) cout << '#' << a[i] << '#' << endl;
  for (int i = 0; i < w+2; i++) cout << '#';
  cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define INF (1 << 29)
# define MAX_N 1000010
/* ACはうれCすぎてうれD */

int main(void){ 
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    for(int i=0; i<10; i++){
        for(int j=0; j<10; j++){
            for(int k=0; k<10; k++){
                int le = 0, mi = 0, ri = 0;
                for(int ch=0; ch < s.length(); ch++){
                    if(le == 0 && s[ch]-'0' == i && ri == 0){
                        le = 1;
                    }
                    else if(le == 1 && mi == 0 && s[ch]-'0' == j && ri == 0){
                        mi = 1;
                    }
                    else if(mi == 1 && ri == 0 && s[ch]-'0' == k){
                        ans += 1;
                        ri = 1;
                    }
                }
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int dp[50][50];
int main(){
	int h,w;
	char z;
	cin>>h>>w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>z;
			dp[i][j]=z-'0';
		}
	}
	for(int i=1;i<h;i++)dp[i][0]+=dp[i-1][0];
	for(int j=1;j<w;j++)dp[0][j]+=dp[0][j-1];
	for(int i=1;i<h;i++)for(int j=1;j<w;j++)dp[i][j]+=min(dp[i-1][j],dp[i][j-1]);
	cout<<dp[h-1][w-1]<<endl;
	return 0;
}

Measured memory_bytes: 1172
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

class Solver {
    public:
        int r, n;
        int xl[20], xr[20], h[20];
        double solve() {
            int hl[41], hr[41];
            int delta = 20;
            double time_min = 100;
            for (int i = -20; i <= 20; ++i) {
                hl[i + delta] = hr[i + delta] = 0;
            }
            for (int i = 0; i < n; ++i) {
                for (int x = xl[i]; x < xr[i]; ++x) {
                    hr[x + delta] = max(hr[x + delta], h[i]);
                }
                for (int x = xl[i] + 1; x <= xr[i]; ++x) {
                    hl[x + delta] = max(hl[x + delta], h[i]);
                }
            }
            for (int x = -r + 1; x < r; ++x) {
                time_min = min(time_min, min(hl[x + delta], hr[x + delta]) + r - sqrt(r * r - x * x));
            }
            return time_min;
        }
};

int main() {
    Solver s;
    while (true) {
        cin >> s.r >> s.n;
        if (s.r == 0) {
            return 0;
        }
        for (int i = 0; i < s.n; ++i) {
            cin >> s.xl[i] >> s.xr[i] >> s.h[i];
        }
        cout.precision(128);
        cout << fixed << s.solve() << endl;
    }
}

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

//C++14 (GCC 5.4.1)

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

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

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

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

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

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

    priority_queue<ll> A;
    ll x;
    rep(i,N){
        cin >> x;
        A.push(x);
    }
    rep(i,M){
        x=A.top();
        A.push(x/2);
        A.pop();
    }
    ll ans=0;
    rep(i,N){
        ans+=A.top();
        A.pop();
    }
    cout << ans <<endl;
    return (0);
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
typedef long long ll;
#define iof ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pi 3.1415926535897
const ll mod =1000000007;
#define inf 100000
using namespace std;

int main()
{
   ll a,b; cin>>a>>b;
   if((a+b)&1)
   {
       cout<<"IMPOSSIBLE";
       return 0;
   }
   ll x=(a+b)/2;
   if((x>a and x<=b) or (x<=a and x>b))
      {
          cout<<x;
      }
      else
        {
            cout<<"IMOSSIBLE"<<endl;
        }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int a;
    cin >> a;
    if(a == 7 || a == 5 || a == 3){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define endl '\n'
#define MOD 1000000007
#define MOD2 998244353

using namespace std;
typedef long long int ll;

ll dp[3010][3010];
ll a[100010][2];
string s, t, ans;
int n;

ll lcs(int i, int j)
{
	ll &ret = dp[i][j];
	if (ret != -1) return ret;

	if (i == 0 or j == 0) ret = 0;
	else if (s[i-1] == t[j-1]) ret = 1 + lcs(i-1, j-1);
	else ret = max(lcs(i-1, j), lcs(i, j-1));
	return ret;
}

void build(int i, int j)
{
	if (i == 0 or j == 0) return;
	if (s[i-1] == t[j-1])
	{
		build(i-1, j-1);
		ans += s[i-1];
	}
	else
	{
		if (lcs(i-1, j) > lcs(i, j-1)) build(i-1, j);
		else build(i, j-1);
	}
}

int main(void)
{
	fast;
	#ifndef ONLINE_JUDGE
	// freopen("in", "r", stdin);
	// freopen("out", "w", stdout);
	#endif

	cin >> s >> t;
	memset(dp, -1, sizeof dp);
	lcs(s.size(), t.size());
	build(s.size(), t.size());
	cout << ans;
}

Measured memory_bytes: 71424
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,K;
  cin >> n >> K;
  vector<int> V(n);
  vector<vector<int>> subV(n,vector<int>());
  for(int i = 0;i < n;i++){
    cin >> V[i]; 
  }
  int max = 0;
  for(int i = 0;i <= K && i <= n;i++){
    for(int j = 0;j <= K-i && j <= n-i;j++){
      vector<int> va;
      int vasum = 0;
      for(int k = 0;k < i;k++){
        va.push_back(V[k]);
        vasum += V[k];
      }
      for(int k = 0;k < j;k++){
        va.push_back(V[n-1-k]);
        vasum += V[n-1-k];
      }
      sort(va.begin(),va.end());
      for(int k = 0;k < K-i-j && k < va.size();k++){
        if(va[k] < 0)vasum -= va[k];
        else break;
      }
      if(vasum > max)max = vasum;
    }
  }
  cout << max << endl;
  cin >> n;
}

Measured memory_bytes: 256
def main():
    D, G = map(int, input().split())
    P = [0] * (D+1)
    C = [0] * (D+1)
    for i in range(1, D+1):
        P[i], C[i] = map(int, input().split())
    dp = [(0, [0]*(D+1))] * (sum(P) + 1)
    dp[0] = (0, P)
    for i in range(sum(P) + 1):
        score, remain = dp[i]
        for prob in range(1, D+1):
            for j in range(1, remain[prob]+1):
                next_score = score + prob * j * 100
                if j == remain[prob]:
                    next_score += C[prob]
                if dp[i+j][0] < next_score:
                    next_remain = [x for x in remain]
                    next_remain[prob] -= j
                    dp[i+j] = (next_score, next_remain)
    for i in range(len(dp)):
        if dp[i][0] >= G:
            print(i)
            break


if __name__ == "__main__":
    main()


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

int main() {
	int N; cin >> N;
	int F[11][110], P[12][110];
	for(int i=0; i<N; ++i) for(int j=0; j<10; ++j) cin >> F[j][i];
	for(int i=0; i<N; ++i) for(int j=0; j<11; ++j) cin >> P[j][i];
	int T, a[10], ans=-1000000001, forp, comp;
	for(int i=1; i<1024; ++i){
	    T=i;
	    for(int j=0; j<10; ++j){
	        a[j]=T%2;
	        T /= 2;
	    }
	    comp=0;
	    for(int j=0; j<N; ++j){
	        forp=0;
	        for(int k=0; k<10; ++k) forp += F[k][j]*a[k];
	        comp += P[forp][j];
	    }
	    ans=max(comp, ans);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>

int main() {
    int x,y;
    for(int i = 1; i <= 3000; i++){
        scanf("%d %d",&x,&y);
        if(x == 0 && y == 0){
            break;
        }
        if(x >= y){
            printf("%d %d\n",y,x);
        }
        else{
            printf("%d %d\n",x,y);
        }
    }
return 0;
}


Measured memory_bytes: 2552
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define VIZ {printf("digraph G{\n"); for(int i=1;i<=n;i++) for es(i,e) printf("%d->%d;\n",i,vb[e]); puts("}");}
#ifdef LOCAL
#define TIMER cerr<<clock()<<"ms\n"
#else
#define TIMER
#endif
#define SZ 666666
int n;
int main()
{
	ld p,l;
	scanf("%d%lf%lf",&n,&l,&p);
	ld a=l-p,ans=0;
	while(n)
	{
		ans+=a+p*(n+n+1)/2;
		ld aa=a+a/n+(p+p+p)/(n+n),pp=p+(p+p)/n;
		a=aa; p=pp; --n;
	}
	printf("%.15lf\n",ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    //cout<<"bismillahhir rahmanir rahim"<<endl;
    long long int n;
    cin>>n;
    int a[n];
    a[0] = 0;
    for(int i=1; i<n; i++){
        a[i] = 0;
        int x;
        cin>>x;
        a[x-1] += 1;
    }
    for(int i=0; i<n; i++)
        cout<<a[i]<<"\n";

    return 0;
}

Measured memory_bytes: 4372
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1111111111;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, X, Y;
	cin >> N >> X >> Y;
	X--, Y--;

	vector<int> ans(N - 1);
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			int ix = abs(i - X), iy = abs(i - Y);
			int jx = abs(j - X), jy = abs(j - Y);
			ans[min({ abs(i - j), ix + jy + 1, iy + jx + 1 }) - 1]++;
		}
	}

	cout << ans << "\n";

	return 0;
}


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

#define ALL(a) (a).begin(), (a).end()
#define llong long long

using namespace std;
using PI = pair<int,int>;
const int INF = (int)1e9;

string str;

/*
 * formula 	= expr
 * expr 	= factor
 * 			| expr "|" factor
 * factor	= term
 * 			| factor "&" term
 * term		= "(" expr ")" 
 * 			| "?"
 */
PI factor(int &i);
PI term(int &i);

PI expr(int &i){
	PI ret(0,INF);

	while(i < str.size() && str[i] != ')'){
		auto tmp = factor(i);
		ret = PI(ret.first + tmp.first, min(ret.second, ret.first + tmp.second));
		if(str[i] == '|')i++;
	}
	//
	return ret;
	//
}

PI factor(int &i){
	PI ret(INF,0);

	while(i < str.size() && str[i] != ')' && str[i] != '|'){
		auto tmp = term(i);
		ret = PI(min(ret.first, ret.second + tmp.first), tmp.second + ret.second);
		if(str[i] == '&')i++;
	}
	//
	return ret;
}

PI term(int &i){
	if(str[i] == '?'){
		i++;
		return PI(1,1);
	}
	if(str[i] == '('){
		auto ret = expr(++i);
		assert(str[i] == ')');
		i++;
		return ret;
	}
	assert(0);
	return PI(-1,-1);
}

signed main(){
	cin >> str;
	int i = 0;
	auto tmp = expr(i);
	cout << tmp.first << " " << tmp.second << endl;

	return 0;
}




Measured memory_bytes: 3336
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int M=stdIn.nextInt();
		int a[]=new int[N+1];
		long dp[]=new long[N+3];
		int z=0;
		while(z<M){
			int b=stdIn.nextInt();
			a[b]=-1;
			z++;
		}z=3;
		dp[2]=1;
		while(z<=N+2){
			if(a[z-2]!=-1)
				dp[z]=(dp[z-1]+dp[z-2])%1000000007;
			else
				dp[z]=0;
			z++;
		}z=3;
		System.out.println(dp[N+2]);
	}
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

int a, b, x;

void solve() {
   while (b > 0) {
      if (a >= x) break;
      b--;
      a++;
   }

   if (a == x) {
      puts("YES");
   } else {
      puts("NO");
   }
}

int main() {
   cin >> a >> b >> x;

   if (a <= x && x - a <= b) {
      puts("YES");
   } else {
      puts("NO");
   }

   return 0;
}

Measured memory_bytes: 256
n = gets.to_i

a = [1]

[6,9].each do |m|
  u = 1
  while u * m <= n do
    u *= m
    a << u
  end
end

a.sort!.reverse!

dp = Array.new(n+1, 0)

1.upto(n) do |i|
  b = a.bsearch_index {|x| x <= i}
  min = 10**9
  b.upto(a.length-1) do |j|
    tmp = dp[i-a[j]]
    min = tmp if tmp < min
  end

  dp[i] = min + 1
end
puts dp[n]


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

int main() {
    int N, i, tmp;
    cin >> N;
    vector<int> A(N, 0);
    for(i=1; i<N; i++) {
        cin >> tmp;
        A[tmp-1]++;
    }
    for(i=0; i<N; i++){
        cout << A[i] << "\n";
    }
}

Measured memory_bytes: 4048
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
int main()
{
    int n;cin>>n;
    set<int>s;int tem;
    int s1=-1,s2=-1,s3=-1;
    int c1=1,c2=1,c3=1;
    REP(i,n){
        int fo=s.size();
        cin>>tem;s.insert(tem);
        if(s.size()>3){cout<<"No"<<endl;return 0;}
        if(fo==s.size())
        {   
            if(tem==s1)c1++;
            if(tem==s2)c2++;
            if(tem==s3)c3++;
        }else
        {
            if(s.size()==1)s1=tem;
            if(s.size()==2)s2=tem;
            if(s.size()==3)s3=tem;
        }
    }
    if(s.size()==3&&s1!=0&&s2!=0&&s3!=0){
        if(c1==c2&&c2==c3){
        bitset<100>bs1=s1;
        bitset<100>bs2=s2;
        bitset<100>bs3=s3;
        bitset<100>temp=bs1^bs2^bs3;
        if(temp==0){cout<<"Yes"<<endl;return 0;}
        }
    }
    else if(s.size()==2)
    {
        if(s1==0||s2==0)
        {
            if(s1==0&&c1*2==c2){cout<<"Yes"<<endl;return 0;}
            if(s2==0&&c2*2==c1){cout<<"Yes"<<endl;return 0;}
        }
    }
    else if(s.size()==1)
    {
        if(s1==0){ cout<<"Yes"<<endl;return 0;}
    }
    cout<<"No"<<endl;return 0;
}

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

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for(int i = 0; i < n; i++)
        cin >> h[i];

    vector<int> dp(n, 1e9);
    dp[0] = 0;
    for(int i = 0; i < n; i++)
    {
        for(int j = i + 1; j <= min(i + k, n - 1); j++)
            dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
    }

    cout << dp[n - 1];

    return 0;
}


Measured memory_bytes: 1152
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const ll MOD = 1E+09 + 7;
const ll INF = 1E18;
const int MAX_N = 1E+05;

string sd, t;

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

    cin >> sd >> t;
    bool restore = false;
    int pos = 0;

    for (int i = sd.size() - 1; i >= 0; i--) {
        if (sd[i] == t[t.size() - 1] || sd[i] == '?') {
            bool make = true;
            for (int j = 0; j < t.size(); j++) {
                if (sd[i - j] != '?' && sd[i - j] != t[t.size() - j - 1]) {
                    make = false;
                    break;
                }
            }
            if (make) {
                restore = true;
                pos = i - t.size() + 1;
                break;
            }
        }
    }

    if (restore) {
        string s(sd.size(), 'a');
        for (int i = 0; i < sd.size();) {
            if (i != pos) {
                if (sd[i] == '?') {
                    s[i] = 'a';
                } else {
                    s[i] = sd[i];
                }
                i++;
            } else {
                for (int j = 0; j < t.size(); j++) {
                    s[i + j] = t[j];
                }
                i += t.size();
            }
        }
        cout << s << "\n";
    } else {
        cout << "UNRESTORABLE\n";
    }

    /*
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cout << "i = " << i << ", j = " << j << ", dp = " << dp[i][j] << "\n";
        }
    }
    */

    return 0;
}

Measured memory_bytes: 3588
// Aizu Vol0 0001: List of Top 3 Hills
// 2017.7.28

#include <stdio.h>
#include <stdlib.h>

int main()
{
	int n;
	int i, a, b, c;

	a = b = c = 0;
	for (i = 0; i < 10; i++) {
		scanf("%d", &n);
		if (n >= a) c = b, b = a, a = n;
		else if (n >= b) c = b, b = n;
		else if (n > c) c = n;
	}
	printf("%d\n%d\n%d\n", a, b, c);
	return 0;
}

Measured memory_bytes: 600
using System;
using System.Collections.Generic;

namespace program{

	class workspace{

		static void Main(){
			string[] input = (Console.ReadLine().Split());

			//Console.WriteLine("{0}{1}{2}", input[0][0].ToUpper, input[1][0].ToUpper, input[2][0].ToUpper);
			string s = input[0][0].ToString() + input[1][0].ToString() + input[2][0].ToString();
			Console.WriteLine(s.ToUpper());

		}

	}

}

Measured memory_bytes: 11092
#include <vector>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <map>
#include <set>
#include <chrono>
#include <queue>
#include <string>
#include <cassert>
#include <bitset>
#include <stack> 

#define INFLL 2000000000000000000
#define INF 2000000000
#define MOD 998244353
#define BASE 77747
#define PI acos(-1.0)
#define MAXLEN 29

using namespace std;

typedef pair <int, int> pii;
typedef long long ll;
typedef vector <ll> vll;

int n;
ll d, arr[200000];
ll r[200000], l[200000];
ll sl[200000], sr[200000];
int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	scanf("%lld %d", &d, &n);
	
	for (int i = 0; i < n; i++) {
		scanf("%lld", arr + i);
		l[i] = arr[i];
		r[n - 1 - i] = d - arr[i];
	}
	sl[0] = l[0];
	sr[0] = r[0];
	for (int i = 1; i < n; i++) {
		sl[i] = sl[i - 1] + l[i];
	}
	for (int i = 1; i < n; i++) sr[i] += sr[i - 1] + r[i];
	ll ans = -1;
	for (int i = 0; i < n; i++) {
		if ((n - i) % 2 == 0) {
			int ind = (i + n) / 2;
			ll ld = 0;
			if (i == 0) ld = 2 * sl[ind - 1];
			else ld = 2 * (sl[ind - 1] - sl[i - 1]);
			ll rd = 0;
			if (n - 1 - ind - 1 >= 0) rd = 2 * sr[n - 1 - ind - 1];
			ans = max(ans, rd + ld + r[n - 1 - ind]);
		} else {
			int ind = (i + n) / 2;
			ll ld = 0;
			if (i == 0) ld = 2 * sl[ind - 1];
			else ld = 2 * (sl[ind - 1] - sl[i - 1]);
			ll rd = 0;
			if (n - 1 - ind - 1 >= 0) rd = 2 * sr[n - 1 - ind - 1];
			ans = max(ans, rd + ld + l[ind]);
		}
	}
	for (int i = 0; i < n; i++) {

		if ((n - i) % 2 == 0) {
			int ind = (i + n) / 2;
			ll ld = 0;
			if (i == 0) ld = 2 * sr[ind - 1];
			else ld = 2 * (sr[ind - 1] - sr[i - 1]);
			ll rd = 0;
			if (n - 1 - ind - 1 >= 0) rd = 2 * sl[n - 1 - ind - 1];
			ans = max(ans, rd + ld + l[n - 1 - ind]);
		} else {
			int ind = (i + n) / 2;
			ll ld = 0;
			if (i == 0) ld = 2 * sr[ind - 1];
			else ld = 2 * (sr[ind - 1] - sr[i - 1]);
			ll rd = 0;
			if (n - 1 - ind - 1 >= 0) rd = 2 * sl[n - 1 - ind - 1];
			ans = max(ans, rd + ld + r[ind]);
		}
		
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 8064
<?php
    fscanf(STDIN, "%d", $total);
    $input = trim(fgets(STDIN));
    $dominoes = str_split($input);
    $dominoes = array_count_values($dominoes);
    $sequence = array();
    $left = 0;
    foreach ($dominoes as $value) {
        if ($left == 0) { // first
            if ($value == 1) { $colors = 3; }
            else { $colors = 6; }
            $left = $value;
        }
        elseif ($left == 1) { // next to tate
            $colors = $colors * 2;
            $left = $value;
        }
        else { // next to yoko
            if ($value == 2) { $colors = $colors * 3; }
            $left = $value;
        }
    }
    $colors = $colors % 1000000007;
    echo $colors . "\n";
?>


Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repr(i,x,n) for(int i=x; i<(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
typedef long long ll;
using VI = vector<int>;
using VS = vector<string>;
using graph = vector<vector<int>>;
int main()
{
string a,b,c;
cin>>a>>b>>c;
cout<<a.at(0);
cout<<b.at(0);
cout<<c.at(0)<<endl;
    return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  ajo
//
//  Created by Hashimoto Ryo on 2015/06/20.
//  Copyright (c) 2015??´ Hashimoto Ryo. All rights reserved.
//

#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 100;

int bubbleSort(int A[], int N){
    int sw = 0;
    bool flag = 1;
    for(int i = 0;flag;i++){
        flag = 0;
        for(int j = N - 1;j >= i + 1;j--){
            if(A[j] < A[j-1]){
                swap(A[j], A[j-1]) ;
                flag = 1;
                sw++;
            }
        }
    }
    return sw;

}

int main(){

    int A[100],N,sw;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    sw = bubbleSort(A, N);
    
    for(int i = 0;i < N;i++){
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << sw << endl;
    return 0;
}



//
//int main(){
//
//    int n;
//    int a[MAX];
//    int count = 0;
//    
//    //?????¬????????\???
//    cin >> n;
//    for(int i = 0;i < n; i++){
//        cin >> a[i];
//    }
//    
//    //?????¬???????????????
//    for(int i = 0;i < n;i++){
//        
//        int j = n - 1;//?????????????????????????????????
//        while(j > i){
//            if(a[j] < a[j-1]){
//                int temp = a[j];
//                a[j+1] = temp;
//                a[j] = a[j+1];
//                count++;
//            }
//            j--;
//        }
//    }
//    
//    for(int i = 0;i < n-1;i++){
//        cout << a[i] << " ";
//    }
//    cout << a[n-1] << endl;
//    cout << count << endl;
//    
//    return 0;
//}

Measured memory_bytes: 1160
#include <cmath>
#include <iostream>
#include <string>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <algorithm>

#define rep(i, n) for(long long i = 0; i < n; i++)

const int MIN = 200001;
const int MOD = 1000000007;
const long long MAX = 1e15 + 9;

using namespace std;

int main() {
	int n, k;
	long long p;
	long long r = 0;
	vector<long long> v;
	
	cin >> n >> k;
	
	rep(i, n) {
		cin >> p;
		v.push_back(p);
	}
	
	sort(v.begin(), v.end());
	
	while (k > 0 && v.size() > 0) {
		v.pop_back();
		k--;
	}
	
	for (auto &i: v) r += i;
	
	cout << r << endl;
	
	return 0;
}

Measured memory_bytes: 2420
from itertools import accumulate

N = int(input())
a_list = list(map(int, input().split()))

a_acc = [0] + list(accumulate(a_list))

dp = [[0] * (N + 1) for _ in range(N + 1)]

for d in range(2, N + 1):
    for l in range(N + 1 - d):
        r = l + d
        tmp = float("inf")
        for m in range(l+1, r):
            tmp = min(tmp, dp[l][m] + dp[m][r])
        dp[l][r] = tmp + a_acc[r] - a_acc[l]

print(dp[0][N])


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

using namespace std;
typedef long long int ll;

#define debug(val) "[ " << #val " : " << (val)
#define space " "
#define vi vector<int>
#define vl vector<ll>
#define vll vector<vector<ll>>
#define vii vector<vector<int>>
#define PI (double)(atan(1)*4)
#define pb push_back
#define pi pair<int , int >
#define ff first
#define ss second
#define INF 2000000000
#define delta 0.0000000001
vi dx = {-1, 0, 0, 1};
vi dy = {0, -1, 1, 0};
const int Mod = 1000 * 1000 * 1000 + 7;

vll mul_mat(vll a, vll b) {
    vll res(2, vl(2, 0));
    int n = 2;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < 2; k++) {
                res[i][j] += a[i][k] * b[k][j];
                res[i][j] %= Mod;
            }
        }
    }

    return res;
}

ll powmod(ll a, ll b, ll mod) {
    ll res = 1;
    while (b > 0) {
        if (b & 1) {
            res = res * a;
            res %= mod;
        }
        b >>= 1;
        a = a * a;
        a%=mod;
    }
    return res;
}

void solve() {
    ll n;
    cin >> n;
    ll com = 0;
    for (ll i = 0; i <= 2000000; i++) {
        ll f = powmod(2, i, n);
        ll s = powmod(5, i, n);
        ll t = 7;
        com += (f * s * t);
        com %= n ;
        if (com == 0) {
            cout << i + 1 << endl;
            return;
        }
    }
    cout << -1 << endl;
}


int main() {
#ifdef _DEBUG
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0); // FAST IO
    int q = 1;
    //cin >> q;
    for (int i = 1; i <= q; i++) {
        solve();
    }
}

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

int main()
{
	int h, w;
	while(true){
		cin >> h >> w;
		if(h == 0 && w == 0)
			break;
		for(int n = 1; n <= h; n++){
			for(int m = 1; m <= w; m++){
				cout << "#" ;
			}
			cout << endl;
		}
		cout << endl;
	}
}

Measured memory_bytes: 1152