akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define inf 1<<29
#define linf (1e16)
#define eps (1e-8)
#define Eps (1e-12)
#define mod 1000000007
#define pi acos(-1.0)
#define phi (1.0+sqrt(5.0))/2.0
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define pld(a) printf("%.10Lf\n",(ld)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define Unique(v) v.erase(unique(all(v)),v.end())
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<pii> vpi;

int main()
{
  string s;
  int a,b,c;
  while(cin>>s && s!="#"){
    cin>>a>>b>>c;
    if( (a==31&&4<b) || 31<a){
      s = "?";
      a-=30;
    }
    cout<<s<<" ";
    cout<<a<<" ";
    cout<<b<<" ";
    cout<<c<<endl;
  }
  return 0;
}


Measured memory_bytes: 3164
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
g = [[] for i in range(n)]

for i in range(n-1):
    u,v,w = na()
    g[u-1].append((v-1,w))
    g[v-1].append((u-1,w))

dp = [0]*n

def f(a,b,c):
    dp[b] = c
    for i,j in g[b]:
        if i != a:
            f(b,i,c+j)

f(0,0,0)

for k in dp:
    print(k%2)

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

const int MAX_SIZE = 30;
typedef pair<double, double> P;

double calc(int n, double a[], double b[], double c[], double d[]) {
  double m = 0.0;
  P p[MAX_SIZE + 2][MAX_SIZE + 2];
  p[0][0] = P(0.0, 0.0);
  p[0][n + 1] = P(0.0, 1.0);
  p[n + 1][0] = P(1.0, 0.0);
  p[n + 1][n + 1] = P(1.0, 1.0);
  for (int i = 0; i < n; ++i) {
    p[i + 1][0]     = P(a[i], 0.0);
    p[i + 1][n + 1] = P(b[i], 1.0);
    p[0][i + 1]     = P(0.0, c[i]);
    p[n + 1][i + 1] = P(1.0, d[i]);
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      double e = abs((0.0 - a[j]) - c[i] * (b[j] - a[j]));
      double f = abs((1.0 - a[j]) - d[i] * (b[j] - a[j]));
      double r = e / (e + f);
      p[j + 1][i + 1] = P(r, c[i] + r * (d[i] - c[i]));
    }
  }
  for (int i = 0; i < n + 1; ++i) {
    for (int j = 0; j < n + 1; ++j) {
      P p1 = p[i][j], p2 = p[i][j + 1], p3 = p[i + 1][j], p4 = p[i + 1][j + 1];
      double s = (abs((p2.first - p1.first) * (p3.second - p1.second) - (p2.second - p1.second) * (p3.first - p1.first)) +
                  abs((p2.first - p4.first) * (p3.second - p4.second) - (p2.second - p4.second) * (p3.first - p4.first))) / 2.0;
      if (s > m) m = s;
    }
  }
  return m;
}

int main() {
  int n;
  double a[MAX_SIZE], b[MAX_SIZE], c[MAX_SIZE], d[MAX_SIZE];
  while (true) {
    cin >> n;
    if (!n) break;
    for (int i = 0; i < n; ++i) cin >> a[i];
    for (int i = 0; i < n; ++i) cin >> b[i];
    for (int i = 0; i < n; ++i) cin >> c[i];
    for (int i = 0; i < n; ++i) cin >> d[i];
    cout << fixed << setprecision(7) << calc(n, a, b, c, d) << endl;
  }
}

Measured memory_bytes: 1304
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long  h,w;
	cin>>h>>w;
	long long res=1e18;
	for(int i=0;i<2;i++)
	{
		swap(h,w);
		res = min(res, (h % 3) == 0 ? 0 : w);
		for(int H=1;H<=h-1;H++)
		{
			long long  mx = H*w,mn=H*w;
			mx=max(mx,1ll*(h-H)*(w/2+w%2));
			mn=min(mn,1ll*(h-H)*(w/2));
			res=min(res,mx-mn);
		}
	}
	cout<<res<<endl;
}

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

int main() {
  int n, d, x;
  cin >> n >> d >> x;
  for (int i = 0; i < n; ++i) {
    int a; cin >> a;
    x += 1 + (d - 1) / a;
  }
  cout << x << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	cout << n*n*n << endl;
	return 0;
}

Measured memory_bytes: 3596
#pragma GCC optimize(2,3,"Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define in inline
namespace fast_io
{
	char buf[1<<12],*p1=buf,*p2=buf,sr[1<<23],z[23],nc;int C=-1,Z=0,Bi=0,ny;
	in char gc() {return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<12,stdin),p1==p2)?EOF:*p1++;}
	in int read()
	{
		int x=0;ny=1;while(nc=gc(),(nc<48||nc>57)&&nc!=EOF)if(nc==45)ny=-1;Bi=1;if(nc<0)return nc;
		x=nc-48;while(nc=gc(),47<nc&&nc<58&&nc!=EOF)x=(x<<3)+(x<<1)+(nc^48),Bi++;return x*ny;
	}
	in db gf() {int a=read(),y=ny,b=(nc!='.')?0:read();return (b?a+(db)b/pow(10,Bi)*y:a);}
	in int gs(char *s) {char c,*t=s;while(c=gc(),c<32);*s++=c;while(c=gc(),c>32)*s++=c;return s-t;}
	in void ot() {fwrite(sr,1,C+1,stdout);C=-1;}
	in void flush() {if(C>1<<22) ot();}
	template <typename T>
	in void write(T x,char t)
	{
		int y=0;if(x<0)y=1,x=-x;while(z[++Z]=x%10+48,x/=10);
		if(y)z[++Z]='-';while(sr[++C]=z[Z],--Z);sr[++C]=t;flush();
	}
	in void write(char *s) {int l=strlen(s);for(int i=0;i<l;i++)sr[++C]=*s++;sr[++C]='\n';flush();}
};
using namespace fast_io;
const int N=3e2+5;
int n,k,p,f[N][N][N];
in void M(int &x) {x-=p;x+=x>>31&p;}
int main()
{
	n=read(),k=read(),p=read();f[0][1][0]=1;
	for(int i=0;i<=n;i++) for(int j=1;j<=k;j++) for(int k=i;~k;k--)
	k?M(f[i][j][k-1]+=f[i][j][k]):M(f[i][j+1][i]+=f[i][j][k]),M(f[i+1][j][k]+=(k+1ll)*f[i][j][k]%p);
	write(f[n][k][0],'\n');
	return ot(),0;
}
//Author: disangan233

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

/* -------------------------------- Template -------------------------------- */

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

template<typename T> T inf() { assert(false); }
template<> constexpr int inf<int>() { return 1e9; }
template<> constexpr ll inf<ll>() { return 1e18; }
template<> constexpr ld inf<ld>() { return 1e30; }

/* -------------------------------- Library -------------------------------- */

/* ---------------------------------- Main ---------------------------------- */

void dfs(int v, const vector<vector<pair<int,int>>> &edges, map<int,ll> &val) {
  for (auto p: edges[v]) {
    int to = p.first, c = p.second;
    if (val.count(to)) {
      if (val[to] != val[v] + c) throw 0;
    }
    else {
      val[to] = val[v] + c;
      dfs(to, edges, val);
    }
  }
}

int main() {
  int R, C, N;
  cin >> R >> C >> N;
  vector<map<int,int>> row(R), col(C);
  vector<vector<pair<int,int>>> erow(C), ecol(R);
  REP(i,N) {
    int r, c, a;
    cin >> r >> c >> a;
    --r; --c;
    row[r][c] = a;
    col[c][r] = a;
  }
  REP(i,R) {
    if (row[i].empty()) continue;
    int from, to, a, b;
    tie(from, a) = *row[i].begin();
    for (auto p: row[i]) {
      tie(to, b) = p;
      erow[from].emplace_back(to, b - a);
      erow[to].emplace_back(from, a - b);
    }
  }
  REP(i,C) {
    if (col[i].empty()) continue;
    int from, to, a, b;
    tie(from, a) = *col[i].begin();
    for (auto p: col[i]) {
      tie(to, b) = p;
      ecol[from].emplace_back(to, b - a);
      ecol[to].emplace_back(from, a - b);
    }
  }
  col.clear();
  try {
    vector<ll> rval(C, -1), cval(R, -1); 
    REP(i,C) {
      if (rval[i] != -1) continue;
      map<int,ll> val;
      val[i] = 0;
      dfs(i, erow, val);
      ll mi = 1e18;
      for (auto p: val) chmin(mi, p.second);
      for (auto p: val) rval[p.first] = p.second - mi;
    }
    REP(i,R) {
      if (cval[i] != -1) continue;
      map<int,ll> val;
      val[i] = 0;
      dfs(i, ecol, val);
      ll mi = 1e18;
      for (auto p: val) chmin(mi, p.second);
      for (auto p: val) cval[p.first] = p.second - mi;
    }
    REP(i,R) {
      for (auto p: row[i]) {
        int j, v; tie(j, v) = p;
        if (v < cval[i] + rval[j]) throw 0;
      }
    }
    cout << "Yes" << endl;
  }
  catch(int) {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 39168
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 1010
typedef unsigned long long ull;
 
int N,M,P,Q;
char field[MAX][MAX],pattern[MAX][MAX];
ull hash[MAX][MAX],tmp[MAX][MAX];
 
void compute_hash(char a[MAX][MAX],int n,int m){
    const ull B1 = 63533;
    const ull B2 = 100007;
 
    ull t1 = 1;
    for(int j = 0 ; j < Q ; j++) t1 *= B1;
 
    for (int i = 0; i < n ; ++i) {
        ull e = 0;
        for(int j = 0 ; j < Q ; j++) e = e * B1 + a[i][j];
        for(int j = 0 ; j + Q <= m ; j++){
            tmp[i][j] = e;
            if(j + Q < m) e = e * B1 - t1 * a[i][j] + a[i][j+Q];
        }
    }
 
    ull t2 = 1;
    for (int i = 0; i < P ; ++i)  t2 *= B2;
 
    for (int j = 0; j + Q <= m  ; ++j) {
        ull e = 0;
        for (int i = 0; i < P ; ++i)e = e * B2 + tmp[i][j];
        for (int i = 0; i + P <= n ; ++i) {
            hash[i][j] = e;
            if(i + P < n) e = e * B2 - t2 * tmp[i][j] + tmp[i + P][j];
        }
    }
}
 
void solve(){
    compute_hash(pattern,P,Q);
    ull res = hash[0][0];
    compute_hash(field,N,M);
    for (int i = 0; i <= N ; ++i) {
        for (int j = 0; j <= M ; ++j) {
            if(res == hash[i][j]){
                cout << i << " " << j << endl;
            }
        }
    }
}
 
int main(){
    cin >> N >> M;
    for (int i = 0; i < N ; ++i) {
        for (int j = 0; j < M ; ++j) {
            cin >> field[i][j];
        }
    }
    cin >> P >> Q;
    for (int i = 0; i < P ; i++) {
        for (int j = 0; j < Q; ++j) {
            cin >> pattern[i][j];
        }
    }
        if(N < P && M < Q) return 0;
        solve();
        return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    int a, b;
    cin >> a >> b;
    int res = -1;
    for (int i = 1; i <= 2000; ++i) {
        if ((int)(i * 0.08) == a && (int)(i * 0.10) == b){
            res = i;
            break;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 3644
#!/usr/bin/env python3


def main():
    N = input_line(int)
    kuku = set(x * y for x in range(1, 10) for y in range(1, 10))
    if N in kuku:
        print("Yes")
    else:
        print("No")


def input_line(*types):
    if len(types) == 1:
        return types[0](input())
    else:
        return [t(x) for t, x in zip(types, input().split())]


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <map>
#include <algorithm>
#include <cassert>
#include <climits>
#include <complex>
#include <cstdio>
#include <string>
#include <iostream>
#include <queue>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmin(T &a, T b) { return a>b?(a=b,true):false; }
template<class T> bool chmax(T &a, T b) { return a<b?(a=b,true):false; }
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
#define bs2int(bs) (int)((bs).to_ulong())
#define FOR(i,x,y) for(int i=(x);i<(int)(y);i++)
#define FORP(i,x,y) for(int i=(x);i<=(int)(y);i++)
#define REP(i,y) for(int i=0;i<(int)(y);i++)
#define REPP(i,y) for(int i=1;i<=(int)(y);i++)
#define REPB(i,n) for(int i=(int)(n)-1;i>=0;i--)

string s,t;

int main() {
  cin>>s>>t;
  int n=s.length();
  int m=t.length();
  for (int i=n-m; i>=0; i--)
  {
    string p = s.substr(i,m);
    bool issame=true;
    REP(j,p.length()) {
      if (p[j]=='?') continue;
      if (p[j]==t[j]) issame&=true;
      else issame=false;
    }
    if (issame) {
      REP(j,p.length()) {
        s[i+j] = t[j];
      }
      replace(all(s), '?', 'a');
      cout << s << endl;
      return 0;
    }
  }
  cout << "UNRESTORABLE" << endl;
}


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

#define ll long long
#define vi vector<int>
#define pi pair<int, int>
#define pb push_back
#define ppb pop_back

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const int N = 1e5 + 667;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, m;
    int ans = 0;
    cin >> n >> m;
    for(int i = 0;i<n;i++){
        for(int j = i+1;j<n;j++){
            ans++;
        }
    }
    for(int i = 0;i<m;i++){
        for(int j = i+1;j<m;j++){
            ans++;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
// acdart
#include <iostream>
#include <cstring>
#include <algorithm>
#include <stdio.h>
#include <cstring>
#include <cmath>
#include <cctype>
#include <string>
#include <numeric>
#include <utility>
#include <queue>
#include <memory>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <cstdlib>
#include <list>
#include <limits.h>
#include <utility>
#include <functional>
#include <iterator>
#include <deque>
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define X first
#define Y second
#define F first
#define S second
#define MOD9 1000000009ll
#define MOD7 1000000007ll
#define MOD
#define INF  1023456789ll
#define INF16 10000000000000000ll
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define SZ(x) ((int)(x).size())
#define MAXN 10010
#define MAXM
#define ALL(x) ((x).begin()),((x).end())
#define RESET(a,b) memset(a,b, sizeof a)
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define LEN(X) strlen(X)
#define FI(a,b,c) for(int a=b; a<c; a++)
#define FD(a,b,c) for(int a=b; a>c; a--)
using namespace std;
typedef long long ll;
typedef long long LL;
typedef double db;
typedef double D;
typedef long double ld;
typedef long double LD;
/*********default*********/
// #define ONLINE_JUDGE
#define inf 0x3f3f3f3f
#define mod
#define maxm
#define maxn
int p[55], a[2510], b[2510];
int findp(int x) {
	return x == p[x] ? x : p[x] = findp(p[x]);
}
void unionp(int x, int y) {
	x = findp(x), y = findp(y);
	if (x != y) p[y] = x;
}
int main()
{/*
	#ifdef ONLINE_JUDGE
    	freopen("aplusb.in", "r", stdin);
    	freopen("aplusb.out", "w", stdout);
	#endif*/
	// ios::sync_with_stdio(false);
	int n, m, ans = 0;
	
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++) {
		scanf("%d%d", &a[i], &b[i]);
	}
	for (int i = 0; i < m; i++) {
		for (int j = 1; j <= n; j++) {
			p[j] = j;
		}
		for (int j = 0; j < m; j++) {
			if (i == j) continue;
			unionp(a[j], b[j]);
		}
		int x = findp(1), fg = 0;
		for (int j = 2; j <= n; j++) {
			if (findp(j) != x) {
				fg = 1;
				break;
			}
		}
		ans += fg;
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
	
	int n;
	int a[200000];
	
	cin >> n;
	
	for(int i = 1; i <= n; i++){
		cin >> a[i];
	}
	
	int count = 0;
	
	for(int i = 1; i <= n; i++){
		if(i == a[a[i]]){
			count++;
		}
	}
	
	cout << count / 2 << endl;
	
	return 0;
}



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

int main() {
    ll n, m, a, p;
    cin >> n >> m >> a >> p;
    vector<ll> v(n);
    for (auto &i : v) {
        cin >> i;
    }
    sort(v.rbegin(), v.rend());
    int l = p - 1, r = n;
    while(r - l > 1) {
        int mid = (l + r) >> 1;
        if (v[mid] + m < v[p-1]) {
            r = mid;
            continue;
        }
        if (v[mid] == v[p-1]) {
            l = mid;
            continue;
        }
        ll u = 0;
        ll tar = v[mid] + m;
        for (int i = 0 ; i < n ; i++) {
            if (i < p - 1) {
                u += m;
            }
            else{
                u += min(max(0LL, tar - v[i]), m);
            }
        }
        if (u >= m * a) {
            l = mid;
        }
        else {
            r = mid;
        }
    }
    cout << l + 1 << '\n';
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <utility>

using namespace std;

int main() {
int a,b;
cin >> a >> b;
if(a==b){
  cout << "Draw" << endl;
}
else if(a==1){
  cout << "Alice" << endl;
}
else if(b==1){
  cout << "Bob" << endl;
}
else if(a>b){
  cout << "Alice" << endl;
}
else{
  cout << "Bob" << endl;
}


  return 0;
}


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

#define ll long long int

int main() {
	// your code goes here
	ll n,k;
	cin>>n>>k;
	vector<ll>v;
	for(ll i=0;i<n;i++){
		ll x;
		cin>>x;
		v.push_back(x);
		//cout<<v[i]<<" ";
	}
	//cout<<n;
	vector<ll>dp(n,INT_MAX);
	dp[0]=0;
	dp[1]=abs(v[0]-v[1]);
	for(ll i=2;i<n;i++){
		for(ll j=1;j<=k;j++)
		if(i-j>=0)
		dp[i]=min(dp[i],(dp[i-j]+abs(v[i]-v[i-j])));
		//cout<<dp[i]<<" ";
	}
	cout<<dp[n-1];
	return 0;
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,k;
    cin >> n >> k;
    map<ll,ll> mp;
    for(i = 1;i <= n;++i){
        mp[i] = 0;
    }
    for(i = 0;i < k;++i){
        ll d;
        cin >> d;
        rep(j,d){
            ll a;
            cin >> a;
            ++mp[a];
        }
    }
    ll ans = 0;
    for(auto x:mp){
        if(x.second == 0) ++ans;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int n, l;
    cin >> n >> l;
    string arr[n];
    forn(i, n) {
        string s;
        cin >> s;
        arr[i] = s;
    }
    sort(arr, arr + n);
    for (auto x : arr) {
        cout << x;
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);

int main(){
    int a, b, c, d, e, f;
    sc(a) sc(b) sc(c) sc(d) sc(e) sc(f)
    int water[2] = {100*a, 100*b},sugar[2] = {c, d};
    int tmpw, tmps;
    P ans = P(0, 0);
    for (int i = 0; i <= 3000; i++){
        for (int j = 0; j <= 3000; j++){
            tmpw = water[0]*i + water[1]*j;
            if (tmpw > f) break;
            for (int x = 0; x <= 3000; x++){
                for (int y = 0; y <= 3000; y++){
                    tmps = sugar[0]*x + sugar[1]*y;
                    if (tmpw + tmps > f) break;
                    if (tmpw * e < tmps * 100) break;
                    if (ans.first == 0) ans = P(tmpw + tmps, tmps);
                    else if (ans.second*(tmpw+tmps) < \
                    tmps*ans.first) ans = P(tmpw + tmps, tmps);
                }
            }
        }
    }
    cout << ans.first << " " << ans.second << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define SZ(x) ((int)(x.size()))
#define FOR(i,s,n) for (ll i = (s); (i) < (n); ++i)
#define FORD(i,s,l) for (ll i = (s); (i) >= l; --i)
#define F first
#define S second
#define TC int __tc; cin >> __tc; FOR(case_num,1,__tc+1)
#define TEST(x,i) ((x)&(1ll<<(i)))
#define SET(x,i) ((x)|(1ll<<(i)))
#define FLIP(x,i) ((x)^(1ll<<(i)))
#define CLEAR(x,i) ((x)&~(1ll<<(i)))

const double pi = 4 * atan(1);
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;
const int MAXN = 200005;

ll sum(ll x, ll b) {
	ll r = 0;
	while (x >= b) {
		r+=x%b;
		x/=b;
	}
	return r+x;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	ll n, s;
	cin >> n >> s;
	
	if (n == s) {
		cout << n+1 << "\n";
		return 0;
	}
	
	for (ll i = 2; i*i<=n; i++){
		if (sum(n,i) == s) {
			cout << i << "\n";
			return 0;
		}
	}
	
	for (ll i = (ll)sqrtl(n-s); i>=1; i--){
		if ( (n-s)%i == 0 && sum(n,(n-s)/i+1)==s ) {
			cout << ((n-s)/i+1) << "\n";
			return 0;
		}
	}
	
	cout << "-1\n";
	

}


Measured memory_bytes: 3700
import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner in  = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        if(n==0){
            System.out.println(0);
            return;
        }
        int []arr = new int[n];
        for(int i=0;i<n;i++)arr[i] = in.nextInt();
        int []dp = new int[n];
        Arrays.fill(dp,-1);
        int ans = recur(0,dp,arr,k);
        System.out.println(ans);
    }
    public static int recur(int index,int []dp,int []arr,int k){
        if(index==dp.length)return 0;
        if(index==dp.length-1)return 0;
        if(dp[index]!=-1)return dp[index];
        int ret = Integer.MAX_VALUE;
        for(int i=index+1;i<=(index+k)&&i<arr.length;++i){
            ret = Math.min(ret,Math.abs(arr[index]-arr[i])+recur(i,dp,arr,k));
        }
        return dp[index] = ret;
    }
}


Measured memory_bytes: 64692
// inputに入力データ全体が入る
  function Main(input) {
  	// 1行目がinput[0], 2行目がinput[1], …に入る
  	input = input.split(" ");
    var maxNum = [];
    
    maxNum.push(parseInt(input[0]) + parseInt(input[1]));
    maxNum.push(parseInt(input[0]) - parseInt(input[1]));
    maxNum.push(parseInt(input[0]) * parseInt(input[1]));
    
    console.log(maxNum.reduce((a,b)=>a>b?a:b));
  }
  //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
  Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
    
    vector<ll> n;
    for (int i = 0; i < 4; i++) {
        ll _n;
        cin >> _n;
        n.push_back(_n);
    }
    sort(n.begin(), n.end());
    if (n[0]==1 && n[1]==4 && n[2]==7 && n[3]==9) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
def solve(s, t):

    length = len(t)
    ans = []
    i = 0
    flg = False
    while i < len(s):
        tmp = s[i:i+length]
        count = len([i for i, j in zip(tmp, t) if i == j or i == "?"])
        if length == count:
            a = s[:i] + t + s[i+length:]
            ans.append(a.replace("?", "a"))

        i += 1

    return min(ans) if len(ans) > 0 else "UNRESTORABLE"

if __name__ == "__main__":
    s = input()
    t = input()
    print(solve(s, t))

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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define PI acos(-1.0)
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define MOD 1000000007
#define MOD1 998244353
#define ep 0.000000001
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, 1};
int dy4[] = {1, -1, 1, -1};
//#define fio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int main()
{
    #ifndef ONLINE_JUDGE
    freopen ("in.txt", "r", stdin);
    freopen ("out.txt", "w", stdout);
    #endif
    int n;
    cin>>n; string s="ACL";
    for(int i=1;i<=n;i++){
        cout<<s;
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
#include<string.h>
int main(void){
    int n,ans=0;
    scanf("%d",&n);
    char s[n];
    scanf("%s",s);
    int a=strlen(s);
    if(a%2==1)
    printf("No");
    else if(a%2==0){
        for(int i=0;a/2>i;++i){
            if(s[i]==s[a/2+i])        {
                ++ans;
                    }
        }
        if(ans==a/2)
        printf("Yes");
        else
        {printf("No");}
        
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a==b){
    cout<<"Draw"<<endl;
  }
  else{
    if(b==1)
      cout<<"Bob"<<endl;
    if(a==1)
      cout<<"Alice"<<endl;
    if(a!=1&&b!=1){
      if(a>b)
        cout<<"Alice"<<endl;
      if(b>a)
        cout<<"Bob"<<endl;
    }
  }
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str  = sc.next();
    sc.close();
    int one = 0, zero = 0;
    for (int i = 0; i < str.length(); i++) {
      if (str.charAt(i) == '0') {
        zero++;
      } else {
        one++;
      }
    }
    System.out.println(2 * Math.min(one, zero));
  }
}

Measured memory_bytes: 25704
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct Node
{
    int to,next;
}e[200005];
int h[200005],cnt=0;
inline void Addedge(int x,int y)
{
    e[++cnt]=(Node){y,h[x]};h[x]=cnt;return;
}
int main(void)
{
    int n,m,a,b,i,j;
    scanf("%d%d",&n,&m);
    for(i=1;i<=m;++i)
    {
        scanf("%d%d",&a,&b);
        Addedge(a,b);
    }
    for(i=h[1];i;i=e[i].next)
    {
        int x=e[i].to;
        for(j=h[x];j;j=e[j].next)
        {
            if(e[j].to==n){printf("POSSIBLE");return 0;}
        }
    }
    printf("IMPOSSIBLE");
    return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<string>
#include<set>
#include<queue>
#include<cmath>
#include<tuple>
#include<utility>
#include<functional>
#include<algorithm>



using namespace std;

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

string s;
long long n,r[4444],g[4444],b[4444],ans=0ll;

int main() {
	cin>>n>>s;
	for(int i=0;i<n;i++){
		if(s[i]=='R')r[i]++;
		if(s[i]=='G')g[i]++;
		if(s[i]=='B')b[i]++;
		if(i){
			r[i]+=r[i-1];
			g[i]+=g[i-1];
			b[i]+=b[i-1];
		}
	}

	for(int i=0;i<n;i++){
		for(int j=i+2;j<n;j++){
			map<char,bool>rgb={{'R',false},{'G',false},{'B',false}};
			if(s[i]==s[j])continue;
			rgb[s[i]]=rgb[s[j]]=true;
			char lst;
			for(auto i:rgb)if(!i.second)lst=i.first;
			if((j-i)%2==0&&s[(i+j)/2]==lst)ans--;
			if(lst=='R')ans+=r[j]-r[i];
			if(lst=='G')ans+=g[j]-g[i];
			if(lst=='B')ans+=b[j]-b[i];
		}
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3724
#include <iostream>

using namespace std;

int main(){
    int n;
    cin>>n;
    if (n==25) {
        cout<<"Christmas"<<endl;
    }else if(n==24){
        cout<<"Christmas Eve"<<endl;
    }else if(n==23){
        cout<<"Christmas Eve Eve"<<endl;
    }else{
        cout<<"Christmas Eve Eve Eve"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import math
a,b=map(int,input().split())
while b!=0:
    a,b=b,a%b
c=a
d=[]
for i in range(2,int(c**0.5)+2):
    while c%i==0:
        c//=i
        d.append(i)
if c!=1:
    d.append(c)
print(len(set(d))+1)

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    X,Y=MI()
    N3=X+Y
    
    if N3%3!=0:
        print(0)
        exit()
        
    N=N3//3
    a=0
    b=0
    for i in range(N+1):
        if 2*i + (N-i) == X:
            a=i
            b=N-i
            break
        
    if a==0 and b==0:
        print(0)
        exit()

    fact=[1,1]
    factinv=[1,1]
    inv=[0,1]

    for i in range(2, N + 5):
        fact.append((fact[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        factinv.append((factinv[-1] * inv[-1]) % mod)
        
    ans=fact[N]*factinv[a]*factinv[b]
    print(ans%mod)
    

main()


Measured memory_bytes: 211436
// Aizu 2219: THE BYDOLM@STER
// 2017.9.24 bal4u@uu

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

int n, m;
int c[303], v[303], d[303], l[303];

int calc(int *c, int *v)
{
	int i, j;
	int t[303];
	
	memset(t, 0, sizeof(t));
	for (i = 0; i < n; i++) {
		for (j = c[i]; j <= m; j++) {
			int d = j - c[i], x = t[d] + v[i];
			if (x > t[j]) t[j] = x;
		}
	}
	return t[m];
}

int main()
{
	int i, k, ans;
	char buf[105];

	while (fgets(buf, 100, stdin) != NULL) {
		sscanf(buf, "%d%d", &n, &m);
		for (i = 0; i < n; i++) {
			fgets(buf, 100, stdin);		// name
			fgets(buf, 100, stdin);
			sscanf(buf, "%d%d%d%d", c+i, v+i, d+i, l+i);
		}
		ans = calc(c, v);
		if ((k = calc(c, d)) > ans) ans = k;
		if ((k = calc(c, l)) > ans) ans = k;
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1796
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://abc061.contest.atcoder.jp/tasks/abc061_d>
問題文============================================================
 N 頂点 M 辺の重み付き有向グラフがあります。
 i(1≦i≦M) 番目の辺は 頂点 ai から 頂点 bi を重み ci で結びます。
 このグラフと駒を利用して、次の1人ゲームを行います。
 
 最初、駒を頂点 1 に置いて、プレイヤーのスコアを 0 とします。
 プレイヤーは、次の条件で駒を繰り返し移動させることができます。
 
 頂点 ai に駒があるとき、i 番目の辺を利用して頂点 bi に移動する。移動後にプレイヤーのスコアが ci 加算される。
 
 頂点 N に駒があるときのみ、ゲームを終了できます。
 なお、与えられる有向グラフの上で頂点 1 から頂点 N に移動できることは保障されています。
 
 プレイヤーがゲーム終了時のスコアを出来るだけ大きくするような行動を取ったとき、ゲーム終了時のスコアはいくつになるでしょうか?
 ゲーム終了時のスコアをいくらでも大きくできる場合は inf と出力してください。
=================================================================

解説=============================================================

================================================================
*/
class Bellman_ford {
public:
    struct edge {
        ll u;
        ll v;
        ll cost;
        edge() {}
        edge(ll u, ll v, ll c) :u(u), v(v), cost(c) {}
    };
    
    ll V;
    vector<vector<edge> > G;
    vector<ll> dist;
    Bellman_ford(ll V) :V(V) {
        G.resize(V);
    }
    
    void add_edge(ll u, ll v, ll cost, bool undirected = false) {
        G[u].push_back(edge(u, v, cost));
        if (undirected) {
            G[v].push_back(edge(v, u, cost));
        }
    }
    
    bool calc_dist(ll s) {
        dist.assign(V,LINF);
        dist[s] = 0;
        
        for (int i = 0; i < V;i++) {
            bool updated = true;
            for (int v = 0; v < V;v++) {
                if(dist[v] == LINF) continue;
                for (int j = 0; j < (int)G[v].size();j++){
                    edge& e = G[v][j];
                    if (dist[e.v] > dist[v] + e.cost) {
                        dist[e.v] = dist[v] + e.cost;
                        updated = false;
                        if (i == V - 1 && e.v == V-1) return true; // 負閉路
                    }
                }
            }
            if(updated) return false;
        }
        return false;
    }
    
    inline ll get_dist(ll v) const { return dist[v]; }
};
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll N,M; cin >> N >> M;
    Bellman_ford Bf(N);
    for(int i = 0; i < M;i++){
        ll a,b,c; cin >> a >> b >> c; a--; b--;
        Bf.add_edge(a, b, -c);
    }
    
    if(Bf.calc_dist(0)){
        cout << "inf" << endl;
    }else{
        cout << -Bf.get_dist(N-1) << endl;
    }
	return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps DBL_EPSILON
#define mod (ll)1000000007
#define INF LLONG_MAX/10
#define P pair<int,int>
#define prique priority_queue
using namespace std;
signed main() {
	int a;
	string s;
	cin >> a >> s;
	if (a >= 3200)cout << s << endl;
	else cout << "red" << endl;
}

Measured memory_bytes: 256
//In the name of Allah :)
#include <bits/stdc++.h>
using namespace std;
string to_string(char c) { return string(1,c); }
string to_string(bool b) { return b ? "true" : "false"; }
string to_string(const char* s) { return (string)s; }
string to_string(string s) { return s; }
template<class A> string to_string(complex<A> c) { 
	stringstream ss; ss << c; return ss.str(); }
string to_string(vector<bool> v) { 
	string res = "{"; for(int i = 0; i < (int)v.size(); i++) res += char('0'+v[i]);
	res += "}"; return res; }
template<size_t SZ> string to_string(bitset<SZ> b) {
	string res = ""; for(size_t i = 0; i < SZ; i++) res += char('0'+b[i]);
	return res; }
template<class A, class B> string to_string(pair<A,B> p);
template<class T> string to_string(T v) { // containers with begin(), end()
	bool fst = 1; string res = "{";
	for (const auto& x: v) {
		if (!fst) res += ", ";
		fst = 0; res += to_string(x);
	}
	res += "}"; return res;
}
template<class A, class B> string to_string(pair<A,B> p) {
	return "("+to_string(p.first)+", "+to_string(p.second)+")"; }
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
	cerr << to_string(h); if (sizeof...(t)) cerr << ", ";
	DBG(t...); }
#ifdef LOCAL // compile with -DLOCAL
#define wis(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "] : [", DBG(__VA_ARGS__)
#else
#define wis(...) 0
#endif
typedef long long ll;
const int MOD = 1e9 + 7, INF = 1e9 + 5;
const ll LONG_INF = 1e18 + 10;
inline ll powmod(ll a, ll b){ll res=1;for(;b;b>>=1,a=a*a%MOD)if(b&1)res=res*a%MOD;return res;}
inline ll power(ll a, ll b){ll res=1;for(;b;b>>=1,a=a*a)if(b&1)res=res*a;return res;}

const int MAXN = 2e5 + 10;

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	double a, b, c;
        cin >> a >> b >> c;
        cout << int(ceil(a / b) * c) << '\n';
}


Measured memory_bytes: 3776
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
import Data.Array
-- import Data.Array.Unboxed
import Control.Monad.ST
import Data.Array.ST

main :: IO ()
main = do
  n <- readLn :: IO Int
  print $ solve n


solve :: Int -> Integer
solve n = if n < 4
          then naive n
          else foldl' modadd 0 . Map.elems $ foldl' proceed initial [5..n]
  where
    oks = [ w | w <- replicateM 4 acgt, not . or . map (flip isInfixOf w) $ ngwords ]
    initial = Map.fromList $ zip oks (repeat 1)
    -- proceed :: Map.Map String Int -> Int -> Map.Map String Int
    proceed m _ = Map.fromList [(ok, calc m ok) | ok <- oks ] 
    calc m key = foldl' modadd 0 $ map (m Map.!) c
      where
        c = [ x |  x <- map (\s -> tail key ++ [s]) acgt, notElem x ngwords, notElem (tail x) ngwords]

naive n = fromIntegral $ length $ [ w | w <- replicateM n acgt, not . or . map (flip isInfixOf w) $ ngwords ]

acgt = "ACGT"
ngwords = ["AGC", "GAC", "ACG", "ACGC", "AGGC", "ATGC", "AGAC", "AGGC", "AGTC"]

divConst = 10^9 + 7 :: Integer
modadd x y = (x + y) `mod` divConst
modsub x y = (x - y) `mod` divConst
modmul x y = ((x `mod` divConst) * (y `mod` divConst)) `mod` divConst


Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
#define ioS            ios::sync_with_stdio(false);cin.tie(0);
#define li             long int
#define lli            long li
#define ull            unsigned lli
#define pi             pair<int,int>
#define vi             vector<int>
#define vli            vector<li>
#define vlli           vector<lli>
#define vvi            vector<vector<int>>
#define pb             push_back
#define mp             make_pair
#define forn(i,s,n)    for(auto i=s;i<n;i++)               
#define forr(i,s,n)    for(auto i=s;i>=n;i--) 
const lli MOD = 1e9+7;
const lli mx = 1e7; 

void solve()
{
    lli n;
    int r;
    cin>>n;
    string s;
    while(n>0)
    {
        r = n%26;
        if(r==0)
         r = 26;
        s = char(r+'a'-1)+s;
        n = (n - r)/26;
    }
    cout<<s<<endl;
}


int32_t main()
{
    ioS
    // int t;
    // cin>>t;
    // while(t--)
        solve();
}

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

int main() {
  string s;
  cin >> s;
  int n=s.size();
  rep(i,n) cout << 'x';
  cout << endl;
  
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  // T-1分以内に食べ終わる最大のおいしさを求める
  // そのあとDPの表を逆にたどり、使った料理を求め、それ以外で一番おいしさが高い物を足して解とする

  // ただし普通にたどるだけだと、最適解が求まらないことがある

  // テストケース1
  // 3 5
  // 4 400
  // 2 200
  // 2 200

  // テストケース2
  // 3 5
  // 2 200
  // 4 400
  // 2 200

  // テストケース3
  // 3 5
  // 2 200
  // 2 200
  // 4 400

  // これらは全て800とならないといけないが、いずれかで600になってしまう。
  // T-1分以内に完食する最大おいしさを、実現できる手段が複数ある場合、
  // 普通の方法だとそのうちいずれか1種類を求めるアルゴリズムになるので、
  // 手段ごとに最後に残った料理の最大値が違う場合に、最適解が得られないケースが出る。

  // ① 辿り方自体を工夫する
  // ② 今の辿り方でうまく動くようにする
  //
  // ②。今の辿り方の特性から、美味しさの事前降順ソートでうまくいきそうなのでやってみる

  // 結果、上記テストケース3つは解決できるが、after_contest_01でWAなのは変わらず。
  
  // テストケース4
/*
3 5
2 2
2 2
4 6
*/
  // この解は10であるべきだが、8になる。
  // T-1分以内での最大美味しさが 6 で、その後最終注文を 2 と決めるので 8 になるが、
  // 実際はT-1分以内に 2+2=4 食べて、最終を 6 にしたほうが 10 と高くなることが分かる
/*
4 105
2 2
2 2
4 6
100 100
*/
  // これも110になるべきところが108になるので、
  // 「美味しさ最大の料理だけ別扱いする」という場当たり的対策では足りない。

  // ・解説を読む

  // 右からのDPと左からのDPを用意して、各料理を最後に頼む場合を全探索する

  int N, T;
  cin >> N >> T;
  vector<int> as(N), bs(N);

  F0R(i, N) {
    cin >> as[i] >> bs[i];
  }

  vector<vector<int>> dp1(N + 1, vector<int>(T)), dp2(N + 1, vector<int>(T));

  F0R(i, N) {
    F0R(j, min(as[i], T)) {
      dp1[i + 1][j] = dp1[i][j];
    }
    FOR(j, as[i], T) {
      dp1[i + 1][j] = max(dp1[i][j], dp1[i][j - as[i]] + bs[i]);
    }
  }

  RF0(i, N) {
    F0R(j, min(as[i], T)) {
      dp2[i][j] = dp2[i + 1][j];
    }
    FOR(j, as[i], T) {
      dp2[i][j] = max(dp2[i + 1][j], dp2[i + 1][j - as[i]] + bs[i]);
    }
  }

  int result = 0;
  F0R(i, N) {
    int score = 0;
    F0R(j, T) {
      chmax(score, dp1[i][j] + dp2[i + 1][T - 1 - j]);
    }
    chmax(result, score + bs[i]);
  }
  cout << result;
}
#endif


Measured memory_bytes: 70912
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
ll mod=1000000007;

int main() {
  int r,x,d; cin >>r>>d>>x;
  for(int i=0;i<10;++i){
    x=r*x-d;
    cout << x<< endl;
  }
  return 0;
}


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


int main() {

 
    int h1,m1,h2,m2,k;
    cin>>h1>>m1>>h2>>m2>>k;

    
    int hwk=h2-h1;
    int mwk;
    if(m2>=m1)
        mwk=m2-m1;
    else{
        mwk=(m2+60)-m1;
        hwk--;
    }

    cout<<hwk*60+mwk-k<<endl;

    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


int main() {
    int n;
    string s;
    cin>>n>>s;
    ll r=0,g=0,b=0;
    for(auto c : s){
        if(c=='R') r++;
        else if(c=='G') g++;
        else b++;
    }
    ll all=r*g*b;
    ll sub=0;
    rep(i,n){
        for(int j=i+1;j<n;j++){
            if(s[i]==s[j]) continue;
            int k=j*2-i;
            if(k>=n || s[k]==s[i] || s[k]==s[j]) continue;
            sub++;
        }
    }

    cout<<all-sub<<endl;
}



Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderB
{
    static void Main()
    {
        var sc = new Scanner();

        long a = sc.NextLong();
        string b = sc.Next();
        string[] bs = b.Split('.');
        int c = int.Parse(bs[0]) * 100 + int.Parse(bs[1]);

        long answer = a * c / 100;

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27440
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
	int res = 1;
	x = x % p;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x) % p;
		y = y >> 1;
		x = (x * x) % p;
	}
	return res % p;
}
int lcm(int a, int b)
{
	return a / __gcd(a, b) * b;
}
void solve()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	cout << max({a * c, a * d, b * c, b * d}) << endl;
}
int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int tc;
	tc = 1;
	//cin >> tc;
	while (tc--)
	{
		solve();
	}

	return 0;
}

Measured memory_bytes: 3648
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP

██╗███████╗████████╗██╗ █████╗ ██╗  ██╗
██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝
██║███████╗   ██║   ██║███████║█████╔╝
██║╚════██║   ██║   ██║██╔══██║██╔═██╗
██║███████║   ██║   ██║██║  ██║██║  ██╗
╚═╝╚══════╝   ╚═╝   ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝




*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
    cin>>a>>b>>c>>n;
    while(n--)
    {
        if(b<=a)
        {
            b*=2;
        }
        else if(c<=b)
        {
                        c*=2;

        }
    }
    if(a<b&&b<c)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No";
    }

}


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

#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to));
#define sort(a) sort(a.begin(), a.end())

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

int main() {
  vector<int> v;
  load(v, 3);
  sort(v);

  cout << v[2] * 10 + v[1] + v[0] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>

#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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

  string input; cin>>input;
  if(input == "keyence") {
    cout << "YES" << endl;
    exit(0);
  }

  string ans = "NO";
  int len = input.size();
  string front, back;
  for(int i=0; i<len; i++) {
    for(int j=i; j<len; j++) {
      front = input.substr(0, i);
      back = input.substr(j);
      if(front + back == "keyence") {
        ans = "YES";
        cout << ans << endl;
        exit(0);
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
N, M = map(int, input().split(' '))
i_A = [list(input()) for _ in range(N)]
i_B = [list(input()) for _ in range(M)]
flag = 0
for i in range(N-M+1):
    for j in range(N-M+1):
        if i_B[0] == i_A[i][j:j+M]:
            flag = 1
            for k in range(1, M):
                if i_B[k] != i_A[i+k][j:j+M]:
                    flag = 0
            if flag == 1: break
        else: flag = 0
    if flag == 1: break
if flag == 1: print('Yes')
else: print('No')

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

namespace ABC134B
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = input[0];
            int D = input[1];

            int kansiNumber = 2 * D + 1;
            int ans = (N + 2 * D) / kansiNumber;

            Console.WriteLine(ans);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13268
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

a,b,c=map(int,input().split())
if c-a-b<0:
    print("No")
elif 4*a*b<(c-(a+b))**2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 63980