akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int h, w;
  cin >> h >> w;
  vector<vi> g(h + 2, vi(w + 2, -2));
  queue<pair<int, int>> q;
  rep2(i, 1, h + 1) rep2(j, 1, w + 1) {
    char c;
    cin >> c;
    if(c == '#') {
      g[i][j] = 0;
      q.push(P(i, j));
    } else
      g[i][j] = -1;
  }
  while(!q.empty()) {
    int i = q.front().first;
    int j = q.front().second;
    q.pop();
    rep(k, 4) {
      int ni = i + dir[k];
      int nj = j + dir[k + 1];
      if(g[ni][nj] != -1) continue;
      g[ni][nj] = g[i][j] + 1;
      q.push(P(ni, nj));
    }
  }
  int ans = 0;
  rep2(i, 1, h + 1) rep2(j, 1, w + 1) ans = max(ans, g[i][j]);
  cout << ans << endl;
}

Measured memory_bytes: 12432
#include <stdio.h>

void shift3(char *c)
{
	*c -= 3;
	if (*c < 'A'){
		*c = *c - 'A' + 'Z' + 1;
	}
}

int main(void)
{
	char crypt[1024];
	int i;

	scanf("%s", crypt);
	for (i = 0; crypt[i]; i++){
		shift3(crypt + i);
	}
	puts(crypt);

	return (0);
}

Measured memory_bytes: 524
moji = {a: b for a, b in zip("abcdefghijklmnopqrstuvwxyz", range(26))}

s = list(raw_input())
k = int(raw_input())

for i, e in enumerate(s):
    if e != "a":
        if 26 - moji[e] <= k:
            s[i] = "a"
            k -= 26 - moji[e]

k = k % 26 if k >= 0 else 0
if k != 0:
    s[-1] = "abcdefghijklmnopqrstuvwxyz"[(moji[s[-1]] + k) if moji[s[-1]]+k < 26 else moji[s[-1]] + k - 25]

print "".join(s)


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, x, ans = 0;
  while (true) {
    cin >> n >> x;
    if (n == 0 && x == 0) {
      break;
    }
    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        for (int k = j + 1; k <= n; k++) {
          if (i + j + k == x) {
            ans++;
          }
        }
      }
    }
    cout << ans << '\n';
    ans = 0;
  }
  return 0;
}



Measured memory_bytes: 3220
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<vector<vector<lli> > > box;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

lli N;
lli W;
vll w;
vll v;
lli w0;
box dp;
lli ans = 0;



int main(){
    cin >> N >> W;
    w = vll(N);v = vll(N);
    for(lli i = 0;i < N;i++) cin >> w[i] >> v[i];
    w0 = w[0];
    for(lli i = 0;i < N;i++) w[i] -= w0;
    N++;
    dp = box(N,mat(N,vll(N*4)));
    N--;
    for(lli i = 0;i < N;i++){
        for(lli j = 0;j < N;j++){
            for(lli k = 0;k < 4*N-w[i];k++){
                dp[i+1][j+1][k+w[i]] = max(dp[i+1][j+1][k+w[i]],dp[i][j][k]+v[i]);
                dp[i+1][j][k] = max(dp[i+1][j][k],dp[i][j][k]);
            }
        }
    }
    for(lli j = 0;j <= N;j++)for(lli k = 0;k <= 4*N;k++){
        if(w0*j+k <= W) ans = max(ans,dp[N][j][k]);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 33152
N, K = map(int, input().split())

h = list(int(input()) for _ in range(N))
sh = sorted(h, reverse=True)
ans = sh[0] - sh[K - 1]
for i in range(1, N - K + 1):
    if N < (i + K):
        break
    ans = min(ans, sh[i] - sh[i + K - 1])

print(ans)

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

#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define  DESC std::greater<int>() //sort 3rd arg


int main()
{
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	REP(i, n) cin >> a[i];
	
	sort(a.begin(), a.end());

	int ans = 0;
	REP(i, k) {
		ans += a[i];
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3628
#include<stdio.h>
#define A 100001

	typedef struct {
		int p,l,r;
	}Node;

	Node N[A];

	int D(int i,int d){
		if(N[i].p == -1) return d;
		else return D(N[i].p,d+1);
	}

	int main(){
		int n,m,i,j,id,ch,le;
		
		scanf("%d",&n);

		for(i=0; i<n; i++){
			N[i].p = -1;
			N[i].l = -1;
			N[i].r = -1;
		}

		for(i=0; i<n; i++){
			scanf("%d %d",&id,&m);
			for(j=0; j<m;j++){
				scanf("%d",&ch);
				if(j==0) N[id].l = ch;
				else N[le].r = ch;
				le = ch;
				N[le].p = id;
			}
		}

		for(i=0; i<n; i++){
			printf("node %d: parent = %d, depth = %d, ",i,N[i].p,D(i,0));
			if(N[i].p == -1) printf("root, ");
			else if(N[i].l == -1) printf("leaf, ");
			else printf("internal node, ");
			if(N[i].l == -1) printf("[]");
			else{
				printf("[%d",N[i].l);
				le = N[i].l;
				while(1){
					if(N[le].r == -1){
						printf("]");
						break;
					}
					else printf(",");
					printf(" %d",N[le].r);
					le = N[le].r;
				}
			}
			printf("\n");
		}

		return 0;
	}


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

using namespace std;

int main(){
    string s;
    cin >> s;
    int ans1;
    int ans2;
    
    for (int i = 0; i < s.length(); i++){
        if (s[i] == 'A'){
            ans1 = i;
            break;
        }
    }
    
    for (int i = ans1; i < s.length(); i++){
        if (s[i] == 'Z'){
            ans2 = i;
        }
    }
    
    cout << (ans2 - ans1) + 1 << endl;
    
    
}

Measured memory_bytes: 640
import math
n,d = map(int,input().split())
l = [list(map(int,input().split()))for i in range(n)]
x,y = [list(i) for i in zip(*l)]
p = 0
for i in range(n):
    if math.sqrt(x[i] ** 2 + y[i] ** 2) <= d:
        p += 1
print(p)

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

int main(){

    string s,t;
    cin>>s>>t;

    vector<pair<char,char> > a,b;

    rep(i,s.size()){
        a.push_back({s[i],t[i]});
        b.push_back({t[i],s[i]});
    }

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

    bool f=true;

    for(int i=1;i<s.size();i++){
        if(a[i].first==a[i-1].first){
            if(a[i].second!=a[i-1].second){
                f=false;
                break;
            }
        }
    }

    for(int i=1;i<s.size();i++){
        if(f==false) break;
        if(b[i].first==b[i-1].first){
            if(b[i].second!=b[i-1].second){
                f=false;
            }
        }
    }

    if(f){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

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

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) (a).begin(),(a).end()

template<typename T1, typename T2> inline void chkmin(T1 & x, const T2 & y) {if (y < x) x = y;}
template<typename T1, typename T2> inline void chkmax(T1 & x, const T2 & y) {if (x < y) x = y;}

void read() {
	int l, r, a, ans = 0;
	cin >> l >> r >> a;
	for (int i = l; i <= r; i++) {
		ans += i % a == 0;
	}
	cout << ans << endl;
}

void run() {

}

void write() {

}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(20), cout.setf(ios::fixed);
	read();
	run();
	write();
	return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int a[200000],b[200000],n,s;
int main()
{
    cin>>n;
    for(int i=1;i<=n+1;i++)
    {
        if(i<=n)
            cin>>a[i];
        s+=abs(a[i]-a[i-1]);
        if(i>1)
            b[i-1]=abs(a[i-1]-a[i-2])+abs(a[i-1]-a[i])-abs(a[i]-a[i-2]);
    }
    for(int i=1;i<=n;i++)
        cout<<s-b[i]<<" ";
    return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <vector>
#include <limits>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>
#include <deque>
#include <algorithm>

using namespace std;
using namespace boost;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    uint N;
    cin >> N;
    deque<uint> d(N, numeric_limits<int>::max());
    for (auto &&i: irange(0U, N)) {
        cin >> d.at(i);
    }
    sort(d.begin(), d.end());
    uint count{0};
    // d[head-1] == head and d[head]==head+1
    while (!d.empty()) {
//        cout << endl;
        uint head = d.front();
//        cout << "head: " << head << " d.size: " << d.size() << endl;
        if (head < d.size()) {
//            cout << "head < d.size()" << endl;
//            cout << "d.at(head-1): " << d.at(head - 1) << " d.at(head): " << d.at(head) << endl;
            if (d.at(head - 1) == head && d.at(head) != head) {
                for (auto &&i: irange(0U, head)) {
                    d.pop_front();
                }
                continue;
            }
        } else if (head == d.size()) {
//            cout << "head == d.size()" << endl;
//            cout << "d.at(head-1): " << d.at(head - 1) << endl;
            if (d.at(head - 1) == head) {
                for (auto &&i: irange(0U, head)) {
                    d.pop_front();
                }
                continue;
            }
        }
//        cout << "else" << endl;
        count++;
        d.pop_front();
    }
    cout << count;
    return 0;
}

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

int main() 
{
	string S;
	cin >> S;

	int l = S.length();

	int a = 0, b = 0;

	for (int i = 0; i < l; ++i)
	{
		if (i % 2 == 0)
		{


			
			if (S[i] == '0')
			{
				++b;
			}
			else
			{
				++a;
			}




		}
		else
		{
			


			if (S[i] == '0')
			{
				++a;
			}
			else
			{
				++b;
			}



		}

	}

	cout << min(a,b) << endl;


}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
#define pb push_back
#define mp make_pair
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
const int INF = 1<<28;
const ll MOD = 1000000007;

int n, p, s1, s2, l1, l2;
void sternBrocot(int p, int n, int pl, int ql, int pr, int qr) {
	int pm = pl + pr, qm = ql + qr;
	if(pm > n || qm > n)
		return;
	if(pm * pm  > p * qm * qm) {
		l1 = pm; l2 = qm;
		sternBrocot(p, n, pl, ql, pm, qm);
	}
	else {
		s1 = pm; s2 = qm;
		sternBrocot(p, n, pm, qm, pr, qr);
	}
}
int main() {
	while(cin >> p >> n, p|n) {
		sternBrocot(p, n, 0, 1, 1, 0);
		cout << l1 << '/' << l2 << ' ' << s1 << '/' << s2 << endl;
	}
	return 0;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define P pair<int,int>
typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//s.find(w[i])==string::npos
//findの使い方

long long int n,cnt=0,ans=0,a,b,c,cmp,data,m,h,x,y;

string s,w;

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

	cin >> n >> a >> b;
	rrep(i,0,10000){
	   if(a+1==b && a-1==0){
	       cout << "Borys" << endl;
	       return 0;
	   }
	   if(a+1==b){
	       a--;
	   }
	   else if(a-1==0){
	       a++;
	   }
	   else{
	       a++;
	   }
	   
	   if(b-1==a && b==n){
	       cout << "Alice" << endl;
	       return 0;
	   }
	   
	   if(b==n){
	       b--;
	   }
	   else if(b-1==a){
	       b++;
	   }
	   else{
	       b--;
	   }
	   
	  
	    
	}
	cout << "Draw" << endl;
return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        int W = sc.nextInt();
        if(S <= W){
            System.out.println("unsafe");
        }else{
            System.out.println("safe");
        }
    }

}


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

int main() {
  int W, H, w=0, h=0, n;
	cin >> W >> H >> n;
	while (n--) {
    int x, y, a;
		cin >> x >> y >> a;
		if(a==1) w = max(w, x);
		if(a==2) W = min(W, x);
		if(a==3) h = max(h, y);
		if(a==4) H = min(H, y);
	}
	cout << (w<W && h<H ? (W-w)*(H-h) : 0) << endl;
}

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

int main(){
    int n;
    cin >> n;
    int s[n];
    for(int i=0; i<n; i++){
        cin >> s[i];
    }
    sort(s,s+n);
    int sum = 0;
    for(int i=0; i<n; i++){
        sum += s[i];
    }
    if(sum % 10 == 0){
        int i;
        for(i=0; i<n+1; i++){
            if(i == n) break;
            if(s[i] % 10 != 0) break;
        }
        if(i == n) cout << 0 << endl;
        else cout << sum - s[i] << endl;
    }
    else cout << sum << endl;
    return 0;
}


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

int cnt=1;
int n;
bool color[8];

int dfs(int u,vector<vector<int>> &g){
    bool clear = true;

    int ans = 0;

    for(int i=0; i<n; i++){
        if(!color[i]){
            clear = false;
        }
    }

    if(clear) return 1;

    for(auto a : g[u]){
        if(color[a]) continue;

        color[a] = true;
        ans += dfs(a,g);
        color[a] = false;
    }

    return ans;
}

int main(){
    int m;
    cin>>n>>m;
    vector<vector<int>> g(n,vector<int>());

    for(int i=0; i<m; i++){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    for(int i=0; i<n; i++){
        color[i] = false;
    }

    color[0] = true;

    cout<<dfs(0,g)<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a,b,c;
	int tmp;

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

	if(c <= a)
	{
		tmp = a;
		a = c;
		c = tmp;
	}
	if(b <= a)
	{
		tmp = a;
		a = b;
		b = tmp;
	}
	if(c <= b)
	{
		tmp = c;
		c = b;
		b = tmp;
	}

	printf("%d %d %d\n",a,b,c);
	return 0;
}

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

int main(){
  string t, p;
  cin >> t >> p;
  if (t.size() < p.size()) return 0;
  for (int i = 0; i <= t.size() - p.size(); i++) {
    string str = t.substr(i, p.size());
    if (str == p) {
      cout << i << endl;
    }
  }
}



Measured memory_bytes: 3184
N = int(input())
A = [int(a) for a in input().split()]

M = 10**6
P = [0]*(M+1)
for i in range(2, M+1):
    if P[i] == 1:
        continue
    P[i] = -1
    j = 2*i
    while j <= M:
        P[j] = 1
        j += i

L = [0]*(M+1)
for a in A:
    L[a] += 1

num = 0
for i in range(2, M+1):
    if P[i] > -1:
        continue
    cnt = 0
    j = i
    while j <= M:
        cnt += L[j]
        j += i
    num = max(num, cnt)


if num == 1 or max(A) == 1:
    print("pairwise coprime")
elif num == N:
    print("not coprime")
else:
    print("setwise coprime")

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

using namespace std;

#define ll long long
#define ld long double
#define ull unsigned long long
#define __ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int maxn = 2e5 + 10;
int a[maxn];
bool vis[maxn];

int main() {
    __;
    int n, x;
    cin >> n >> x;
    if (x == 1 || x == 2 * n - 1) {
        cout << "No" << endl;
        return 0;
    }
    if (x <= n) {
        a[n] = x;
        a[n - 1] = x - 1;
        vis[x - 1] = 1;
        vis[x] = 1;
    } else {
        a[n - 1] = x;
        a[n] = x + 1;
        vis[x] = 1;
        vis[x + 1] = 1;
    }
    int p = 1;
    for (int i = 1; i < n - 1; ++i) {
        while (vis[p] == 1)++p;
        a[i] = p;
        vis[p] = 1;
    }
    for (int i = n + 1; i < n + n; ++i) {
        while (vis[p] == 1)++p;
        a[i] = p;
        vis[p] = 1;
    }
    cout << "Yes" << '\n';
    for (int i = 1; i < n + n; ++i) { cout << a[i] << '\n'; }
    return 0;
}

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

int main(){
    long long N,A,B;
    cin >> N >> A >> B;
    if(A+B-1>N || A*B<N){
        cout << "-1" << endl;
        return 0;
    }

    long long W=N-(A+B-1);
    cout << B;
    for(int i=B-1;i>=1;i--) cout << " " << i;
    int max=B;
    for(int j=2;j<=A;j++){
        if(W>=B-1){
            for(int i=B;i>=1;i--) cout << " " << (max+i);
            max+=B;
            W-=(B-1);
        }else{
            for(int i=W+1;i>=1;i--) cout << " " << (max+i);
            max+=(W+1);
            W=0;
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 2176
//WA:
//1. corner case, e.g. jump[k][1]>b then jump[k][0]<b
//2. last node should not be nth, cause it will loop and accept in range, so make an extra node n+1

//http://arc060.contest.atcoder.jp/tasks/arc060_c

#define IOS ios_base::sync_with_stdio(false);\
cin.tie(NULL);cout.tie(NULL);
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll x[100010];
ll jump[100010][35];
ll cost[100010][35];
map<ll,ll> mp;

ll Find(ll a,ll b)
{
    ll i,j,k,l;
    ll ans=0;
    k=a;
    for(i=25;i>=0;i--)
    {
        l=jump[k][i];
//        cout<<k<<' '<<l<<' '<<i<<'\n';
        if(l>b) continue;
//        ans+=i;
        ans+=cost[k][i];
        k=l;
//        cout<<ans<<'.'<<'\n';
    }

    if(k<b && x[k]!=x[b]) ans++;
//    else if(k<b) ans++;
//    cout<<ans<<"#\n";
    return ans;
}

int main()
{
    IOS;
    ll i,j,k,l;
    ll n,m,L,a,b;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>x[i];
    }

    cin>>L;
    x[n+1]=10000000000;
    j=1;
    for(i=1;i<=n;i++)
    {
        while(x[j]-x[i]<=L) j++;
        jump[i][0]=j-1;
        cost[i][0]=1;
//        cout<<i<<' '<<j-1<<"!\n";
    }

    //special case
    jump[n][0]=n+1;
    cost[n][0]=x[n+1];
    jump[n+1][0]=n+1;
    cost[n+1][0]=x[n+1];
    int WA=1;

//    cout<<jump[2][0]<<"!\n";

    for(j=1;j<=25;j++)
    {
        for(i=1;i<=n+WA;i++)
        {
            jump[i][j]=jump[jump[i][j-1]][j-1];
            cost[i][j]=cost[i][j-1]*2; //wa, overcounting cost[n][j].
//            if(jump[i][j-1] < jump[i][j]) cost[i][j]=cost[i][j-1]*2;
//            cout<<i<<' '<<j<<' '<<jump[i][j]<<' '<<jump[i][j-1]<<'.'<<'\n';
//            if(jump[2][0]==10) cout<<i<<' '<<j<<' '<<jump[i][j-1]<<"!\n";
//            if(j==0) cout<<"_____\n";
        }
    }

    ll q;
//    cout<<jump[2][0]<<"!\n";
    cin>>q;
    while(q--){
        cin>>a>>b;
        if(a>b) swap(a,b);
        cout<<Find(a,b)<<'\n';
    }
}






//9
//1 3 6 13 15 18 19 29 31
//10
//4
//1 8
//7 3
//6 7
//8 5

//9
//1 3 6 13 15 18 19 29 31
//10
//1
//1 8

//WA:
//9
//1 3 6 13 15 18 19 29 31
//10
//3
//1 9
//2 8
//2 6




//9
//1 3 6 13 15 18 19 29 31
//10
//72
//1 2
//1 3
//1 4
//1 5
//1 6
//1 7
//1 8
//1 9
//2 1
//2 3
//2 4
//2 5
//2 6
//2 7
//2 8
//2 9
//3 1
//3 2
//3 4
//3 5
//3 6
//3 7
//3 8
//3 9
//4 1
//4 2
//4 3
//4 5
//4 6
//4 7
//4 8
//4 9
//5 1
//5 2
//5 3
//5 4
//5 6
//5 7
//5 8
//5 9
//6 1
//6 2
//6 3
//6 4
//6 5
//6 7
//6 8
//6 9
//7 1
//7 2
//7 3
//7 4
//7 5
//7 6
//7 8
//7 9
//8 1
//8 2
//8 3
//8 4
//8 5
//8 6
//8 7
//8 9
//9 1
//9 2
//9 3
//9 4
//9 5
//9 6
//9 7
//9 8
//answer
//1
//1
//2
//2
//3
//3
//4
//5
//1
//1
//1
//2
//2
//2
//3
//4
//1
//1
//1
//1
//2
//2
//3
//4
//2
//1
//1
//1
//1
//1
//2
//3
//2
//2
//1
//1
//1
//1
//2
//3
//3
//2
//2
//1
//1
//1
//2
//3
//3
//2
//2
//1
//1
//1
//1
//2
//4
//3
//3
//2
//2
//2
//1
//1
//5
//4
//4
//3
//3
//3
//2
//1



Measured memory_bytes: 56320
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int N,K;
  int l[55];
  int ans = 0;
  
  cin >> N >> K;
  for(int i = 0;i < N;i ++)cin >>l[i];
  
  sort(l,l + N,greater<int>());
  
  for(int i = 0;i < K;i ++){
    
    ans += l[i];
    
  }
  cout << ans <<endl;
}
 


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

void solve(){
	int n;
	cin >> n;
	cout << (n/500)*1000+((n-((n/500)*500))/5)*5;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t=1;
    while(t--)
    {
        solve();
    }

}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
 
#define UNION_FIND_MAX 200
 
int uf_table[UNION_FIND_MAX];
 
void uf_init(void) {
    int i;
    for(i=0;i<UNION_FIND_MAX;i++)uf_table[i]=0;
}
 
void uf_merge(int a,int b) {
    int next;
    while(uf_table[a]>0) {
        next=uf_table[a]-1;
        if(uf_table[next]>0)uf_table[a]=uf_table[next];
        a=next;
    }
    while(uf_table[b]>0) {
        next=uf_table[b]-1;
        if(uf_table[next]>0)uf_table[b]=uf_table[next];
        b=next;
    }
    if(a!=b)uf_table[a]=b+1;
}
 
int uf_issame(int a,int b) {
    int next;
    while(uf_table[a]>0) {
        next=uf_table[a]-1;
        if(uf_table[next]>0)uf_table[a]=uf_table[next];
        a=next;
    }
    while(uf_table[b]>0) {
        next=uf_table[b]-1;
        if(uf_table[next]>0)uf_table[b]=uf_table[next];
        b=next;
    }
    return a==b;
}
 
typedef struct {
    int id,tb_time;
} island_t;
 
typedef struct {
    int a,b,cost;
} bridge_t;
 
/* desc */
int tbt_comp(const void* x,const void* y) {
    int tbx=((const island_t*)x)->tb_time;
    int tby=((const island_t*)y)->tb_time;
    if(tbx<tby)return 1;
    if(tbx>tby)return -1;
    return 0;
}
 
/* asc */
int cost_comp(const void* x,const void* y) {
    int cx=((const bridge_t*)x)->cost;
    int cy=((const bridge_t*)y)->cost;
    if(cx>cy)return 1;
    if(cx<cy)return -1;
    return 0;
}
 
int main(void) {
    int N,M;
    while(scanf("%d%d",&N,&M)==2 && (N|M)!=0) {
        static island_t islands[200];
        static int iss_taio[200];
        static bridge_t bridges[200*199];
        int i,j;
        int answer;
        int connect_count;
        for(i=0;i<N;i++) {
            islands[i].id=i;
            scanf("%d",&islands[i].tb_time);
        }
        for(i=0;i<M;i++) {
            scanf("%d%d%d",&bridges[i].a,&bridges[i].b,&bridges[i].cost);
            bridges[i].a--;
            bridges[i].b--;
        }
        qsort(islands,N,sizeof(island_t),tbt_comp);
        qsort(bridges,M,sizeof(bridge_t),cost_comp);
        for(i=0;i<N;i++)iss_taio[islands[i].id]=i;
        uf_init();
        answer=0;
        connect_count=0;
        for(i=0;i<N;i++) {
            while(i+1<N && islands[i].tb_time==islands[i+1].tb_time)i++;
            for(j=0;j<M;j++) {
                if(islands[iss_taio[bridges[j].a]].tb_time>=islands[i].tb_time &&
                islands[iss_taio[bridges[j].b]].tb_time>=islands[i].tb_time) {
                    if(!uf_issame(bridges[j].a,bridges[j].b)) {
                        uf_merge(bridges[j].a,bridges[j].b);
                        answer+=bridges[j].cost;
                        connect_count++;
                    }
                }
            }
            if(connect_count<i) {
                /* can't connect all islands */
                uf_init();
                answer=0;
                connect_count=0;
            }
        }
        printf("%d\n",answer);
    }
    return 0;
}


Measured memory_bytes: 2248
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define N int(1e5+1)
#define M 998244353
LL power(LL x, LL y) 
{ 
	LL res = 1;
	while(y>0)
	{ 
		if (y%2) 
			res = res*x,
			res %= M;
		y = y/=2;
		x = x*x;
		x %= M;
	} 
	return res; 
}
int main()
{
	LL count_array[N],prod=1,n,i;
	int a,maxindex=0,first;
	cin>>n;
	for(i=0;i<N;i++)
		count_array[i]=0;
	for(i=0;i<n;i++)
	{
		cin>>a;
		if(i==0)first=a;
		maxindex=max(maxindex,a);
		count_array[a]++;
	}
	for(i=0;i<maxindex;i++)
		prod=(prod*power(count_array[i],count_array[i+1]))%M;
	if(count_array[0]==1 and first==0)
		cout<<prod<<endl;
	else
		cout<<"0\n";
	return 0;
}

Measured memory_bytes: 1152
N,M = map(int,input().split())
bucket = {}
for i in range(N):
  bucket[i] = 0
for m in range(M):
  tempa,tempb = map(int,input().split())
  bucket[tempa-1] += 1
  bucket[tempb-1] += 1
for i in range(N):
  print(bucket[i])


Measured memory_bytes: 2940
import java.util.Scanner;

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

		Scanner s = new Scanner(System.in);

		while (true) {
			String str = s.next();
			if (str.equals("#"))
				break;

			int count = 0;
			char[] rl = new char[str.length()];

			for (int i = 0; i < str.length(); i++) {
				rl[i] = WhichHands(str.charAt(i));
			}

			for (int i = 0; i < str.length() - 1; i++) {
				if (rl[i] != rl[i + 1])
					count++;
			}

			System.out.println(count);

		}
		s.close();
	}

	public static char WhichHands(char c) {
		char[] left = { 'q', 'w', 'e', 'r', 't', 'a', 's', 'd', 'f', 'g', 'z',
				'x', 'c', 'v', 'b' };
		char[] right = { 'y', 'u', 'i', 'o', 'p', 'h', 'j', 'k', 'l', 'n', 'm' };

		char ans = 'l';

		for (int x = 0; x < right.length; x++) {
			// if (left[x] == c)
			// ans = 'l';
			if (right[x] == c)
				ans = 'r';
		}
		return ans;
	}
}

Measured memory_bytes: 20404
#include <bits/stdc++.h>
using namespace std;
// rep macro
#define rep(i, n)        for (int i = 0; i < (int)(n); i++)
#define rev(i, n)        for (int i = (int)(n - 1); i >= 0; i--)
#define rep2(i, s, n)    for (int i = (s); i < (int)(n); i++)
#define rev2(i, s, n)    for (int i = (int)(n) - 1; i >= (int)(s); i--)
#define bitrep(i, n)     for (int i = 0; i < (1 << (int)(n)); i++)
#define bitrep2(i, s, n) for (int i = (s); i < (1 << (int)(n)); i++)
const int di[8] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dj[8] = {0, 1, 0, -1, -1, 1, 1, -1};
// type macro
using ll = int64_t;
// vector macro
#define all(v) v.begin(), v.end()
using  vi = vector<int>;
using vvi = vector<vector<int>>;
using  vu = vector<size_t>;
using vvu = vector<vector<size_t>>;
using  vl = vector<ll>;
using vvl = vector<vector<ll>>;
using  vd = vector<double>;
using vvd = vector<vector<double>>;
using  vb = vector<bool>;
using vvb = vector<vector<bool>>;
using  vc = vector<char>;
using vvc = vector<vector<char>>;
using  vs = vector<string>;
using vvs = vector<vector<string>>;
// pair macro
#define fi first
#define sj second
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
// math macro
#define lcm(a, b) a / __gcd(a, b) * b
#define dist(a, b) sqrt(pow(a.fi - b.fi, 2) + pow(a.sj - b.sj, 2))
// print macro
#define println(x) cout << x << endl
#define Yes println("Yes")
#define No println("No")
#define YES println("YES")
#define NO println("NO")
// memo
// desc sort: sort(vec.begin(), vec.end(), greater<int>());#include "header.h"

using namespace std;

void dfs(int n, vector<vector<int>>& ki, vector<int>& c, vector<bool>& seen)
{
  if (ki[n].size() == 0) return;
  seen[n] = true;
  for (int i = 0; i < ki[n].size(); i++)
  {
    if (seen[ki[n][i]]) continue;
    c[ki[n][i]] += c[n];
    dfs(ki[n][i], ki, c, seen);
  }
}

int main()
{
  int n, q; cin >> n >> q;
  vector<vector<int>> ki(n, vector<int>());
  for (int i = 0; i < n - 1; i++)
  {
    int a, b; cin >> a >> b; a--; b--;
    ki[a].push_back(b);
    ki[b].push_back(a);
  } 
  vector<int> c(n, 0);
  for (int i = 0; i < q; i++)
  {
    int p, x; cin >> p >> x; p--;
    c[p] += x;
  }
  vector<bool> seen(n, false);
  dfs(0, ki, c, seen);
  for (int i = 0; i < n; i++)
  {
    cout << c[i];
    if (i == n - 1) cout << endl;
    else cout << " ";
  }
}

Measured memory_bytes: 30696
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define boost ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define pii pair<int,int>
#define forn(i,n) for(int i=0;i<n;i++)
#define Forn(i,n) for(int i=1;i<=n;i++)
#define F first
#define S second
int main()
{
      boost;
      int n,x;
      cin>>n;
      vector<int> v1,v2(n+2);
      v1.pb(0);
      for(int i=0;i<n;i++)
      {
            cin>>x;
            v1.pb(x);
      }
      v1.pb(0);
      v2[0]=v1[0];
      for(int i=1;i<v1.size();i++)
      {
            v2[i]=v2[i-1]+abs(v1[i-1]-v1[i]);
      }
      //for(int i=0;i<v2.size();i++)
      //cout<<v2[i]<<" ";
      for(int i=1;i<v1.size()-1;i++)
      {
            int x=v2[i-1];
            int y=abs(v1[i-1]-v1[i+1]);
            int z=v2[v2.size()-1]-v2[i+1];
            cout<<x+y+z<<endl;
      }
}


Measured memory_bytes: 2168
#pragma region // {{{ by unolight
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define RALL(x) rbegin(x),rend(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

namespace { namespace unolight {
// Read Input
template<class T> void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( int64_t &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }
void R() {}
template<class T, class... U> void R( T& head, U&... tail ) { _R(head); R(tail...); }
// Write Output
template<class T> void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
void _W( const int64_t &x ) { printf("%" PRId64,x); }
void _W( const double &x ) { printf("%.16f\n",x); }
void _W( const char &x ) { putchar(x); }
void _W( const char *x ) { printf("%s",x); }
template<class T> void _W( const vector<T> &x ) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W( const T& head, const U&... tail ) { _W(head); putchar(sizeof...(tail)?' ':'\n'); W(tail...); }

#ifdef UNOLIGHT
#include "dump.hpp"
#else
#define dump(...)
#endif

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}
#pragma endregion // }}}

void main() {
    int n;
    R(n);
    int x=0,y=0;
    REP(i,n) {
        int a, b;
        R(a,b);
        if ( chmax(x,a) ) y=b;
    }
    W(x+y);
}

}} // {{{ main
int main() { unolight::main(); return 0; }
// }}}

Measured memory_bytes: 3776
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }

string S, T; int A, B; string U;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> S >> T >> A >> B >> U;
 
	if (S == U) A--;
	else B--;
 
	printf("%d %d\n", A, B);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define L 100005
int min(int a,int b){ return a<b?a:b; }
int head,tail;
typedef struct pp{
	char name[100];
	int t;
} P;

P Q[L];
void enqueue(P x){
	Q[tail] = x;
	tail = (tail+1)%L; 
}
P dequeue(){
	P x = Q[head];
	head = (head+1)%L;
	return x;
}

int main(){
	int n,q,i,time = 0,c;
	scanf("%d %d",&n,&q);
	for(i=1;i<=n;i++)
		scanf("%s %d",Q[i].name,&Q[i].t);
	head = 1;tail = n+1;
	while(head!=tail){
		P u = dequeue();
		c = min(q,u.t);
		u.t -= c;
		time += c;
		if(u.t) enqueue(u);
		else printf("%s %d\n",u.name,time);
	}
	return 0;
}


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

int main()
{
	int N, K;
	string S;
	cin >> N;
	cin >> K;
	cin >> S;
	S[K - 1] = tolower(S[K - 1]);
	cout << S << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;
typedef long long LL;
#define FOR(i, a, b) for(LL i=(LL)(a);i<(LL)(b);i++)
#define REP(i,x) for(LL i=0;i<(LL)(x);i++)

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    // cout << fixed << setprecision(10);
    LL a, b, c, d;
    cin >> a >> b >> c >> d;
    while((a > 0) && (c > 0))
    {
        c -= b;
        if(c <= 0)
        {
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if(a <= 0)
        {
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  
  if ((s[0] == s[1]) && (s[1] == s[2]))
    cout << "Yes" << endl;
  else if((s[1] == s[2]) && (s[2] == s[3]))
  	cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
//#include<atcoder/all>

using namespace std;
//using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){
  
  string s;
  cin >> s;
  if(s.back() == 's')cout << s << "es\n";
  else cout << s << "s\n";


  return 0;
}

Measured memory_bytes: 3592
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0

for i in range(0, a+1):
    for j in range(0, b+1):
        for k in range(0, c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1

print(ans)


Measured memory_bytes: 39536
#9-3

n = int(input())
t_s = 0
h_s = 0
for i in range(n):
  a,b = input().split()
  if a<b:
    h_s+=3
  elif a>b:
    t_s+=3
  else:
    t_s+=1
    h_s+=1
print(t_s, h_s)
    


Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
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;}
//自作関数
template<class T> ll llpow(T x,T n){ll ans=1;while(n--){ans*=x;}return ans;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int n;
int main(){
    cin>>n;
    vector<int> a(n);
    rep(i,n)cin>>a.at(i);
    sort(a.begin(),a.end());
    vector<int> sect(100010);
    for(int i=0;i<100000;i++){
        sect[i]=upper_bound(a.begin(),a.end(),i+2)-lower_bound(a.begin(),a.end(),i);
    }
    sort(sect.begin(),sect.end(),greater<int>());
    cout<<sect.at(0)<<endl;
    return 0;
}




Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    int N;
    cin >> N;
    int A[N];
    rep(i,N) cin >> A[i];
    lint ans=pow(3,N);
    lint minus=1;
    rep(i,N) if(A[i]%2==0) minus*=2;
    ans-=minus;
    cout << ans << endl;
}

Measured memory_bytes: 640
# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
#     combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

def readInt():
    return list(map(int,input().split()))

def main():
    k = int(input())
    a,b = readInt()
    for i in range(a,b+1):
        if i%k==0:
            print("OK")
            return
    print("NG")
    return

if __name__=='__main__':
    main()

Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
scanf("%d%d",&a,&b);
int t1=a-b;
int t2=a+b;
int t3=a*b;
int ans=max(t3,max(t1,t2));
cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
import sys


k,t=map(int,input().split())
a=list(map(int,input().split()))
if(t==1):print(k-1)
else:
    eaten=-1
    ma=0
    s=sum(a)
    for i in range(s):
        nothing=1
        for j in range(len(a)):
            if(a[j]>ma and j!=eaten):
                ma=a[j]
                keep=j
                nothing=0
        
        if(nothing):
            print(max(a))
            sys.exit()
        else:
            eaten=keep
            a[eaten]-=1
            ma=0
    print(0)

Measured memory_bytes: 3064
using System;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        
        string[] a = Console.ReadLine().Split('/');
        string s = "";
        for(int i = 0; i < a.Length; i++)
        {
            s += a[i];
        }
        int x = int.Parse(s);
        if(x <= 20190430) Console.WriteLine("Heisei");
        else Console.WriteLine("TBD");
        
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <set>
#include <functional>
using namespace std;

int main() {
  int w, h;
  while(cin >> w >> h, w || h) {
    set<pair<int, int> > blacks;
    for(int y = 0; y < h; ++y) for(int x = 0; x < w; ++x) {
      int d;
      cin >> d;
      if(d) blacks.insert(make_pair(y, x));
    }
    function<void(int, int)> countIslands = [&](int y, int x) {
      if(blacks.count(make_pair(y, x))) {
        blacks.erase(make_pair(y, x));
        int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
        int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
        for(int i = 0; i < 8; ++i) countIslands(y + dy[i], x + dx[i]);
      }
    };
    int ans = 0;
    while(!blacks.empty()) {
      countIslands((*begin(blacks)).first, (*begin(blacks)).second);
      ++ans;
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1596
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

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


int main(){
ll a,b,t;
cin>>a>>b>>t;
a=a*10;
t=t*10+5;
cout<<t/a*b<<endl;
}









Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int main()
{
    int d, g;
    cin >> d >> g;
    vector<int> v;
    rep(i,d){
        v.push_back(i);
    }
    vector<int> p(d), c(d);
    rep(i,d){
        cin >> p[i] >> c[i];
    }
    int ans = 10000000;
    do{
        int point = 0;
        int cnt = 0;
        for(auto e:v){
            cnt += p[e];
            point += p[e] * (e + 1) * 100 + c[e];
            if(point >= g){
                rep(i,p[e]){
                    if(i == 0){
                        point -= c[e] + (e + 1) * 100;
                    }else{
                        point -= (e + 1) * 100;
                    }
                    if(point < g){
                        break;
                    }
                    cnt--;
                }
                break;
            }
        }
        ans = min(cnt, ans);
        cnt = 0;
    } while (next_permutation(v.begin(), v.end()));
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,j,k,l,m;
  int a[11][11];
  int b[7][4][4]={{
      {1,1,0,0},
      {1,1,0,0},
      {0,0,0,0},
      {0,0,0,0}},{
      {1,0,0,0},
      {1,0,0,0},
      {1,0,0,0},
      {1,0,0,0}},{
      {1,1,1,1},
      {0,0,0,0},
      {0,0,0,0},
      {0,0,0,0}},{
      {0,1,0,0},
      {1,1,0,0},
      {1,0,0,0},
      {0,0,0,0}},{
      {1,1,0,0},
      {0,1,1,0},
      {0,0,0,0},
      {0,0,0,0}},{
      {1,0,0,0},
      {1,1,0,0},
      {0,1,0,0},
      {0,0,0,0}},{
      {0,1,1,0},
      {1,1,0,0},
      {0,0,0,0},
      {0,0,0,0}}};
  char s[9];
  for(;;){
    for(i=0;i<11;i++)
      for(j=0;j<11;j++)
	a[j][i]=0;
    for(i=0;i<8;i++){
      if(scanf("%s",s)==-1)
	break;
      for(j=0;j<8;j++)
	a[j][i]=s[j]-'0';
    }
    if(i!=8)
      break;
    for(i=0;i<7;i++){
      for(j=0;j<8;j++){
	for(k=0;k<8;k++){
	  for(l=0;l<4;l++){
	    for(m=0;m<4;m++){
	      if(a[j+l][k+m]!=b[i][m][l])
		break;
	    }
	    if(m!=4)
	      break;
	  }
	  if(l==4){
	    printf("%c\n",'A'+i);
	    break;
	  }
	}
	if(k!=8)
	  break;
      }
      if(j!=8)
	break;
    }
  }
  return 0;
}

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

#define itn long long
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)(n);i>=0;--i)
#define debug(x) cout << #x << "=" << (x) << endl;
const ll MOD=1e9+7;

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;}
template<typename T> void fail(T v){cout << v << endl;exit(0);}
//template end

void solve(){
  while(true){
    int r,w,C,R;
    cin>>r>>w>>C>>R;
    if(!(r|w|C|R))return;
    cout<<max(0,(C*w-r+R-1)/R)<<endl;
  }
}
 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  solve();
  return 0;
}


Measured memory_bytes: 3160
#include<stdio.h>
	int main(void)
{
	int x, i, a=0;
	scanf("%d", &x);
	for(i=1;i<=x;i++)
	{
		if(i%3==0){
	 printf(" %d",i);
		} 
		else{
			if(i%10==3){
			printf(" %d",i);
			}	
		else{
			a = i;
			while(a!=0){
				if(a%10!=3){
					a = a/10;
				}
				else{
					printf(" %d",i);
				break;
				}
			}
		}
	}
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2048
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <memory.h>
 
 

using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int

int C[51][51];

void comb_table(int N) {
    rep(i, N+1) {
        for (int j = 0; j <= i; j++){
            if(j == 0 || j == i) C[i][j] = 1;
            else C[i][j] = C[i-1][j-1] + C[i-1][j];
        }
    }
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, A, B;
    cin >> N >> A >> B;
    comb_table(N);
    int v[55];
    rep(i, N) cin >> v[i];
    sort(v, v+N, greater<int>());
    double ans = 0;
    rep(i, A) {
        ans += v[i];
    }
    ans /= A;

    int cnt = 0;
    int X = 0, Y = 0;
    rep(i, N) {
        if (v[i] == v[A-1]) {
            X++;
            if(i < A) Y++;
        } 
    }

    if (Y == A) {
        for (int i = A; i <= B; i++) cnt += C[X][i];
    } else {
        cnt += C[X][Y];
    }

    cout.precision(20);
    cout << fixed << ans << endl;
    cout << cnt << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,a,b;
int main(){
	cin>>n>>a>>b;
	if((b-a)%2==0)cout<<(b-a)/2;
	else cout<<min((a+b-1)/2,(n-a+n-b+1)/2);
	return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  int N = S.size();

  vector<int> ans(N);

  int j;
  for (int i = 0; i < N; i++) {
    if (S.at(i) == 'R') j = i;
    else ans.at(j + (i - j) % 2)++;
  }
  for (int i = N - 1; i >= 0; i--) {
    if (S.at(i) == 'L') j = i;
    else ans.at(j - (j - i) % 2)++;
  }

  for (int i = 0; i < N; i++) cout << ans.at(i) << "\n";
}

Measured memory_bytes: 1104
#include<bits/stdc++.h>
using namespace std;
long long x[100010],y[100010];
signed main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);

    long long  a,b,n;
    string s;
    cin>>a;
    cout<<a*a*a<<'\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
long long int co=0;
long long int b=0;
for(int i=0;i<s.size();i++){
    if(s[i]=='B'){
        b++;
    }
    else{
        co+=b;
    }
}
cout<<co<<endl;

}


Measured memory_bytes: 640