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

int main(){
	int a[1000000]={0};
	int n,i,j,count;
	while(scanf("%d",&n)!=EOF){
		//printf("n=%d\n",n);
		count=0;
		/*for(i=2;i<=n;i++){
			a[i]=0;
		}*/
		for(i=2;i<=n;i++){
			if(a[i]==0){
				count++;
				for(j=2*i;j<=n;j=j+i){
					a[j]=1;
				}
			}
		}
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 4512
#include <iostream>
#include <cstdlib>

using namespace std;

int main(void) {
	string Ns;
	cin >> Ns;

	int N = atoi(Ns.c_str());
	int v = 0;
	for (int i = 0; i < (int)Ns.size(); i++) {
		v += Ns[i] - '0';
	}

	string result = (N % v) == 0 ? "Yes": "No";

	cout << result << endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,n)  for (int i=(int)(a); i<=(int)(n); ++i)
#define rrep(i,a,n) for (int i=(int)(a); i>=(int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N,M,K;
string S,T;
vector<int> A;
vector<int> B;
//=============================
void input()
{
    cin>>N;
}
//=============================
void func(){}
//=============================
void solve()
{
    cout<<N/3<<endl;
}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

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

using namespace std;

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

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

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

ll N, D, A;
pll T[200005];
vector<ll> X;

ll pos(ll x) {
    ll ok = N - 1, ng = -1;
    while (abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        if (T[mid].first >= x)
            ok = mid;
        else
            ng = mid;
    }
    return ok;
}

int main() {
    cin >> N >> D >> A;
    REP(i, N) {
        cin >> T[i].first >> T[i].second;
    }
    sort(T, T + N, [](pll a, pll b) { return a.first < b.first; });

    REP(i, N) {
        X.push_back(T[i].first);
        X.push_back(T[i].first + 2LL * D);
    }
    sort(X.begin(), X.end());
    X.erase(unique(X.begin(), X.end()), X.end());
    vector<ll> S(X.size() + 1, 0);
    ll s = 0;
    ll ans = 0;
    REP(i, X.size()) {
        s += S[i];
        ll xi = pos(X[i]);
        if (T[xi].first != X[i])
            continue;
        ll h = T[xi].second - s;
        if (h <= 0)
            continue;

        ll n = (h + A - 1) / A;
        s += n * A;
        ans += n;
        ll index = lower_bound(X.begin(), X.end(), X[i] + 2LL * D) - X.begin();
        S[index + 1] += -(n * A);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9964
A=int(input())
B=int(input())
C=int(input())
X=int(input())
a=0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*i+100*j+50*k==X:
        a+=1
print(a)


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

public class Main {

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null; }
        String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try { tokenizer = new StringTokenizer(reader.readLine()); } 
                catch (IOException e) { throw new RuntimeException(e);} }
            return tokenizer.nextToken(); }
        public int nextInt() { return Integer.parseInt(next()); }
        public long nextLong() { return Long.parseLong(next()); }
        public double nextDouble() { return Double.parseDouble(next()); }
    }

    static InputReader r = new InputReader(System.in);
    static PrintWriter pw = new PrintWriter(System.out);

    static final int REEEEEEEEEEE = (int)1E9+7;
    public static void main(String[] args) {
        
        int rows = r.nextInt();
        int cols = r.nextInt();
        char[][] grid = new char[rows+1][cols+1];
        long[][] dp = new long[rows+1][cols+1];
        for(int i = 1; i <= rows; i++){
            String s = r.next();
            for(int j = 1; j <= cols; j++){
                grid[i][j] = s.charAt(j-1);
            }
        }
        int r = rows;
        int c = cols;
        for(r = rows; r >= 1; r--){
            if(grid[r][cols] == '#') break;
            else dp[r][cols] = 1;
        }
        for(c = cols; c >= 1; c--){
            if(grid[rows][c] == '#') break;
            else dp[rows][c] = 1;
        }
        for(r = rows-1; r >= 1; r--){
            for(c = cols-1; c>= 1; c--){
                if(grid[r][c] == '#'){
                    dp[r][c] = 0;
                } else {
                    dp[r][c] = dp[r+1][c] + dp[r][c+1];
                    dp[r][c] %= REEEEEEEEEEE;
                }
            }
        }
        pw.println(dp[1][1]);

        pw.close();
    }
}

/**
                _        _                 _                                                
               | |      | |               | |                                               
   ___ ___   __| | ___  | |__  _   _    __| | __ _ _ __ _ __ ___ _ __     _   _  __ _  ___  
  / __/ _ \ / _` |/ _ \ | '_ \| | | |  / _` |/ _` | '__| '__/ _ \ '_ \   | | | |/ _` |/ _ \ 
 | (_| (_) | (_| |  __/ | |_) | |_| | | (_| | (_| | |  | | |  __/ | | |  | |_| | (_| | (_) |
  \___\___/ \__,_|\___| |_.__/ \__, |  \__,_|\__,_|_|  |_|  \___|_| |_|   \__, |\__,_|\___/ 
                                __/ |                               ______ __/ |            
                               |___/                               |______|___/             
 */

Measured memory_bytes: 38196
#include<bits/stdc++.h>
#define int long long int
using namespace std;

signed main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    string n; cin>>n;
    int m=n.size(), x=0;

    for(int i=0; i<m; i++){
         x +=(int) n[i]-'0';
         x %=9;
    }
    //cout<<x<<endl;
    if(x==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;


    
}

Measured memory_bytes: 3760
using System;

class Ast3orSrash2{
    static void Main(string[] args){
        var n = int.Parse(Console.ReadLine());
        var aiStr = Console.ReadLine().Split(' ');
        var ai = new int[n];
        var i = 0;
        foreach (var item in aiStr){
            ai[i] = int.Parse(item);
            i = i + 1;
        }

        var counter = 0;
        foreach (var item in ai){
            counter = counter + TwoCounter(item);
        }

        Console.WriteLine(counter);
    }

    static int TwoCounter(int num){
        var count = 0;
        while(num % 2 == 0){
            count = count + 1;
            num = num / 2;
        }
        return count;
    }
}

Measured memory_bytes: 11744
#include <stdio.h>
#include <stdlib.h>

int main(void){
    // Your code here!
    int N,M;
    int N_array[50][2],M_array[50][2];
    
    scanf("%d%d",&N,&M);
    
    for(int i = 0; i < N; i++){
        scanf("%d%d",&N_array[i][0],&N_array[i][1]);
    }
    
    for(int i = 0; i < M; i++){
        scanf("%d%d",&M_array[i][0],&M_array[i][1]);
    }
    
    for(int i = 0; i < N; i++){
        int min_index = 0;
        int min = 999999999;
        for(int j = 0; j < M; j++){
            int tmp = abs(N_array[i][0] - M_array[j][0]) + abs(N_array[i][1] - M_array[j][1]);
            if(tmp < min){
                min = tmp;
                min_index = j;
            }
        }
        printf("%d\n",min_index+1);
    }
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<climits>
#include<stack>
#include<queue>
#include<unordered_map>
#include<map>
#include<set>
#include<fstream>
#include<list>
#include<sstream>

#define loopi(x,y) for(int i = x;i<(y);i++)
#define loopj(x,y) for(int j = x;j<(y);j++)
#define rloopi(x,y) for(int i = x;i>=(y);i--)
#define rloopj(x,y) for(int j = x;j>=(y);j--)


#define nl cout<<"\n";
#define ll long long int
#define mod  1000000007

using namespace std;


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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	long long int n, x, m;
	cin >> n >> x >> m;

	unordered_map<int, int> hash;

	vector<int> rem;

	rem.push_back(x);

	hash[x] = 0;
	long long sum = 0;
	int start_cycle = -1;
	int i;
	for (i = 0; i <= m; i++)
	{
		long long p = rem[i];
		p = (p * p) % m;
		if (hash.find(p) != hash.end())
		{
			start_cycle = hash[p];
			break;
		}
		hash[p] = i + 1;
		rem.push_back(p);
	}
	for (i = 0; i < start_cycle && i < n ; i++)
	{
		sum += rem[i];
	}

	long long remains = n - i;

	long long int cycle_sum = 0;
	int k = rem.size();

	for (int j = start_cycle; j < k; j++)
	{
		cycle_sum += rem[j];
	}


	sum += cycle_sum * (remains / (k - start_cycle));

	remains = remains % (k - start_cycle);

	for (int j = start_cycle; j < start_cycle + remains; j++)
	{
		sum += rem[j];
	}

	cout << sum;
	return 0;

}

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

int main() {
    string s;
    cin >> s;
    int counter = 0, r = 700;
    if (s[0] == 'o') ++counter;
    if (s[1] == 'o') ++counter;
    if (s[2] == 'o') ++counter;

    r = r + 100*counter;
    cout << r << endl;
}

Measured memory_bytes: 3612
#include<iostream>
#include<string>
#include<string.h>
#include<map>
using namespace std;

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

long long hp[100];
long long dp1[100050];
long long dp2[100050];
const long long inf = 1<<29;
pair<long long, long long> smagic[100];
pair<long long, long long> amagic[100];

int main() {
    int N,M,i,j,k,mp,dm,am,sm;
    long long maxhp;
    string name,range;
    while(cin>>N, N) {
        memset(hp, 0, sizeof(hp));
        rep(i,100005) dp1[i] = dp2[i] = inf;
        am = sm = maxhp = 0;
        rep(i,N) cin>>hp[i];
        rep(i,N) maxhp = max(maxhp, hp[i]);
        cin>>M;

        rep(i,M) {
            cin>>name>>mp>>range>>dm;
            if(range == "All") {
                amagic[am] = make_pair(mp,dm);
                am++;
            }else{
                smagic[sm] = make_pair(mp,dm);
                sm++;
            }
        }

        dp1[0] = dp2[0] = 0;
        rep(i,maxhp+1) {
            rep(j,am) {
                if(dp1[i] == inf) continue;
                long long h = min(maxhp, i+amagic[j].second);
                dp1[h] = min(dp1[h],
                             dp1[i]+amagic[j].first);
            }
            rep(j,sm) {
                if(dp2[i] == inf) continue;
                int h = min(maxhp, i+smagic[j].second);
                dp2[h] = min(dp2[h],
                             dp2[i]+smagic[j].first);
            }
        }


        int smax = inf,amax = inf;
        for(i = 100004; i>=0; --i) {
            if(smax > dp2[i]) smax = dp2[i];
            if(amax > dp1[i]) amax = dp1[i];
            if(dp2[i] > smax) dp2[i] = smax;
            if(dp1[i] > amax) dp1[i] = amax;
        }

        long long ans = inf;
        for(int i=maxhp; i>=0; --i) {
            //cout<<i<<" "<<ans<<endl;
            int j;
            long long tmp = dp1[i];
            rep(j,N) {
                if(hp[j]-i > 0) {
                    //if(i == 98495) cout<<hp[j]-i<<" "<<j<<" "<<dp2[hp[j]-i]<<endl;
                    tmp += dp2[hp[j]-i];
                }
            }
            //cout<<ans<<" "<<tmp<<endl;
            // if(ans > tmp) {
            //     cout<<i<<" "<<ans<<" "<<tmp<<endl;
            // }
            ans = min(tmp, ans);
        }

        cout<<ans<<endl;
    }
}

Measured memory_bytes: 2492
package main

import "fmt"

func main() {
	var s, t string
	fmt.Scan(&s, &t)

	min_match := len(t)
	for i:=0; i <= len(s)-len(t); i++ {
		temp_min_match := 0
		for j:=0; j < len(t); j++ {
			if s[j+i] != t[j]{
				temp_min_match++
			}
		}
		min_match = min(min_match, temp_min_match)
	}
	fmt.Println(min_match)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

Measured memory_bytes: 1788
#include <bits/stdc++.h>
 
using namespace std;
#define sz(x) (int)(x).size()
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define ll long long
const int N=3e5+5,MOD=1e9+7;
 
int n,m;

ll dp[3005][3005];
int a,b;
std::vector<int> g[N];
int memo[N];
int go(int u){
	int &ret = memo[u];
	if(~ret)return ret;
	ret = 0;
	for(auto v : g[u])ret = max(ret,1+go(v));
	return ret;
}
int main()
{	

	scanf("%d %d",&n,&m);

	memset(memo,-1,sizeof(memo));

	for(int i=0;i<m;i++)scanf("%d %d",&a,&b),g[a].pb(b);

	int ans = 0;

	for(int i=1;i<=n;i++)ans=max(ans,go(i));

	printf("%d\n",ans );
}
 

Measured memory_bytes: 14976
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define f first
#define s second

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef vector < vector <pii> > graph;


signed main()
{
   ios_base::sync_with_stdio(0);
   cin.tie(0);
   int n;
   cin >> n;
   vector <pii> rs(n);
   for(int i = 0; i < n; i++) {
       int x, l;
       cin >> x >> l;
       rs[i] = {x + l, l};
   }
   sort(all(rs));
   vector <int> dp(n);
   dp[0] = 1;
   for(int i = 1; i < n; i++) {
       int x = rs[i].f - rs[i].s;
       int idx = lower_bound(all(rs), make_pair(x - rs[i].s, -1)) - rs.begin();
       if(idx == rs.size()) {
           dp[i] = dp[i - 1] + 1;
       }
       else{
           if(rs[idx].f == x - rs[i].s) {
               dp[i] = max(dp[i - 1], dp[idx] + 1);
           }
           else{
               dp[i] = max(dp[i - 1], (idx == 0 ? 1: dp[idx - 1] + 1));
           }
       }
   }
   cout << dp[n - 1] << '\n';
   return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

int main(){
    int n;
    cin >> n;
    int ans = 0;
    rep(i, n) {
        int a;
        cin >> a;
        int cou = 0;
        bool ok = 1;
        while(ok) {
            if(a%2 == 1) break;
            a /= 2;
            cou++;
        }
        ans += cou;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3588
/* ABC156_B
    Stuartyg */

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>


int main(void){
    int n,k;
    double ans = 0;

    scanf("%d %d",&n,&k);
    
    ans = log(n)/log(k);
    printf("%d",(int)ans+1);

    return 0;
}


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


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

    int a, b, c;
    cin >> a >> b >> c;

    if(a > b)
        swap(a, b);
    if(c >= a and c <= b)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


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

int main() {
    string a,b,c;
    cin>>a>>b>>c;
    reverse(a.begin(),a.end());
    reverse(b.begin(),b.end());
    reverse(c.begin(),c.end());
    char cur = 'a';
    while (true) {
        switch (cur){
            case 'a': if(a.empty()){puts("A");return 0;} cur=a.back();a.pop_back();break;
            case 'b': if(b.empty()){puts("B");return 0;} cur=b.back();b.pop_back();break;
            case 'c': if(c.empty()){puts("C");return 0;} cur=c.back();c.pop_back();break;
            default:;
        }
    }
}


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

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		int x;
		scanf("%d", &x);
		if (x % 2 == 0 && !(x % 3 == 0 || x % 5 == 0)) {
			return puts("DENIED"), 0;
		}
	}
	puts("APPROVED");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
const ll Mod = 1000000007;
ll INF = Mod * 100LL;
int main() {
  int N,M;
  cin >> N >> M;
  ll a[N],b[N],c[M],d[M];
  for (int i = 0; i < N; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < M; i++) {
    cin >> c[i] >> d[i];
  }
  int ind = -1;
  ll mi = INF;
  for (int i = 0; i < N; i++) {
    int ind = -1;
    ll mi = INF;
    for (int j = 0; j < M; j++) {
      ll res = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if (res < mi) {
        mi = res;
        ind = j;
      }
    }
    cout << ind + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll h1,m1,h2,m2,k;
	cin>>h1>>m1>>h2>>m2>>k;
	ll ans=(h2-h1)*60+m2-m1-k;
	cout <<ans;
	// your code goes here
	return 0;
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;
const ll mod = 1e9 + 7;

const int maxn = 1e6 + 5;


ll brute(ll L, ll R) {
    ll res = 0;

    for (ll x=L; x<=R; x++) {
	for (ll y=x; y<=R; y++) {
	    if ((y%x) == (y^x)) {
	    	//cout<<x<<" "<<y<<endl;
		res++;
	    }
	}
    }
    return res;
}

ll brute2(ll L, ll R) {
    ll res = 0;

    for (ll x=L; x<=R; x++) {
	for (ll y=x; y<=R; y++) {
	    if (y < x+x && ((x&y)==x)) {
	    	res++;
	    }
	}
    }

    return res;
}


ll L, R;



// conditions
// x^y = y-x
// x+y-2(x&y) = y-x
// x&y = x

// 1. x is a subset of y
// 2. first on bit of x and y are same

// building msb...i...0
// bot: True if x still matches L
// top: True if y still matches R
// first: True if first bit has been placed


ll dp[65][2][2][2];

ll f(int i, bool bot, bool top, bool first) {
    if (i<0) return 1;
    ll &res = dp[i][bot][top][first];
    if (~res) return res;
    
    res = 0;
    for (int xb=0; xb<=1; xb++) {
	for (int yb=0; yb<=1; yb++) {

	    if (xb>yb) continue;
	    if (bot && xb<(L>>i&1)) continue;
	    if (top && yb>(R>>i&1)) continue;
	    if (!first && (xb!=yb)) continue;

	    res += f(i-1, bot && (xb==(L>>i&1)), top && (yb==(R>>i&1)), first || (xb==1 && yb==1));
	    res %= mod;
	}
    }
    
    res %= mod;
    return res;
}


int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
    memset(dp,-1,sizeof(dp));
    cin>>L>>R;
    ll ans = f(62,true,true,false);
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

//変数
ll N, M;
vector<pair<ll,ll>> vec;

//解法
void solve() {

	sort(vec.begin(), vec.end(), 
		[](const pair<ll, ll>& x, const pair<ll, ll>& y) {return x.second < y.second; });

	ll ans = 0;

	rep(i, N) {
		if (M < vec[i].first) {
			ans += M * vec[i].second;
			break;
		}
		M -= vec[i].first;
		ans += (vec[i].first * vec[i].second);
	}

	cout << ans;

	return;
}

int main() {

	//入力
	cin >> N >> M;
	vec.resize(N);
	rep(i, N) cin >> vec[i].second >> vec[i].first;

	solve();
	cout << endl;
	return 0;
}

Measured memory_bytes: 1792
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim_right().to_owned()
}

fn main() {
    let nums: Vec<u64> = read_line().split_whitespace().map(|x| x.parse().unwrap()).collect();
    let (n, a, b) = (nums[0], nums[1], nums[2]);
    println!("{}", std::cmp::min(n * a, b));
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;
const int maxn = 305;
const int INF = 1E18;
long long dis[maxn][maxn];
int main()
{
    int n, m, l; cin >> n >> m >> l;
    for( int i = 1; i <= n; ++ i )
        for( int j = 1; j <= n; ++ j ) dis[i][j] = INF;
    for( int i = 0; i < m; ++ i )
    {
        int a, b, c; cin >> a >> b >> c;
        dis[a][b] = dis[b][a] = c;
    }
    for( int k = 1; k <= n; ++ k )
        for( int i = 1; i <= n; ++ i )
            for( int j = 1; j <= n; ++ j )
                dis[i][j] = min( dis[i][j], dis[i][k] + dis[k][j] );
    for( int i = 1; i <= n ; ++ i )
        for( int j = 1; j <= n; ++ j )
            if( dis[i][j] <= l ) dis[i][j] = 1;
            else dis[i][j] = INF;
    for( int k = 1; k <= n; ++ k )
        for( int i = 1; i <= n; ++ i )
            for( int j = 1; j <= n; ++ j )
                dis[i][j] = min( dis[i][j], dis[i][k] + dis[k][j] );
    int q; cin >> q;
    while( q -- )
    {
        int a, b;
        cin >> a >> b;
        if( dis[a][b] >= INF )
            cout << -1 << endl;
        else
            cout << dis[a][b] - 1 << endl;
    }
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define ll long long
int gcd(int a,int b)
{
	int c=min(a,b);
	for(int i=c;i>0;i--)
	{
		if(a%i==0&&b%i==0)
			return i;
	}
}
int main()
{
	int n,i,j,k;
	ll s=0;
	cin>>n;
	for(i=1;i<=n;i++)
		for(j=1;j<=n;j++)
			for(k=1;k<=n;k++)
				s+=gcd(gcd(i,j),k);
	cout<<s;
	return 0;
}

Measured memory_bytes: 3636
/**
 * author: dhakad_123
**/
#include<bits/stdc++.h>
using namespace std;

bool check_palindrome(string s,int i, int j){
    while(i <= j){
        if(s[i] != s[j]){
            return false;
        }
        else{
            i++;
            j--;
        }
    }
    return true;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    int n = s.length();
    
    int i = 0;
    int j = s.length()-1;
    bool Ok = check_palindrome(s,i,j);
    
    if(!Ok){
        cout << "No" << "\n";
        exit(0);
    }
    
    if(Ok){
        int size = (n-1)/2;
        Ok = check_palindrome(s,0,size-1);
        
        if(!Ok){
            cout <<"No"<<"\n";
            exit(0);
        }
        
    }
   
    
    if(Ok){
        int size = ((n+3)/2) - 1;
        
        Ok  = check_palindrome(s, size,n-1);
        if(!Ok){
            cout << "No" <<"\n";
            exit(0);
        }
    }
    
    cout<< "Yes"<<"\n";
    return 0;
}

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

int a[200005], b[200005];
int main() {
    int n;
    long long res = 0;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    for (int i = 1; i <= n; i++) {
        b[i] = max(a[i], b[i-1]);
    }
    for (int i = 1; i <= n; i++) {
        res += max(b[i]-a[i], 0);
    }
    cout << res;
}

Measured memory_bytes: 5160
#include <bits/stdc++.h>
#include <boost/algorithm/string/join.hpp>
#include <boost/range/irange.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using boost::irange;
using boost::algorithm::join;

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/4;
constexpr int INF=inf<int>;
constexpr ll LINF=inf<ll>;

#define Sort(x) sort(begin(x),end(x))
#define Reverse(x) reverse(begin(x),end(x))
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ull<<(n))
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,(v).size())

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========


// 同じ品物をいくつでも詰められるnapzak問題
// valuesは利益
ll exchange(const ll x, const vi& weights, const vi& values) {
  // i種類目までの品物を見て、j [g]以下のとき、の価値の最大値
  vvll dp(weights.size()+1, vll(x+1));

  for(int i=0; i<int(weights.size()); i++) {
    for (int j=0; j<=x; j++) {
      chmax(dp[i+1][j], dp[i][j]);

      if (j>=weights[i]) {
        chmax(dp[i+1][j], dp[i+1][j-weights[i]] + values[i]);
      }
    }
  }

  return x + dp[weights.size()][x];
}

int main(int argc, char** argv) {
  ll N;
  vi A(3);
  vi B(3);

  cin >> N;
  cin >> A[0] >> A[1] >> A[2];
  cin >> B[0] >> B[1] >> B[2];

  vi weights = A;
  vi values = {B[0]-A[0],
	       B[1]-A[1],
	       B[2]-A[2]};
  ll x = exchange(N, weights, values);

  weights = B;
  values = {A[0]-B[0],
	    A[1]-B[1],
	    A[2]-B[2]};
  x = exchange(x, weights, values);

  cout << x << endl;
  return 0;
}


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

import static java.lang.System.in;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String ans = help(s)?"YES":"NO";
        System.out.println(ans);
    }
    static boolean help(String s){
        char[] S = s.toCharArray();
        int n = S.length;
        Integer[] rec = new Integer[3];
        Arrays.fill(rec,0);
        for(char w:S) rec[w-'a']++;
        Arrays.sort(rec,Collections.reverseOrder());
        for(int i=0;i<n;i++){
            if(rec[i%3]<=0) return false;
            rec[i%3]--;
        }
        return true;
    }
}


Measured memory_bytes: 28384
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    s = list(input())
    k = int(input())
    alphabet = [chr(i) for i in range(97, 97 + 26)]

    for i in range(len(s)):
        if s[i] == "a":
            continue

        idx = alphabet.index(s[i])
        if 26 - idx <= k:
            s[i] = "a"
            k -= 26 - idx

    if k:
        idx = alphabet.index(s[i]) + k % 26
        s[-1] = alphabet[idx]

    print("".join(s))



if __name__ == '__main__':
    resolve()


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

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    int N; cin >> N;
    vector<double> x(N), y(N); REP(i,N) cin >> x[i] >> y[i];
    vector<int> p(N); REP(i,N) p[i] = i;
    double d[N][N];
    REP(i,N)REP(j,N){
        d[i][j] = sqrt((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]));
    }
    double ans = 0;
    do{
        REP(i,N-1) ans += d[p[i]][p[i+1]];
    }while(next_permutation(ALL(p)));
    double bunbo = 1; REP(i,N) bunbo *= (i+1);
    ans /= bunbo;
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
package main

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

type Scanner struct {
	reader *bufio.Scanner
}

func (s *Scanner) Next() string {
	s.reader.Scan()
	return s.reader.Text()
}

func (s *Scanner) NextInt() int {
	s.reader.Scan()
	val, err := strconv.Atoi(s.reader.Text())
	if err != nil {
		panic(err)
	}
	return val
}

var sc *Scanner

func init() {
	sc = &Scanner{bufio.NewScanner(os.Stdin)}
	sc.reader.Split(bufio.ScanWords)
}

func main() {
	a := sc.NextInt()
	b := sc.NextInt()

	if a < b {
		fmt.Println("a < b")
	} else if a > b {
		fmt.Println("a > b")
	} else {
		fmt.Println("a == b")
	}
}



Measured memory_bytes: 1092
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i, j) for(int i = 1; i < j; i++)
#define dia(i, j) i * i + j* j
#define all(i) i.begin(), i.end()
using namespace std;
struct dat_st { int h, w, num; };
bool compare(dat_st &t0, dat_st &t1)
{
	if (t0.num == t1.num)
	{
		return t0.h < t1.h;
	}
	return t0.num < t1.num;
}
int num(int x, int y)
{
	int num = x * x + y * y;
	return num;
}
int main()
{
	vector<dat_st> cul(0);
	rep(h, 151) rep(w, 151)
	{
		if (h < w && h != w)
		{
			cul.push_back({ h, w, dia(h, w) });
		}
	}
	sort(all(cul), compare);
	int h, w; while (cin >> h >> w, h, w)
	{
		if (h == 1 && w == 2) { printf("1 3\n"); }
		rep(i, (int)cul.size())
		{
			if (cul[i].h == h && cul[i].w == w)
			{
				printf("%d %d\n", cul[i + 1].h, cul[i + 1].w);
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int result;

        if (y % x == 0) {
            result = x + y;
        } else {
            result = y - x;
        }

        System.out.println(result);

    }

}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
// #include "ane.cpp"

const int INF  = 1e9;
const long long INFLL = 1e18;
const int NMAX = 100005;
const int MMAX = 100005;
const int KMAX = 1005;
const int MOD  = 1e9 + 7;
using namespace std;

// comment to disable debug functions
#define DEBUG

// frequently used macros

#if __cplusplus >= 201103L
#define ALL(v) begin(v),end(v)
#define SORT(v) sort(begin(v), end(v))
#define FIND(v,x) find(begin(v), end(v), (x))
#else
#define ALL(v) (v).begin(),(v).end()
#define SORT(v) sort(v.begin(), v.end())
#define FIND(v,x) find(v.begin(), v.end(), (x))
#endif

#define MEMNEXT(from, to) do{ memmove((to), (from), sizeof(from)); \
memset((from), 0, sizeof(from)); } while(0)
#ifdef DEBUG
#define DUMP(x) do{ std::cerr << (#x) << ": " << x << std::endl; }while(0)
#else
#define DUMP(x) do{}while(0)
#endif

// frequent used aliases
typedef long long ll;
typedef pair<int, int> p;
typedef pair<ll, int> lp;
typedef pair<ll, ll> llp;
typedef vector<int> vec;
typedef vector<ll> vecll;
typedef vector<vec> mat;
typedef vector<vecll> matll;

// frequently used constants
static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1};
static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1};

// frequently used structs
struct edge{
  int to,cost;
};

// printf for debug
#ifndef DEBUG
void debug(const char* format, ...){}
#else
void debug(const char* format, ...){
  va_list arg;
  va_start(arg, format);
  vprintf(format, arg);
  va_end(arg);
}
#endif

// dump vector
#ifdef DEBUG
#define DUMPV(v, c) do{       \
  printf("%s: ", #v);         \
  for (int i = 0; i < (c); ++i) \
  {                           \
  cout << (v)[i] << " ";      \
  }                           \
  cout << endl;               \
} while(0)
#else
#define DUMPV(v,c)
#endif

// std::fill of multi dimensions
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
  std::fill( (T*)array, (T*)(array+N), val );
}

// binary search
ll BSearch(ll _begin, ll _end, bool (*f)(int)){
  ll mid;
  while(_end - _begin > 1LL) {
  mid = (_begin + _end) / 2LL;
  if(f(mid)) {
    debug("BSearch: f(%d) == true\n", mid);
    _end = mid;
  }
  else
  {
    debug("BSearch: f(%d) == false\n", mid);
    _begin = mid;
  }
  }
  return _end;
}


ll N,M,K,A,B,C,D,E;
int dp[NMAX] = {};

string S;
vec v;

ll ans = 0;

void solve(){
  // main algorithm

}
void debug(){
  // output debug information

}
void answer(){
  // output answer
  if(N <= K && M >= K) {
    cout << "Yes\n";
  }
  else {
    cout << "No\n";
  }
}
int main(int argc, char const *argv[])
{
  // operate inputs

  // Fill(dp, -1);
  cin >> N >> M >> K;
  solve();
  #ifdef DEBUG
  debug();
  #endif
  answer();

  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [0]*N
B = [0]*N
for i in range(N):
    A[i],B[i] = map(int,input().split(" "))

A.reverse()
B.reverse()
j = 0
for i in range(N):
    a = A[i] + j
    b = B[i]
    if a % b:
        j += b - a % b

print(j)

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

using namespace std;

int main() {
	int n;

	cin >> n;

	int A[n];

	for (int i = 0; i < n; i++) {
		A[i] = i + 1;
	}

	do {
		for (int i = 0; i < n; i++) {
			if (i == 0) cout << A[i];
			else cout << " " << A[i];
		}
		cout << endl;
	} while (next_permutation(A, A + n));
}




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

using namespace std;

#define INF (1ll << 62)
#define eb emplace_back
#define ii pair<int,int>
#define OK (cerr <<"OK"<< endl)
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define all(x) x.begin(), x.end()
#define Matrix vector<vector<int>>
#define Mat(n, m, v) vector<vector<int>>(n, vector<int>(m, v))
#define endl '\n'
const int MOD = 1e9 + 7;

signed main () {
  
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int a, b;

  cin >> a >> b;

  // a *= 100, b *= 100;

  for(int i = 0; i < 100000; i++) {
    if(floor(i * 0.08) == a && floor(i * 0.1) == b)
      return cout << i << endl, 0;
  }

  cout << -1 << endl;

}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{ 
  int n,i,min,w=0,b=0;
  scanf("%d",&n);
  char u[n];
  scanf("%s",&u[0]);
  
  for(i=0;i<n;i++)
    if(u[i]=='.') w++;
  min=w;
  for(i=0;i<n;i++){
    if(u[i]=='#') w++;
      else w--;
    if(min>w) min=w;
  }
  printf("%d",min);
  return 0;
}

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

int main()
{
    int n; 
    while(scanf("%d", &n) != EOF) 
    {
                      int m, y, d, cnt; 
                      while(n --) 
                      {
                              scanf("%d%d%d", &y, &m, &d) ;
                              int i, j;
                              cnt = 0;
                              cnt += (y - 1) / 3  * 5 + 195 * (y - 1);
                              if(y % 3 == 0) 
                                   cnt += (m - 1) * 20;
                              else 
                                   cnt += (m - 1) * 19 + m / 2;
                              cnt += d - 1; 
                              int ans = 196470 - cnt;
                              printf("%d\n", ans);
                      }
    } 
} 

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

int N;
vector<int> ls;
vector<int> use_mps;
vector<int> ABC(3);

int check(vector<int> &V){
  vector<int> ABC_cnt(4, 0);
  vector<int> ABC_length(4, 0);
  for(int i=0; i<V.size(); i++){
    ABC_cnt[V[i]]++;
    ABC_length[V[i]] += ls[i];
  }
  int mps=0;
  for(int i=0; i<3; i++){
    if(ABC_cnt[i]==0){
      return 1e9;
    }
    mps += 10*(ABC_cnt[i]-1);
  }
  for(int i=0; i<3; i++){
    mps += abs(ABC[i]-ABC_length[i]);
  }
  return mps;
}

void dfs(int depth, vector<int> V){
  if(depth == N){
    use_mps.push_back(check(V));
  }
  else {
    for(int i=0; i<4; i++){
      V[depth] = i;
      dfs(depth+1, V);
    }
  }
}

int main(){
  cin >> N >> ABC[0] >> ABC[1] >> ABC[2];
  int tmp;
  for(int i=0; i<N; i++){
    cin >> tmp;
    ls.push_back(tmp);
  }
  vector<int> V(N);
  dfs(0, V);
  int min = *min_element(use_mps.begin(), use_mps.end());
  cout << min << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct _OMAZINAI_ { _OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } __omazinai_instance__;
#define INF (1LL<<61 + 1<<29)
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
#define OddEven(x) {std::cout << ((x)%2?"Odd":"Even") << std::endl;}
#define ODDEVEN(x) {std::cout << ((x)%2?"ODD":"EVEN") << std::endl;}
typedef long long int ll;
void _INPUT_IMPL_() {};
template <class T, class... Args> void _INPUT_IMPL_(T& dest, Args&... args) { cin >> dest; _INPUT_IMPL_(args...); }
void _OUTPUT_IMPL_() {};
template <class T, class... Args> void _OUTPUT_IMPL_(T dest, Args... args) { cout<< dest << (sizeof...(Args)?" ":""); _OUTPUT_IMPL_(args...); }
#define in(type, ...) type __VA_ARGS__; _INPUT_IMPL_(__VA_ARGS__)
#define in_v(type, name, cnt) vector<type> name(cnt); loop(i, cnt) cin >> name[i];
#define sort_v(v) std::sort(v.begin(), v.end())
#define out(...) _OUTPUT_IMPL_(__VA_ARGS__)
//小さい方に寄る
#define space_op(x, y, a, b, c) ([](auto x_, auto y_, auto a_, auto b_, auto c_){if(x_<y_)return a_;if(x_>y_)return c_;return b_;}(x,y,a,b,c))
#define space_out(x, y, a, b, c) out(space_op(x, y, a, b, c))

int main() {
	in(string, _, s, __);
	out("A"s + s[0] + "C"s);
}

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

int con[300010];
int INF = 1e5;

signed main(){
    //cout << setprecision(16) ;
    ios::sync_with_stdio(false);
	cin.tie(0);

    ll n;
    cin>>n;
    ll a[n],b[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
    ll ans = 0;
    while(true){
        bool end = true;
        bool ng = true;
        for(int i=0;i<n;i++){
            if(b[i]!=a[i]) end = false;
            if(b[(i+n-1)%n] + b[(i+1)%n] < b[i]){
                ll t = (b[i]-a[i])/(b[(i+n-1)%n] + b[(i+1)%n]);
                ans += t;
                if(t!=0) ng = false;
                b[i] -= t*(b[(i+n-1)%n] + b[(i+1)%n]);
            }
        }
        if(end) break;
        if(ng){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout << ans << endl;

}

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

int main()
{

  char str[256];
  /* 4 棟、 3 階建、10 部屋 */
  static char room[4][3][10];   /* zero clear */
  int info;
  int b,f,r,v;
  int i,j,k;

  fgets(str, sizeof(str), stdin);
  sscanf(str, "%d", &info);

  for (i=0; i<info; i++) {
    fgets(str, sizeof(str), stdin);
    sscanf(str, "%d %d %d %d", &b,&f,&r,&v);
    room[b-1][f-1][r-1] += v;
  }

  for (k=0;k<4;k++) {
    for (j=0;j<3;j++) {
      for (i=0;i<10;i++) {
        printf(" %d", room[k][j][i]);
      }
      printf("\n");
    }
    if (k != 3) printf("####################\n");
  }

  return 0;
}

Measured memory_bytes: 616
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String A = sc.next();
		String a = A.substring(0, 1);
		String S = sc.next();
		String s = S.substring(0, 1);
		String C = sc.next();
		String c = C.substring(0, 1);
		System.out.println(a + s + c);
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>

using namespace std;

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)


#define all all(v) v.begin(),v.end()
#define INF i<<30
#define mp make_pair
#define pb push_back

#define fi first
#define se second

#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)

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

typedef long long ll;

#define EPS (1e-10)

int main(){
	/*
	int x,y,s;
	cin>>x>>y>>s;
	double t1 = (100.0+x)/100.0;
	double t2 = (100.0+y)/100.0;
	int w = 300;
	double a = w * t1;
	int b = a+EPS;
	cout<<b<<endl;
	return 0;
	*/
	while(1){
		int x,y,s;
		cin>>x>>y>>s;
		double t1 = (100.0+x)/100.0;
		double t2 = (100.0+y)/100.0;
		if(x==0)break;
		//cout<<"t1,t2: "<<t1<<" "<<t2<<endl;
		//printf("%lf %lf\n",t1,t2);
		int ma = 0;
		REP(i,1,s+1){
			REP(j,1,s+1){
				int a = double(i)*t1+EPS;
				int b = double(j)*t1+EPS;
				if(a+b==s){
					//cout<<"i,j: "<<i<<" "<<j<<endl;
					//cout<<"@a,b: "<<a<<" "<<b<<endl;
					int p = double(i)*t2+EPS;
					int q = double(j)*t2+EPS;
					//cout<<"@p,q: "<<p<<" "<<q<<" "<<p+q<<endl<<endl;;
					ma = max(ma,p+q);
				}
			}
		}
		cout<<ma<<endl;
	}
	return 0;
}

Measured memory_bytes: 3064
#include<iostream>

using namespace std;

int main(){
    long long n, d;
    cin >> n >> d;
    long long d2 = d * d, ans = 0;
    for(long long i = 0; i < n; i++){
        long long x, y;
        cin >> x >> y;
        if(d2 >= x * x + y * y) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int MX = 1000000001;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int cnt = 0;
    rep(i,n){
        cin >> a[i];
        if(a[i] < 0) cnt++; 
    }
    ll total  = 0;
    rep(i,n) total += abs(a[i]);
    if(cnt%2 == 1){
        int mn = MX;
        rep(i,n) mn = min(mn,abs(a[i]));
        // cout << abs(a[5]) << endl;
        // cout << mn << endl;
        total -= 2*mn;
    }

    cout << total << endl;
}


Measured memory_bytes: 3756
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////



int main() {
	ll R, G, B, N;
	cin >> R >> G >> B >> N;

	ll ans = 0;

	for (ll r = 0; r*R <= N; r++) {
		for (ll g = 0; g*G <= N; g++) {
			ll k = N - r * R - g * G;
			if (k >= 0 && k%B == 0) { ans++; }
		}
	}
	cout << ans;
	system("PAUSE");
}


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

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

    int ans = 1;
    for (int i = 1; i * i < m; i++) {
        if (m % i == 0) {
            if (m / i >= n) ans = max(ans, i);
            if (i >= n) ans = max(ans, m / i);
        }
    }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;	map<string,int> mp;
	for(ll i=0;i<n;i++)
	{
		string s;
		cin>>s;
		mp[s]++;
	 } 
	cout<<"AC x "<<mp["AC"]<<endl;
	cout<<"WA x "<<mp["WA"]<<endl;
	cout<<"TLE x "<<mp["TLE"]<<endl;
	cout<<"RE x "<<mp["RE"]<<endl;
	return 0;
}


Measured memory_bytes: 3632
h, w, k = map(int, input().split())
fi = []
for _ in range(h):
  s = input()
  fi.append(s)
a = 1 << h
b = 1 << w
ans = 0
for i in range(a * b):
  lh = [0 for _ in range(h)]
  lw = [0 for _ in range(w)]
  for j in range(h):
    if i & (1 << j):
      lh[j] += 1
  for j in range(w):
    if i & (1 << (j + h)):
      lw[j] += 1
  cnt = 0
  for j in range(h):
    for l in range(w):
      if lh[j] == 1:
        continue
      if lw[l] == 1:
        continue
      if fi[j][l] == '#':
        cnt += 1
  if cnt == k:
    ans += 1
print(ans)

Measured memory_bytes: 9244
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    vector<int> vec(5);
    
   for(int i = 0; i < 5; i ++){
       cin >> vec.at(i);
       
       if(vec.at(i) == 0){
           cout << i + 1 << endl;
       }
   }
   
   
}


Measured memory_bytes: 3516
N,A,B = gets.split(" ").map(&:to_i)

sums = 0

def positons_sum(num)
  sum = 0
  until num == 0
    sum += num%10
    num /= 10
  end
  return sum
end

(0..N).each do |n|
  sum = positons_sum(n)
  sums += n if A <= sum && sum <= B
end

puts sums


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}


int main(){
  queue<int> v[1000];
  int n,q;
  cin>>n>>q;
  lp(i,q){
    int a,b,c;
    cin>>a>>b;
    if(a==0){
      cin>>c;
      v[b].push(c);
    }
    if(a==1){
      if(v[b].empty()) 1; else
      cout<<v[b].front()<<endl;
    }
    if(a==2){
      if(v[b].empty()) 1; else
      v[b].pop();
    }
  }
  return 0;
}



Measured memory_bytes: 4332
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
    
    int n,s,l,p,m,f,w[410];
    int dp[410][410]={};
    
    cin >> n;
    for(int i=1;i<=n;i++){
        cin >> s >> l >> p;
        for(int j=0;j<400;j++){
            dp[i][j] = dp[i-1][j];
            for(int k=s;k<=l;k++){
                if(j-k < 0) continue;
                dp[i][j] = max(dp[i][j],dp[i][j-k]+p);
            }
        }
    }
    
    cin >> m;
    f = 0;
    for(int i=0;i<m;i++){
        cin >> w[i];
        if(dp[n][w[i]] == 0) f=1;
    }
    
    if(f == 0){
        for(int i=0;i<m;i++) cout << dp[n][ w[i] ] << endl;
    } else {
        cout << -1 << endl;
    }
    
    return(0);
}


Measured memory_bytes: 3768
package main

import (
	"fmt"
)

func main() {
	var a,b,c,k int
	fmt.Scan(&a,&b,&c,&k)
	
	ans := 0
	if k <= a {
		ans = k
	} else {
      	ans += a
		k -= a
      	if k > b {
          	k -= b
			ans -= k
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 1752