akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<ll> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int MOD2 = MOD + 2; //1007681537;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << " ";
#define endln cerr << "\n";

int main() 
{
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  while(1)
  {
     c-=b;
     if(c<=0)
     {
       cout<<"Yes"<<endl;
       break;
     }
     a-=d;
     if(a<=0)
     {
       cout<<"No"<<endl;
       break;
     }
  }
  return 0;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define oo 2139062143
#define fo(i,x,y) for (ll i=(x);i<=(y);++i)
using namespace std;
typedef long long ll;
const ll N=200200;
ll a[N];
ll n,m,ans;
int main()
{
	// freopen("D:/LiuYuanHao/a.in","r",stdin);
	scanf("%lld",&n);
	fo(i,1,n) scanf("%lld",&a[i]),a[i]-=i;
	sort(a+1,a+1+n);
	if(n&1) m=a[n/2+1];
	else m=(a[n/2]+a[n/2+1])/2;
	fo(i,1,n) ans+=abs(a[i]-m);
	printf("%lld\n",ans);
	return 0;
}













Measured memory_bytes: 1792
s = list(input())
t = list(input())
s_len = len(s)
t_len = len(t)
min_len = min(s_len,t_len)
s.sort()
t.sort(reverse=1)

for i in range(min_len):
    if s[i] < t[i]:
        print("Yes")
        exit()
    elif s[i] > t[i]:
        print("No")
        exit()
if s_len >= t_len:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 38384
R, C, n = map(int, raw_input().split())
x1 = []
y1 = []
x2 = []
y2 = []
for i in xrange(n): 
  xx1, yy1, xx2, yy2 = map(int, raw_input().split())
  x1.append(xx1)
  y1.append(yy1)
  x2.append(xx2)
  y2.append(yy2)

t = []
b = []
l = []
r = []

def add(x, y, i):
  if x == 0:
    t.append((i, y))
  elif x == R:
    b.append((i, y))
  elif y == 0:
    l.append((i, x))
  elif y == C:
    r.append((i, x))


for i in xrange(n):
  add(x1[i], y1[i], i)
  add(x2[i], y2[i], i)

t = sorted(t, key=lambda x : x[1])    
r = sorted(r, key=lambda x : x[1])
b = sorted(b, key=lambda x : x[1], reverse=True)
l = sorted(l, key=lambda x : x[1], reverse=True)

lis = []
lis.extend(t)
lis.extend(r)
lis.extend(b)
lis.extend(l)

lis = map(lambda x : x[0], lis)

cnt = {}
for i in lis:
  if not i in cnt:
    cnt[i] = 0
  cnt[i] += 1

lis = filter(lambda x : cnt[x] == 2, lis)

stk = []
for i in lis:
  if len(stk) == 0 or stk[-1] != i:
    stk.append(i)
  else:
    stk.pop()

if len(stk) == 0:
  print("YES")
else:
  print("NO")


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

int main() {
	int n, d;
	cin >> n >> d;
	int x[n][d];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < d; j++) {
			cin >> x[i][j];
		}
	}

	int ans = 0;
	for (int i = 0; i < n-1; i++) {
		for (int j = i+1; j < n; j++) {
			int lng = 0;
			for (int k = 0; k < d; k++) {
				lng += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
			}
			int sq = (int)(sqrt(lng));
			if (sq*sq == lng) {
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define INF INFINITY 
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define ll long long
# define ln cout<<'\n'
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
 
ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

int factorial(int n)
{
    int x = 1; // 0! = 1

    for (int i = 1; i <= n; ++i)
        x *= i;

    return x;
}

int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}


using namespace std;

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(){
    int N;
    cin >> N;
    int ans = INF;
    rep(i,N+1){
        int six = i;
        int nine = N-i;
        int tmp = 0;

        while(six > 0){
            tmp += six%6;
            six /= 6;
        }
        while(nine > 0){
            tmp += nine%9;
            nine /= 9;
        }
        ans = min(ans,tmp);
    }
    cout << ans << endl;
}

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

int main() {
	int l; cin >> l;
	int64_t a[l]; for(int i = 0; i < l; ++i) cin >> a[i];
	// dp[i][j] := iまで見てDSTUが確定している
	int64_t dp[l + 1][5];
	for(int i = 0; i <= l; ++i) {
		for(int j = 0; j < 5; ++j) {
			dp[i][j] = 1e18;
		}
	}
	for(int j = 0; j < 5; ++j) {
		dp[0][j] = 0;
	}
	for(int i = 1; i <= l; ++i) {
		// null -> null
		dp[i][0] = min(dp[i][0], dp[i - 1][0] + a[i - 1]);
		// null -> D
		dp[i][1] = min(dp[i][1], dp[i - 1][0] + a[i - 1]);
		// null -> D(即時)
		dp[i][1] = min(dp[i][1], dp[i][0]);
		// D -> D
		dp[i][1] = min(dp[i][1], dp[i - 1][1] + (a[i - 1] > 0 ? a[i - 1] % 2 : 2));
		// D -> S
		dp[i][2] = min(dp[i][2], dp[i - 1][1] + (a[i - 1] > 0 ? a[i - 1] % 2 : 2));
		// D -> S(即時)
		dp[i][2] = min(dp[i][2], dp[i][1]);
		// S -> S
		dp[i][2] = min(dp[i][2], dp[i - 1][2] + (a[i - 1] + 1) % 2);
		// S -> T
		dp[i][3] = min(dp[i][3], dp[i - 1][2] + (a[i - 1] + 1) % 2);
		// S -> T(即時)
		dp[i][3] = min(dp[i][3], dp[i][2]);
		// T -> T
		dp[i][3] = min(dp[i][3], dp[i - 1][3] + (a[i - 1] > 0 ? a[i - 1] % 2 : 2));
		// T -> U
		dp[i][4] = min(dp[i][4], dp[i - 1][3] + (a[i - 1] > 0 ? a[i - 1] % 2 : 2));
		// T -> U(即時)
		dp[i][4] = min(dp[i][4], dp[i][3]);
		// U -> U
		dp[i][4] = min(dp[i][4], dp[i - 1][4] + a[i - 1]);
	}
	cout << dp[l][4] << '\n';
	return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
int main(){
    long N;
    cin >> N;
    long ans[N];
    for(int i = 0; i< N; i++){
        cin >> ans[i];
    }
    long maxv = -9999999999;
    long minv = ans[0];
    for(int j = 1; j<N;j++){
        maxv = max(maxv,ans[j]-minv);
        minv = min(minv, ans[j]);
    }
    cout << maxv << endl;
}


Measured memory_bytes: 4652
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include<string>
#include<array>
using namespace std;

int main(){
    int x,y,a,b,c;
    cin >> x >> y >> a >> b >> c;
    long long p[a];
    long long q[b];
    long long r[c];
    for (int i = 0; i < a ; i ++)   cin >> p[i];
    for (int i = 0; i < b ; i ++)   cin >> q[i];
    for (int i = 0; i < c ; i ++)   cin >> r[i];
    sort(p,p + a, greater<long long>());
    sort(q,q + b, greater<long long>());
    sort(r,r + c, greater<long long>());
    long long final[x + y + c];
    for (int i = 0; i < x; i ++){
        final[i] = p[i];
    }
    for (int j = 0; j < y; j ++){
        final[x + j] = q[j];
    }
    for (int l = 0 ; l < c; l++){
        final[x + y + l] = r[l];
    }
    sort(final,final + x + y + c, greater<long long>());
    long long ans = 0;
    for (int i = 0; i < x + y; i ++){
        ans += final[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4736
require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N, K = get_ints

amari =  N % K
amari_minus_k = (amari - K).abs

puts [amari, amari_minus_k].min


Measured memory_bytes: 14456
#include<bits/stdc++.h>
using namespace std;
int n,a[100005],num; 
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+1+n);
	num=a[n/2+1]-a[n/2];
	cout<<num;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
string s;
int main(){
	cin>>s;
	for (int i=1;i<=2;++i){
		if (s[i-1]==s[i] && s[i]==s[i+1]){
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
bool prime[10001];
int res[10001];
vector<int> pid;
int main(void){
	memset(prime,true,sizeof(prime));
	prime[0]=prime[1]=false;
	for(int i=2;i<=10000;i++){
		if(prime[i]){
			pid.push_back(i);
			for(int j=i*2;j<=10000;j+=i)prime[j]=false;
		}
	}
	pid.push_back(10001);
	for(int n=1;n<=10000;n++){
		for(int i=0;pid[i]<=n;i++){
			if(prime[pid[i]] && prime[n-pid[i]+1])res[n]++;
		}
	}
	int n;
	while(~scanf("%d",&n)){
		int cnt=0;
		printf("%d\n",res[n]);
	}
	return 0;
}

Measured memory_bytes: 1116
#include<bits/stdc++.h>
#define mo 1000000007
#define ny 499122177
#define maxn 1000000000000000000LL
#define pi 3.1415926535898
#define eps 1e-9 
using namespace std;
long long read(){
    long long xx=0,flagg=1; 
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
long long n,i,j,book[20005],top,book2[20005],top2,ans,min1,sum[20005];
char s[5005],t[5005];
int main(){
//	freopen("number.in","r",stdin);
//	freopen("number.out","w",stdout);
	n=read();
	scanf("%s",s+1);
	scanf("%s",t+1);
	
	for(i=1;i<n;i++)
		if(t[i]!=t[i+1]){
			top++;
			book[top]=i;
		}
	
	for(i=1;i<n;i++)
		if(s[i]!=s[i+1]){
			top2++;
			book2[top2]=i;
		}
	
	if(top>top2){
		swap(top,top2);
		swap(book,book2);
	}
	for(i=n+top2;i>=n+1;i--)
		book2[i]=book2[i-n];
	for(i=1;i<=n;i++)
		book2[i]=0;
	for(i=n+top2+1;i<=n*2+top2;i++)
		book2[i]=n;
	for(i=1;i<=n*2+top2;i++)
		sum[i]=sum[i-1]+book2[i];
	min1=maxn;
	for(i=(t[1]!=s[1])^(n&1);i<=n+top2;i+=2){
		ans=sum[i]+n*(n*2+top2-i-top)-(sum[n*2+top2]-sum[i+top]);
		for(j=1;j<=top;j++)
			ans+=abs(book2[i+j]-book[j]);
		min1=min(min1,ans);
	}
	pus(min1,2);
  	return 0;
}

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

typedef long long ll;
const ll inf = 1<<30;

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

    int nb; cin >> nb;
    vector<ll> dim(nb);
    int trash;
    for(auto& a:dim) cin >> a >> trash;
    dim.push_back(trash);
    
    vector<vector<ll>> cost( nb, vector<ll>(nb, inf) );
    for (int i=0; i<nb; ++i){
        cost[i][i] = 0;
    }
    
    for (int k=1; k<nb; ++k){
        for (int i=0; i+k<nb; ++i){
            for (int j=0; j<i+k; ++j){
                cost[i][i+k] = min(
                    cost[i][i+k],
                    cost[i][j] + cost[j+1][i+k] + dim[i]*dim[j+1]*dim[i+k+1]);
            }
        }
    }

    cout<<cost[0][nb-1] <<"\n";
} 

Measured memory_bytes: 3240
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n;
int a,b;
int mod=1e9+7;
vector < int > v[100005];
int dp[100005][2];
void dfs(int node , int prev)
{
	dp[node][0]=dp[node][1]=1;
	for(auto it: v[node])
	{
		if(it==prev)
			continue;
		dfs(it,node);
		dp[node][0]=(1LL*dp[node][0]*dp[it][1])%mod;
		dp[node][1]=(1LL*dp[node][1]*(dp[it][0]+dp[it][1]))%mod;
	}
}

int main(){
cin>>n;
for(int i=0;n-1>i;i++)
{
	cin>>a>>b;
	v[a].push_back(b);
	v[b].push_back(a);
}
dfs(1,-1);
cout<<(dp[1][0]+dp[1][1])%mod;
	return 0;
}


Measured memory_bytes: 12032
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rrep(i, n) for(int i=((int)(n)-1); i>=0; i--)
#define REP(i, k, n) for(int i=(int)(k); i<(int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define PQ(T) priority_queue<T>
#define PQS(T) priority_queue<T, vector<T>, greater<T> >
#define deci cout << fixed << setprecision(15);
typedef long long ll;
const int INF = INT_MAX;
const ll inf = 1e18;
const ll mod = 998244353;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
ll gcd(ll x, ll y){ if(x>y) swap(x, y);while(x!=0){ y%=x; swap(x, y); }return y; }
ll mpow(ll x, ll r){if(r==0) return 1;if(r%2==1){ return x*mpow(x, r-1)%mod; }else{ ll aa = mpow(x, r/2); return aa*aa%mod; }}

int main(){
	int k, a, b; cin >> k >> a >> b;
	for(int i=a; i<=b; i++){
		if(i % k == 0){
			cout << "OK" << endl;
			return 0;
		}
	}
	cout << "NG" << endl;
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1<<29;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin() , v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)

bool compare_by_a(pair<ll, ll> a, pair<ll, ll> b){
    if(a.first != b.first){
        return a.first < b.first;
    }
    else {
        return a.first < b.first;
    }
}

int main(){
    int N, M; cin >> N >> M;
    vector<pair<ll, ll>> ab(N);
    rep(i, N) cin >> ab[i].first >> ab[i].second;
    sort(ALL(ab), compare_by_a);
    ll ans = 0;
    rep(i, N){
        rep(j, ab[i].second){
            ans += ab[i].first;
            M--;
            if(M == 0) break;
        }
        if(M == 0) break;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
n = gets.chomp.to_i
hs = gets.split.map(&:to_i)
dp = [0, 0, (hs[1] - hs[0]).abs]
(3..n).each do |i|
  dp[i] = [dp[i - 1] + (hs[i - 1] - hs[i - 2]).abs, dp[i - 2] + (hs[i - 1] - hs[i - 3]).abs].min
end
puts dp[n]

Measured memory_bytes: 11396
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int main(){
    int x,a,b;
    cin>>x>>a>>b;
    if(a>=b)cout<<"delicious"<<endl;
    else if(x+a>=b)cout<<"safe"<<endl;
    else cout<<"dangerous"<<endl;
    return 0;
}



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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

void solve(){
	string s;
	cin >> s;
	REP(i, 0, (int)s.length() - 1){
		if (s[i] == 'A' && s[i + 1] == 'C'){
			cout << "Yes\n";
			return;
		}
	}
	cout << "No\n";
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

const mod = 1000000007

func nextLine(s *bufio.Scanner) string {
	s.Scan()
	return s.Text()
}

func solve(maze []string, h, w int) int {
	paths := make([][]int, h)
	for i := 0; i < h; i++ {
		paths[i] = make([]int, w)
	}

	paths[0][0] = 1

	for row := 0; row < h; row++ {
		for column := 0; column < w; column++ {
			if maze[row][column] == '#' {
				continue
			}

			if row > 0 {
				paths[row][column] = (paths[row][column] + paths[row-1][column]) % mod
			}
			if column > 0 {
				paths[row][column] = (paths[row][column] + paths[row][column-1]) % mod
			}
		}
	}

	return paths[h-1][w-1]
}

func main() {
	var h, w int
	scanner := bufio.NewScanner(bufio.NewReader(os.Stdin))
	scanner.Split(bufio.ScanLines)

	line := nextLine(scanner)
	fmt.Sscan(line, &h, &w)
	maze := make([]string, h)

	for i := 0; i < h; i++ {
		maze[i] = nextLine(scanner)
	}

	fmt.Println(solve(maze, h, w))
}


Measured memory_bytes: 10112
#include<iostream>

using namespace std;

int judge(int x){
  int tmp = 0;

  while(x != 1){
    if(x % 2 == 0) x /= 2;
    if(x % 3 == 0) x /= 3;
    if(x % 5 == 0) x /= 5;
    if(tmp == x) return 0;
    tmp = x;
  }
  return 1;
}

int main(){

  int fir, end;

  while(cin >> fir >> end){
    int sum = 0;
    for(int i = fir; i <= end; i++){
      if(judge(i)) sum++;
    }

    cout << sum << endl;
  }

  return 0;
}

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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
//Write From this Line

int main()
{
	int d;
	cin >> d;
	vector<int> c(26);
	rep(i,26) cin >> c[i]; 
	vector<vector<int>> s(d,vector<int>(26));
	rep(i,d) rep(j,26) cin >> s[i][j];

	// 最後に試合を行った日を保持する。
	vector<int> last_d(26,-1);
	ll ans = 0;
	rep(i,d){
		int index = 0;
		int M = 0;
		rep(j,26){
			if(chmax(M,s[i][j])){
				index = j;
			}
		}
		int game = index;
		last_d[game] = i;
		ans += s[i][game];
		rep(j,26){
			ans -= c[j] * (i - last_d[j]);
		}
		cout << index+1 << endl;
	}
}


Measured memory_bytes: 3688
import sys
height, width = map(int, input().split())
array = [0 for i in range(height)]

for i in range(height):
    array[i] = list(input())

h = [-1, 0,0,1]
w = [ 0,-1,1,0]

for a in range(height):
    for b in range(width):
        if array[a][b] == "#":
            for i in range(4):
                y = a + h[i]
                x = b + w[i]
                if y < 0 or y >= height: continue
                if x < 0 or x >= width: continue
                if array[y][x] == "#":
                    break
            else:
                print("No")
                sys.exit()
print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if (a * b > c * d) cout << a * b << endl;
  else if (a * b < c * d) cout << c * d << endl;
  else cout << a * b << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        String str;

        for(;;) {
            str = num.next();
            if (str.equals("-")) break;

            int m = num.nextInt();

            for(int i = 0; i < m; i++) {
                int n = num.nextInt();
                String nextStr = str.substring(n) + str.substring(0, n);
                str = nextStr;
            }
            System.out.println(str);
        }
    }
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  ll n, m, p, y;
  cin >> n >> m;
  vector<P> a(m);
  map<P, int> ump;
  map<int, map<int, P> > mp;
  for(int i = 0; i < m; ++i)
  {
    cin >> p >> y;
    P ind = P(p, y);
    a[i] = ind;
    ump[ind] = i;
    mp[p][y] = ind;
  }

  for(const auto& ip : mp)
  {
    int ind = 1;
    for(const auto& im : ip.second)
    {
      a[ump[im.second]].second = ind;
      ind++;
    }
  }

  cout << setfill('0') << right;
  for(const auto& city : a)
  {
    cout << setw(6) << city.first << setw(6) << city.second << endl;
  }

}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 26664
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
using namespace std;

int main()
{
	long long s;
	cin >> s;

	long long len = 1;
	long long x3 = 0, x5 = 0, x15 = 0;
	long long total = 0;
	while (1) {
		long long max_n=1, min_n=1;
		for (int i = 0; i < len - 1; i++)min_n *= 10;
		max_n = min_n * 10 - 1;

		long long l = min_n, r = max_n + 1;
		long long m;
		long long nx3, nx5, nx15;
		while (l < r) {
			m = (l + r) / 2;

			nx3 = m / 3;
			nx5 = m / 5;
			nx15 = m / 15;
			nx3 -= x3; nx5 -= x5; nx15 -= x15;
			nx3 -= nx15; nx5 -= nx15;

			long long sum = (m - min_n + 1)*len;
			sum += (4 - len)*(nx3 + nx5);
			sum += (8 - len)*nx15;

			if (total + sum < s)l = m + 1;
			else r = m;
		}

		if (r == max_n + 1) {
			nx3 = max_n / 3;
			nx5 = max_n / 5;
			nx15 = max_n / 15;
			nx3 -= x3; nx5 -= x5; nx15 -= x15;
			nx3 -= nx15; nx5 -= nx15;

			long long sum = (max_n - min_n + 1)*len;
			sum += (4 - len)*(nx3 + nx5);
			sum += (8 - len)*nx15;

			total += sum;

			x3 = max_n / 3;
			x5 = max_n / 5;
			x15 = max_n / 15;

			len++;
		}
		else {
			string ans = "";
			for (int i = 0; i < 20 / len + 5; i++) {
				long long x = r + i;
				if (x % 15 == 0)ans += "FizzBuzz";
				else if (x % 3 == 0)ans += "Fizz";
				else if (x % 5 == 0)ans += "Buzz";
				else ans += to_string(x);
			}
			long long from;

			nx3 = r / 3;
			nx5 = r / 5;
			nx15 = r / 15;
			nx3 -= x3; nx5 -= x5; nx15 -= x15;
			nx3 -= nx15; nx5 -= nx15;

			long long sum = (r - min_n + 1)*len;
			sum += (4 - len)*(nx3 + nx5);
			sum += (8 - len)*nx15;

			if (r % 15 == 0)from = 8 - ((total + sum) - s);
			else if (r % 3 == 0)from = 4 - ((total + sum) - s);
			else if (r % 5 == 0)from = 4 - ((total + sum) - s);
			else from = len - ((total + sum) - s);

			cout << ans.substr(from - 1, 20) << endl;

			break;
		}
	}

	return 0;
}

Measured memory_bytes: 3288
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main(){
    int n,c=0;
    long res = 0;
    cin >> n;
    vector<string> ss(n);
    for(int i=0;i<n;++i)cin >> ss[i];
    for(int i=0;i<n;++i)sort(ss[i].begin(),ss[i].end());
    sort(ss.begin(),ss.end());
    for(int i=1;i<n;++i){
        if(ss[i] == ss[i-1]){
            c++;
            res += c;
        }else{
            c = 0;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 7296
#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>

using namespace std;

int main(int argc, char* argv[])
{

	int A,B,C,D;
	int ans=0;

	cin >> A >> B >> C >> D;

	if(A>B){
		ans+=B;
	}else{
		ans+=A;
	}

	if(C>D){
		ans+=D;
	}else{
		ans+=C;
	}

	cout << ans << endl;

	return 0;

}

Measured memory_bytes: 256
H, W, K = map(int, input().split())
grid = []
for row in range(H):
  grid.append(input())
ans = 0

for i in range(1<<H):
  for j in range(1<<W):
    count = 0
    for row in range(H):
      for col in range(W):
        if (i>>row)&1 == 1 and (j>>col)&1 == 1 and grid[row][col] == '#':
          count += 1
    if count == K: ans += 1
print(ans)

Measured memory_bytes: 73732
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define ENDL cout << endl
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1000000000;

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    while (1) {
        C -= B;
        if (C <= 0) {
            COUT("Yes");
            return 0;
        }
        A -= D;
        if (A <= 0) {
            COUT("No");
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};



signed main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    int a, b;
    cin >> a >> b;
    if(a <= b) puts("unsafe");
    else puts("safe");
    return 0;
}

Measured memory_bytes: 3600
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
    int n,s=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        int x=floor(log10(i))+1;
        if(x&1){
            s++;
        }
    }
    printf("%d\n",s);
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<list>
using namespace std;
static const int MAX=100000;

vector<int> G[MAX];
list<int> out;
bool V[MAX];
int N;

void dfs(int u){
    V[u]=true;
    for(int i=0;i<G[u].size();i++){
        int v=G[u][i];
        if (!V[v]) dfs(v);
    }
    out.push_front(u);
}

int main(){
    int s,t,M;
    cin>>N>>M;
    for(int i=0;i<N;i++) V[i]=false;
    for(int i=0;i<M;i++){
        cin>>s>>t;
        G[s].push_back(t);
    }
    for(int i=0;i<N;i++){
        if (!V[i]) dfs(i);
    }
    for(list<int>::iterator it =out.begin(); it!=out.end(); it++)
        cout<<*it<<endl;
}


Measured memory_bytes: 6184
import sys
sys.setrecursionlimit(10**6)
n = int(input())
a = []
edge = [[] for _ in range(n)]
visited = [0] * n

def dfs(n):
    visited[n] = 1
    if len(edge[n]) == 1 and n != 0:
        return 0
    childrank = []
    for item in edge[n]:
        if visited[item] == 1:
            continue
        childrank.append(dfs(item))
    childrank.sort(reverse=True)
    for i in range(len(childrank)):
        childrank[i] += i + 1
    return max(childrank)


for i in range(1, n):
    val = int(input()) - 1
    edge[i].append(val)
    edge[val].append(i)

print(dfs(0))

Measured memory_bytes: 122928
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
using namespace std;



int main(){
	int n,count,prime[100000],u,check[50100];
	prime[0] = 2;
	count = 0;
	check[0]=0;
	check[1]=0;
	check[2]=1;
	for(int i=3;i<50100;i++){
		n=0;
		for(int j=0;prime[j]<=sqrt(i);j++){
			if(i%prime[j]==0)n++;
		}
		if(n==0){
			count++;
			prime[count] = i;
			check[i]=1;
		}
		else check[i] = 0;
	}
	
	while(1){
		count=0;
		u=1;
		cin >> n;
		if(n==0)break;
		for(int i=0;prime[i]*2<=n;i++){
			if(check[n-prime[i]]){
				count++;
			}
		}
		printf("%d\n",count);
		
	}
	return 0;
}


Measured memory_bytes: 3236
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

double const PI = acos(-1);

int solve(int deno, double R) {
  int L = (PI-R) * deno, U = ceil(PI+R) * deno;
  bool ok = 0;
  while(U-L > 1) {
    int M = (L + U) / 2.0;
    if(abs(double(M) / deno - PI) <= R) {
      ok = 1;
      L = M;
    } else {
      U = M;
    }
  }
  return ok ? L : -inf;
}

int main() {

  double R;
  while(cin >> R && R != 0.0) {
    rep(deno, 10000000) {
      int n = solve(deno+1, R);
      if(n != -inf) {
        printf("%d/%d\n", n, deno+1);
        break;
      }
    }
  }
  
  return 0;
}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
int N, M;
  cin >> N >> M;
vector<ll> C(N);
vector<ll> H(N);

  int a, b;
  for(int i = 0; i < N; i++) cin >> H[i];

  for(int i = 0; i < M; i++) {
    cin >> a >> b;
    a--;
    b--;
    if(H[a] >= H[b]) C[b] += 1; 
    if(H[b] >= H[a]) C[a] += 1;
  }
  ll sum = 0;
  for(int i = 0; i < N; i++) {
    if(C[i] == 0) sum++;
  }

  cout << sum;


return 0;
}

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

using namespace std;

vector<int> SubjectsInfo;

int main() {
	int score;

	for (int i = 0; i < 6; ++i) {
		cin >> score;
		SubjectsInfo.push_back(score);
	}
	sort(SubjectsInfo.begin(), SubjectsInfo.begin() + 4);
	cout << SubjectsInfo[1] + SubjectsInfo[2] + SubjectsInfo[3] + max(SubjectsInfo[4], SubjectsInfo[5]) << endl;

	return 0;
}


Measured memory_bytes: 3160
N = int(input())
A = list(map(int, input().split()))

t = [True] * (10 ** 6 + 1)
d = {}
for a in A:
    d.setdefault(a, 0)
    d[a] += 1

A = sorted(set(A))
for a in A:
    if d[a] > 1:
        t[a] = False
    for i in range(a + a, 10 ** 6 + 1, a):
        t[i] = False

result = 0
for a in A:
    if t[a]:
        result += 1
print(result)


Measured memory_bytes: 51976
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

def main():
    N = int(input())
    v = list(map(int, input().split()))
    v.sort()
    for i in range(1, N):
        v[i] = (v[i - 1] + v[i]) / 2
    print(v[-1])

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import java.util.*;

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

        String s = sc.next();
        String t = sc.next();

        int ans = 0;
        for(int i = 0; i < s.length() - t.length() + 1; i++){
            int count = 0;
            for(int j = 0; j < t.length(); j++){
                if(s.charAt(i + j) == t.charAt(j)){
                    count++;
                }
            }
            ans = Math.max(ans, count);
        }

        System.out.println(t.length() - ans);

    }
}


Measured memory_bytes: 35544
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) a.begin(),a.end()
#define ub(s,x) upper_bound(all(s),x)-s.begin()
#define INF 1e9
typedef long long ll;

int main(void){
    int N;
    cin>>N;
    vector<ll> a(N),b(N),c(N),dp(N+1);
    rep(i,N)cin>>a[i];
    rep(i,N)cin>>b[i];
    rep(i,N)cin>>c[i];
    sort(all(a));
    sort(all(b));
    sort(all(c));

    ll res = 0;
    rep(i,N){
        int pos = ub(c,b[N-i-1]);
        dp[N-i-1] = dp[N-i] + N-pos;
    }
    rep(i,N){
        int pos = ub(b,a[i]);
        res += dp[pos];
    }
    cout<<res<<endl;
    return 0;
}


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

int main() {
  int64_t N;
  int64_t K;
  cin>>N >>K;
  
  int64_t min=N%K;
  if(K==1) min=0;
  else if(min>=K/2){
    min=K-min;
  }

  
  cout<< min<< endl; 
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
char s[1000];
int main(){
    scanf("%s",s);
    int n = strlen(s);

    printf("%c%d%c\n",s[0],n - 2,s[n - 1]);
    return 0;
}




Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int x;
	cin >> x;
	int flag = 0;
	int i;
	if (x == 1)
	{
		printf("1");
		return 0;
	}
	else
	for (i = x; i >= 1; i--)
	{
		for (int j = i - 1; j > 1; j--)
		{
			for (int k = 2;; k++)
			{
			//	printf("j=%d k=%d i=%d", j, k, i);
				//getchar(); getchar();
				if (pow(j, k) == i)
				{
					flag = 1;
					break;
				}
				if (pow(j, k) > i)
					break;
			}
			if (flag)
				break;
		}

		if (flag)
			break;

	}
	printf("%d", i);
	getchar(); getchar();
	
	return 0;
}

Measured memory_bytes: 256
// 2014Domestic E:MeteorStream (pes)

#include <iostream>
#include <vector>
#include <valarray>
#include <algorithm>
#include <cstdio>

using namespace std;
double EPS = 1e-12;

class P3{
public:
	double x, y, z;
	P3(double x = 0, double y = 0, double z = 0) : x(x), y(y), z(z) {}
	P3 operator + (const P3 &p) const { return P3(x+p.x,y+p.y,z+p.z); }
	P3 operator - (const P3 &p) const { return P3(x-p.x,y-p.y,z-p.z); }
	P3 operator * (const P3 &p) const { return P3(x*p.x,y*p.y,z*p.z); }
	P3 operator * (const double &p) const { return P3(x*p,y*p,z*p); }
	P3 operator / (const double &p) const { return P3(x/p,y/p,z/p); }
	double sum() const { return x+y+z; }
	double squareSum() const { return x*x+y*y+z*z; }
};

struct Star {
	P3 p;
	P3 v;
	double r, d;
};

int main(){
	int n;
	while(cin >> n && n){
		vector<Star> vs(n);
		for(int i=0;i<n;i++){
			cin >> vs[i].p.x >> vs[i].p.y >> vs[i].p.z;
			cin >> vs[i].v.x >> vs[i].v.y >> vs[i].v.z;
			cin >> vs[i].r >> vs[i].d;
		}
		vector< pair<double, pair<int, int> > > vp;
		for(int i=0;i<n;i++){
			vp.push_back(make_pair(vs[i].r/vs[i].d, make_pair(i, -1)));
		}
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				double a = (vs[i].v-vs[j].v).squareSum() - (vs[i].d+vs[j].d)*(vs[i].d+vs[j].d);
				double b = ((vs[i].v-vs[j].v)*(vs[i].p-vs[j].p)).sum() + (vs[i].r+vs[j].r)*(vs[i].d+vs[j].d);
				double c = (vs[i].p-vs[j].p).squareSum() - (vs[i].r+vs[j].r)*(vs[i].r+vs[j].r);
				if(abs(a) < EPS){
					if(abs(b) < EPS) continue;
					double t = -c/b;
					if(t > 0) vp.push_back(make_pair(t, make_pair(i,j)));
				} else {
					if(b*b-a*c < 0) continue;
					double t1 = (-b-sqrt(b*b-a*c))/a;
					double t2 = (-b+sqrt(b*b-a*c))/a;
					if(t1 > t2) swap(t1, t2);
					if(t1 > 0){
						vp.push_back(make_pair(t1, make_pair(i, j)));
					} else if(t2 > 0){
						vp.push_back(make_pair(t2, make_pair(i, j)));
					}
				}
			}
		}
		sort(vp.begin(), vp.end());
		vector<double> res(n, 1e12);
		vector<int> hit(n, 0);
		for(int i=0;i<vp.size();i++){
			int idxA = vp[i].second.first;
			int idxB = vp[i].second.second;
			if(hit[idxA] || (idxB!=-1 && hit[idxB])) continue;
			res[idxA] = vp[i].first;
			hit[idxA] = 1;
			if(idxB != -1){
				res[idxB] = vp[i].first;
				hit[idxB] = 1;
			}
		}
		for(int i=0;i<n;i++) printf("%.12lf\n", res[i]);
	}
}

Measured memory_bytes: 1916
#include <iostream>
using namespace std;
int main(){
    char a;
    int b,c;
    b=c=0;
    while(cin>>a){
        if(a=='C'){
            b++;
        }
        if(a=='F' && b!=0){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

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

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

        ll he = 0;
        ll cnt = 0;
        for(ll i = 0; i < N; ++i)
        {
                ll H;
                cin >> H;
                if(H >= he)
                {
                        he = H;
                        ++cnt;
                }
        }

        cout << cnt << endl;

        return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<bitset>
#include<stack>
#include<cctype>
#define key_value (ch[ch[root][1]][0])
#define PR(x) cout<<#x<<": "<<x<<endl;
using namespace std;
typedef long long ll;
const double eps = 1e-4;
const int mod = 1e9+7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 3e5+7;
const int maxm = 1e6+7;
const double pi = acos(-1.0);

int main(){
	int n; cin>>n;
	printf("ABC%d\n",n);
} 

Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s1 = sc.next().toUpperCase();
    String s2 = sc.next().toUpperCase();
    String s3 = sc.next().toUpperCase();
    System.out.print(s1.charAt(0));
    System.out.print(s2.charAt(0));
    System.out.print(s3.charAt(0));
    System.out.println();
  }
}


Measured memory_bytes: 35528
inputs = gets.split.map(&:to_i)
str_1 = ''
str_2 = ''

(0...inputs[1]).each do
  str_1 += inputs[0].to_s
end

(0...inputs[0]).each do
  str_2 += inputs[1].to_s
end

puts [str_1.to_s, str_2.to_s].min


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define ff first
#define ss second
 
#ifndef ONLINE_JUDGE
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif
 
const int inf = 2e18;
const int mod = 1e9 + 7;
 
long double dp[3010][3010];

signed main(){
 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif
 
	int n; cin>>n;
	vector<long double> arr(n);
	for(int i=0; i<n; i++) cin>>arr[i];
	
	for(int i=0; i<n; i++){
		for(int j=0; j<=n; j++){
			if(i==0){
				if(j==0) dp[i][j] = 1 - arr[i];
				else if(j==1) dp[i][j] = arr[i];
				else dp[i][j] = 0;
			}
			else{
				if(j==0) dp[i][j] = dp[i-1][j]*(1-arr[i]);
				else dp[i][j] = dp[i-1][j-1]*arr[i] + dp[i-1][j]*(1-arr[i]);
			}
		}
	}
	long double ans = 0;
	for(int i=n/2+1; i<=n; i++) ans+=dp[n-1][i];

	cout<<setprecision(11)<<ans<<endl;

	return 0;
}

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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(b-a == c-b) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


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

int main(){
  int ans = 1;
  long long int a, b, tmp;
  vector<long long int> v;

  cin >> a >> b;
  
  //aの素数の約数を全て求める
  tmp = a;
  for(int i=2;i<=(int)sqrt(tmp);i++){
    int flag = 0;
    while(tmp%i==0){
      tmp/=i;
      //cout << "[" << tmp << "]";
      flag = 1;
    }
    if(flag==1){
      //cout << "(" << i << ")";
      v.push_back(i);
    }
    if(tmp<i){
      break;
    }
  }
  if(v.size()>0){
    if(tmp!=1&&v[v.size()-1]!=tmp)
    {
      v.push_back(tmp);
    }
  }else{
    if(tmp!=1)v.push_back(tmp);
  }
  
  for(int i=0;i<v.size();i++){
    //cout << "(" << v[i] << ")";
    if(b%v[i]==0){
      ans++;
    }
  }
  cout << ans;
  
  return 0;
}

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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer cur=nil->next;

  while(cur!=nil && cur->key!=key){
    cur=cur->next;
  }
  return cur;
}

void init(){
  nil=malloc(sizeof(struct node));
  nil->next=nil;
  nil->prev=nil;
}

void printList(){
  int isf=1;
  NodePointer cur=nil->next;

  while(1){
    if(cur==nil)break;
    if(isf==0)printf(" ");
    printf("%d",cur->key);
    cur=cur->next;
    isf=0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  t->prev->next=t->next;
  t->next->prev=t->prev;
  free(t);
}

void deleteFirst(){
  if(nil->next==nil)return;
  deleteNode(nil->next);
}

void deleteLast(){
  if(nil->next==nil)return;
  deleteNode(nil->prev);
}

void delete(int key){
  NodePointer t=listSearch(key);
  if(t==nil)return;
  deleteNode(t);
}


void insert(int key){
  NodePointer x;
  x=malloc(sizeof(struct node));
  x->key=key;
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;
}

int main(){
  int key,n,i;
  int size=0;
  char com[20];
  int np=0;
  int nd=0;
  
  scanf("%d",&n);
  init();
  
  for(i=0;i<n;i++){
    scanf("%s%d",com,&key);
    
    if(com[0]=='i'){
      insert(key);
      np++;
      size++;
    }
    else if(com[0]=='d'){
      if(strlen(com)>6){
	if(com[6]=='F')deleteFirst();
	else if(com[6]=='L')deleteLast();
      }
      else{
	delete(key);
	nd++;
      }
      size--;
    }
  }

  printList();

  return 0;
}



Measured memory_bytes: 32960
fun main(args: Array<String>) {
  val (A, B) = readLine()!!.split(" ").map { it.toLong() }
  println(lcm(A, B))
}

fun gcd(m: Long, n: Long): Long {
  if (m < n) return gcd(n, m)
  return if (n == 0L) m else gcd(n, m % n)
}

fun lcm(m: Long, n: Long): Long {
  return m * n / gcd(m, n)
}

Measured memory_bytes: 37872
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int hugo(int j){
	if(j) return 1;
	else return -1;
}
int main(){
	int N;
	ll A[100001];
	ll mnum=0,mmax=-INF,pmin=INF;
	ll sum=0,msum=0,psum=0;
	scan(N);
	rep(i,N){
		scan(A[i]);
		sum+=A[i];
		if(A[i]>=0){
			psum+=A[i];
			pmin=min(pmin,A[i]);
		}
		else{
			msum+=A[i];
			mnum++;
			mmax=max(mmax,A[i]);
		}
	}
	if(mnum%2==0){
		prin(psum-msum);
	}
	else if(mnum==N){
		prin(-msum+2*mmax);
	}
	else if(-mmax>pmin){
		prin(psum-msum-2*pmin);
	}
	else{
		prin(psum-msum+2*mmax);
	}
	return 0;
}


Measured memory_bytes: 1024
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

bool isprime(int64_t x) {
	if (x < 2)return false;

	for (int64_t i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}


int main() {

	int n; cin >> n;

	vector<int> a;


	for (int i = 11; i <= 55555; i+=5) {
		if (isprime(i)) {
			a.push_back(i);
		}
	}

	sort(a.begin(), a.end());

	cout << a[0];

	for (int i = 1; i < n; i++) {
		cout << " " << a[i];
	}

	cout << endl;



	return 0;
}

Measured memory_bytes: 256
C = [list(map(int, input().split())) for _ in range(3)]

Dif_H = [[] for _ in range(3)]
Dif_V = [[] for _ in range(3)]

for i in range(3):
    Dif_H[i] = [C[i][0] - C[i][1], C[i][1] - C[i][2], C[i][2] - C[i][0]]
for i in range(3):
    Dif_V[i] = [C[0][i] - C[1][i], C[1][i] - C[2][i], C[2][i] - C[0][i]]

if Dif_H[0] == Dif_H[1] == Dif_H[2] and Dif_V[0] == Dif_V[1] == Dif_V[2]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 62060
#include<cstdio>
#include<cstring>
char s[101];
int len;
bool keyence(int st, int f) {
	char key[8] = "keyence";
	int c = 0;
	int i;
	for (i = 0; i < st; i++) {
		if (c == 7) return false;
		if (key[c++] != s[i]) return false;
	}
	for (i = f + 1; i < len; i++) {
		if (c == 7) return false;
		if (key[c++] != s[i]) return false;
	}
	if (c == 7) return true;
	return false;
}
int main() {
	scanf("%s", s);
	len = strlen(s);
	int i, j;
	if (keyence(0, -1)) {
		printf("YES");
		return 0;
	}
	for (i = 0; i < len; i++) {
		for (j = i; j < len; j++) {
			if (keyence(i, j)) {
				printf("YES");
				return 0;
			}
		}
	}
	printf("NO");
	return 0;
}

Measured memory_bytes: 128