akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

long long gcd(long long a, long long b) {
    while (b > 0) {
        long long t = b; b = a % b; a = t;
    }
    return a;
}

int main() {
    int n, m; cin >> n >> m;
    int a[n]; for (int i = 0; i < n; i++) cin >> a[i];
    long long L = 1;
    for (int i = 0; i < n; i++) {
        L = L * a[i] / gcd(L, a[i]);
        if (L > 2*m) { cout << "0\n"; return 0; }
    }
    int t = 0;
    while ((a[0] & ((2<<t)-1)) == 0) t++;
    for (int i = 0; i < n; i++) {
        if ((a[i] & ((1<<t)-1)) != 0 || (a[i] & (1<<t)) == 0) { cout << "0\n"; return 0; }
    }
    cout << m / (L / 2) - m / L << endl;
}


Measured memory_bytes: 640
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int K = scan.nextInt();
        int X = scan.nextInt();

        if(500*K >= X)
            os.println("Yes");
        else
            os.println("No");
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 998244353;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

vector<ll> fact;

ll modpow(ll b, ll i, ll m)
{
	ll ret = 1;
	while(i)
	{
		// cout << i << endl;
		if(i & 1) ret = (ret * b) % m;
		b = (b * b) % m;
		i >>= 1;
	}
	return ret;
}

ll ncr(ll n, ll r)
{
	ll ret = (fact[n] * modpow(fact[n - r], MOD - 2, MOD)) % MOD;
	return (ret * modpow(fact[r], MOD - 2, MOD)) % MOD;
}

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n, m, k, ans = 0; cin >> n >> m >> k;
	fact.resize(n + 1);
	fact[0] = 1;
	for(int i = 1; i < n + 1; i++) fact[i] = (i * fact[i - 1]) % MOD;
	for(int i = 0; i <= k; i++)
		ans = (ans + ((((ncr(n - 1, i) * m) % MOD) * modpow(m - 1, n - i - 1, MOD)) % MOD)) % MOD;
	cout << ans % MOD;

	return 0;
}

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

int main(void)
{
    using namespace std;

    int n;
    vector<int> a(1000);
    int i;
    int cnt=0;

    cin >> n;

    for(i=0;i<n;i++){
        cin >> a[i];
    }

    for(i=0;i<n;i++){
        if(((i+1&1)==1) && ((a[i]&1)==1)) cnt++;
    }

    cout << cnt;

    return 0;
}

Measured memory_bytes: 3532
N,M=map(int,input().split())
H=list(map(int,input().split()))

G=[[]for _ in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    G[a].append(H[b])
    G[b].append(H[a])
#print(G)
ans=0
for i in range(N):
    h=H[i]
    l=G[i]
    if len(l)==0:
        m=0
    else:
        m=max(l)
    if h>m:
        ans+=1

print(ans)

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

using namespace std;

#define debug(x,y) cout<<(#x)<<" " <<(#y)<<" is " << (x) <<" "<< (y) << endl
#define watch(x) cout<<(#x)<<" is " << (x) << endl
#define fast ios_base::sync_with_stdio(false)
#define fie(i,a,b) for(i=a;i<b;i++)
#define MOD 1000000007
#define mod 998244353
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define ll long long
#define lld long long int
#define ALL(x) (x).begin(),(x).end()

typedef vector<lld> vi;
typedef vector<vector<lld>> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<pair<lld, lld>> vpi;
typedef long long LL;

int main() {
  fast;
  cin.tie(0);
	int n, m;
	cin >> n >> m;
	int x;
	cin >> x;
	
	int a[n][m];
	int c[n];
	for (int i = 0; i < n; i++) {
		cin >> c[i];
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}
	
	int ans = INT_MAX;
	for (int i = 1; i < (1ll<<n); i++) {
		int sum = 0;
		vi v(m, 0);
		for (int j = 0; j < 15; j++) {
			if (i&(1ll<<j)) {
				sum += c[j];
				for (int k = 0; k < m; k++) {
					v[k] += a[j][k];
				}
			}
		}
		
		bool ok = true;
		for (int j = 0; j < m; j++) {
			if (v[j] < x) ok = false;
		}
		
		if (ok) {
			ans = min(ans, sum);
		}
	}
	
	if (ans == INT_MAX) cout << -1 << endl;
	else cout << ans << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


constexpr lint mod = 1e9 + 7;
inline lint emod(lint a, lint p = mod) { return (a % p + p) % p; }

int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  int n, k; cin >> n >> k;
  V<> a(n); for (int i = 0; i < n; ++i) cin >> a[i];
  VV< V<lint> > dp; assign(dp, n + 1, n + 1, 1 << 8);
  dp[0][0][0] = 1;
  for (int i = 0; i < n; ++i) {
    dp[i + 1] = dp[i];
    for (int x = 0; x < i + 1; ++x) for (int j = 0; j < 1 << 8; ++j) {
      (dp[i + 1][x + 1][j ^ a[i]] += dp[i][x][j] * (x + 1)) %= mod;
    }
  }
  lint res = 0;
  for (int x = 0; x < n + 1; ++x) res += dp[n][x][k];
  cout << emod(res) << '\n';
}

Measured memory_bytes: 21120
from collections import*
I=9**9
(h,w),(s,t),(f,g)=eval('map(int,input().split()),'*3)
m,d=zip(*eval('(input(),[I]*w),'*h))
q=deque([(s-1,t-1,1)])
while q:
 y,x,c=q.popleft()
 if d[y][x]>c:
  d[y][x]=c
  for i in range(y-2,y+3):
   for j in range(x-2,x+3):h>i>-1<j<w<d[i][j]!=m[i][j]>'#'!=(abs(y-i)+abs(x-j)<2!=q.appendleft((i,j,c))or q.append((i,j,c+1)))
print(d[f-1][g-1]%I-1)

Measured memory_bytes: 227276
n = int(input())
restaurant = []
for i in range(n):
    restaurant.append(list(map(str, input().split())))
    restaurant[i][1] = int(restaurant[i][1])
    restaurant[i].append(i+1)

restaurant.sort(key=lambda x: -x[1])
restaurant.sort(key=lambda x: x[0])

for i in range(n):
    print(restaurant[i][2])


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

int main() {
    int D;
    cin >> D;
    int d[26];
    vector<int> last(26, 1);

    rep(i, 26) {
        cin >> d[i];
    }

    vector<vector<int>> s(D, vector<int>(26));
    rep(i, D) rep(j, 26) cin >> s[i][j];

    mt19937 rd(0);
    vector<int> ans(D);
    vector<int> koho(D);

    //繰り返し
    ll level = -INF;
    rep(k, 110000) {
        ll now = 0;

        rep(i, D) {
            koho[i] = rd() % 26;
        }

        rep(i, D) {
            int t = koho[i];

            now += s[i][t];
            last[t] = 0;

            rep(j, 26) {
                now -= d[j] * last[j];
                last[j]++;
            }
        }
        if (level < now) {
            ans = koho;
            level = now;
        }
    }


    rep(i, D) {
        cout << ans[i] + 1 << "\n";
    }

    return 0;
}

Measured memory_bytes: 3692
/****************************
/////  Shubham Singhal
/////  LNMIIT
*****************************/
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define lwr lower_bound
#define upr upper_bound
#define pq priority_queue
#define umap unordered_map
#define rep(i,n) for(i=0; i<n;i++)
#define repp(i,a,n) for(i=a; i<n;i++)
#define precise(x) cout<<fixed<<setprecision(x)
#define all(x) x.begin(),x.end()
#define lcm(a,b) (a*b)/__gcd(a,b)
#define prn(x) cout<<x<<"\n"
#define prn2(x, y) cout<<x<<" "<<y<<"\n"
#define prn3(x, y, z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define prn4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<"\n"
#define prnv(x) for(auto i:x) cout<<i<<" "; cout<<"\n"
#define MOD 1000000007
using namespace std;
 
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd; 
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
const long long INF64 = 1'000'000'000'000'000'000ll;
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
}
int main()
{
    fast();
    ll x,y,z,n,i,j;
    cin>>n;
    ll dp[n+1][3];
    for(i=0;i<n;i++)
    {
        cin>>x>>y>>z;
        if(i==0)
        {
            dp[i][0]=x;
            dp[i][1]=y;
            dp[i][2]=z;
        }
        else
        {
            dp[i][0]=x+max(dp[i-1][1],dp[i-1][2]);
            dp[i][1]=y+max(dp[i-1][0],dp[i-1][2]);
            dp[i][2]=z+max(dp[i-1][1],dp[i-1][0]);
        }
    }
    cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
    exit(0);
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
const int mod=1e9+7;

int main(){
  int n;cin>>n;
  int a[n];rep(i,n)cin>>a[i];
  int b[n];rep(i,n)b[i]=a[i];
  sort(b,b+n,greater<int>());
  rep(i,n){
    if(a[i]==b[0])cout<<b[1]<<endl;
    else cout<<b[0]<<endl;
  }
}

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    
    int n;
    cin>>n;
    
    int ara[n];
    for(int i=0;i<n;i++) cin>>ara[i];
    
    int gf[n+1];
    gf[0]=0;
    for(int i=0;i<n;i++) 
    {
        int temp=__gcd(ara[i],gf[i]);
        gf[i+1]=temp;
    }
    
    int gb[n+1];
    gb[0]=0;
    for(int i=0;i<n;i++)
    {
        int temp=__gcd(ara[n-i-1],gb[i]);
        gb[i+1]=temp;
    }
    
   /* for(int i=0;i<n+1;i++) cout<<gf[i]<<" ";
    cout<<endl;
    
    for(int i=0;i<n+1;i++) cout<<gb[i]<<" ";
    cout<<endl;*/
    
    
    int hi=0;
    
    for(int i=0;i<n;i++)
    {
        int temp=__gcd(gf[i],gb[n-i-1]);
        hi=max(hi,temp);
    }
    
    cout<<hi;
    
    return 0;

}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
const int mod=1000000007;
typedef long long ll;
using namespace std;
ll n,m,ans,fac[200005];
ll qpow(ll a,ll b){
	ll ans=1;
	for(;b;b>>=1,a=(a*a)%mod)if(b&1)ans=(ans*a)%mod;
	return ans;
}
ll C(ll x,ll y){
	return fac[x]*qpow(fac[y],mod-2)%mod*qpow(fac[x-y],mod-2)%mod;
}
int main(){
	scanf("%lld%lld",&n,&m);fac[0]=1;
	for(int i=1;i<=200000;i++)fac[i]=(fac[i-1]*i)%mod;
    for(int i=0;i<=min(m,n-1);i++)
        ans=(ans+(C(n,i)*C(n-1,i)%mod))%mod;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

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

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

vector< vector<pii> > node;

class UnionFind
{
public:
	UnionFind() {};
	void init(int n)
	{
		max = n;
		par.resize(max);
		rank.resize(max);
		for (int i = 0; i < max; ++i)
		{
			par[i] = i;
			rank[i] = 0;
		}
	}
	int find(int x)
	{
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	bool same(int x, int y)
	{
		return find(x) == find(y);
	}
	void unit(int x, int y)
	{
		x = find(x);
		y = find(y);
		if (x == y)return;

		if (rank[x] < rank[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (rank[x] == rank[y])
			{
				rank[x]++;
			}
		}
	}

private:
	std::vector<int> par;
	std::vector<int> rank;
	int max;
};

bool use[100005];
bool useNode[100005];

ll nodeNum(int n)
{
	ll vNum = 0;
	ll nNum = 0;
	stack<int> s;
	s.push(n);
	vNum++;
	while (!s.empty())
	{
		int m = s.top();
		s.pop();
		REP(i, node[m].size())
		{
			if (useNode[node[m][i].second])continue;
			nNum++;
			useNode[node[m][i].second] = true;
			if (use[node[m][i].first])continue;
			vNum++;
			use[node[m][i].first] = true;
			s.push(node[m][i].first);
		}
	}
	return vNum*(vNum -1) / 2 - nNum;
}

int main()
{
	int N, M;
	cin >> N >> M;
	UnionFind uf;
	uf.init(N);
	node.resize(N);
	REP(i, M)
	{
		int a, b;
		cin >> a >> b;
		a--; b--;
		node[a].push_back(pii(b,i));
		node[b].push_back(pii(a,i));
		uf.unit(a, b);
	}

	//! 存在する連結グラフを完全グラフにするような
	//! 辺を追加する
	ll ans = 0;
	//! n頂点完全グラフの辺の数はn(n+1)/2。
	//! 各グラフの辺の数を数えて、足りない分を足す
	REP(i, N)
	{
		if (use[i])continue;
		ans += nodeNum(i);
	}

	//! unionFindの親の数から、それぞれのグラフに
	//! 含まれているノードの数を調べる
	int oParent = -1;
	int tParent = -1;
	vector<int> p(N, 0);
	REP(i, N)
	{
		int n = uf.find(i);
		if (i == 0)oParent = n;
		if (i == 1)tParent = n;
		p[n]++;
	}

	//! node0,node1につながっていないグラフから、
	//! node0 or node1のグラフの各点に辺を張る
	ll m = std::max(p[oParent], p[tParent]);
	REP(i, N)
	{
		if (i == oParent || i == tParent)continue;
		ans += m*p[i];
		m += p[i];
	}

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

Measured memory_bytes: 7680
# -*- coding: utf-8 -*-
A, B = map(int,input().split())

if A >= B:
  q, mod = divmod((A+B),2)
  if mod == 0:
    print(q)
  else:
    print("IMPOSSIBLE")
else:
  q, mod = divmod((A+B),2)
  if mod == 0:
    print(q)
  else:
    print("IMPOSSIBLE")
  

Measured memory_bytes: 3060
nums=input()
nums=list(map(int, list(nums)))

if nums[0]+nums[1]+nums[2]+nums[3]==7:
    print('{}+{}+{}+{}=7'.format(nums[0], nums[1], nums[2], nums[3]))

elif nums[0]+nums[1]+nums[2]-nums[3]==7:
    print('{}+{}+{}-{}=7'.format(nums[0], nums[1], nums[2], nums[3]))

elif nums[0]+nums[1]-nums[2]+nums[3]==7:
    print('{}+{}-{}+{}=7'.format(nums[0], nums[1], nums[2], nums[3]))

elif nums[0]+nums[1]-nums[2]-nums[3]==7:
    print('{}+{}-{}-{}=7'.format(nums[0], nums[1], nums[2], nums[3]))

elif nums[0]-nums[1]+nums[2]+nums[3]==7:
    print('{}-{}+{}+{}=7'.format(nums[0], nums[1], nums[2], nums[3]))

elif nums[0]-nums[1]+nums[2]-nums[3]==7:
    print('{}-{}+{}-{}=7'.format(nums[0], nums[1], nums[2], nums[3]))

elif nums[0]-nums[1]-nums[2]+nums[3]==7:
    print('{}-{}-{}+{}=7'.format(nums[0], nums[1], nums[2], nums[3]))

elif nums[0]-nums[1]-nums[2]-nums[3]==7:
    print('{}-{}-{}-{}=7'.format(nums[0], nums[1], nums[2], nums[3]))


Measured memory_bytes: 3064
#include<stdio.h>
#include<cmath>
#include<algorithm>
using namespace std;
long long a[200007];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i = 1; i <= n; i++)
    {
        scanf("%lld",&a[i]);
        a[i] -= i;
    }
    sort(a+1,a+n+1);
    long long b = 0,ans = 0;
    if(n%2==0)
        b = (a[n/2]+a[n/2+1])/2;
    else b = a[n/2+1];
    for(int i = 1; i <= n; i++)
        ans += abs(a[i]-b);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
using namespace std;
typedef long long ll;
static const int MAX = 100000;
static const int NIL = -1;

int n;
vector<pair<ll, ll> > adj[MAX];
ll color[MAX];

void dfs();


int main() {
    ll u, v, c;

    cin >> n;
    for ( int i = 0; i < n-1; i++ ) {
        cin >> u >> v >> c;
        adj[u-1].push_back(make_pair(v-1, c));
        adj[v-1].push_back(make_pair(u-1, c));
    }

    dfs();

    for ( int i = 0; i < n; i++ ) {
        //cout << i << " " << color[i]  << '\n';
        cout << color[i] % 2 << '\n';
    }

}


void dfs() {

    stack<pair<ll, ll> > S;
    for ( int i = 0; i < n; i++) {
        color[i] = NIL;
    }
    color[0] = 0;
    S.push(make_pair(0, 0));
    
    while (!S.empty()) {
        pair<ll, ll> P = S.top(); S.pop();
        ll u = P.first;
        ll w = P.second;
        for (int i = 0 ; i < adj[u].size(); i++) {
            ll v = adj[u][i].first;
            if (color[v] == NIL) {
                color[v] = w + adj[u][i].second;
                S.push(make_pair(v, w + adj[u][i].second));
            }
        }
    }

}


Measured memory_bytes: 8704
import java.io.*;
public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder stb=new StringBuilder();
        int a=Integer.parseInt(buf.readLine());
        int[] h=new int[a];
        String[] str=buf.readLine().split(" ");
        
        for(int i=0;i<h.length;i++){
            h[i]=Integer.parseInt(str[i]);
        }
        Sert(h,a);
    }
        
public static void Sert(int[] h,int a){
        int v,j;
        for(int i=0;i<h.length;i++){
             v=h[i];
             j=i-1;
             while(j>=0 && h[j]>v){
                 h[j+1]=h[j];
                 j--;
             }
             h[j+1]=v;
             toArray(h);
        }
    }

public static void toArray(int[] h){
    StringBuilder sbu=new StringBuilder();
    for(int i=0;i<h.length;i++){
      sbu.append(h[i]); 
      if(i<h.length-1)sbu.append(" ");
    }
    System.out.println(sbu);
    }
}

Measured memory_bytes: 26824
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
        int[] list = new int[n];
        for(int i = 0; i < n; i++) {
          int value = sc.nextInt();
          list[value - 1] = i + 1;
        }
      
        int target = 1;
        StringBuilder builder = new StringBuilder();
        for(int i = 0; i < n; i++) {
          if (i == 0) {
            builder.append(list[i]);
          } else {
            builder.append(" " + list[i]);
          }
        }
    
		// 出力
		System.out.println(builder.toString());
	}
}


Measured memory_bytes: 57780
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int a, b, t;
    cin >> a >> b >> t;
    cout << t / a * b << endl;
    return 0;
}


Measured memory_bytes: 256
a,b,c=map(int,raw_input().split())

ab=a*10+b
ba=b*10+a

bc=b*10+c
cb=c*1-+b

ca=c*10+a
ac=a*10+c

ans=max(ab+c,ba+c,bc+a,cb+a,ca+b,ac+b)

print ans

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

int main(){
  int n, m;
  cin >> n >> m;
  vector<vector<int>> k(m, vector<int>(0));
  for(int i=0; i<m; ++i){
    int ki;
    cin >> ki;
    for(int j=0; j<ki; ++j){
      int s;
      cin >> s;
      k[i].push_back(s);
    }
  }
  vector<int> p(m);
  for(int i=0; i<m; ++i) cin >> p[i];
  
  int ans = 0;
  for(int i=0; i<(1<<n); ++i){
    bool ansis = true;
    for(int j=0; j<m; ++j){
      int cnt = 0;
      for(int a: k[j]){
        if((i>>(a-1)) & 1) ++cnt;
      }
      if(cnt%2 != p[j]){
        ansis = false;
      }
    }
    if(ansis) ++ans;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3612
import java.util.Scanner;

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

        while(true){
            int m = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
            if(m == -1 && f == -1 && r == -1){
                break;
            }

            int sum = m + f;
            if(m == -1 || f == -1 || sum < 30){
                System.out.println("F");
            }else if(sum < 50 && sum >= 30){
                if(r >= 50){
                    System.out.println("C");
                }else{
                    System.out.println("D");
                }
            }else if(sum < 65 && sum >= 50){
                System.out.println("C");
            }else if(sum < 80 && sum >= 65){
                System.out.println("B");
            }else{
                System.out.println("A");
            }
        }
    }
}


Measured memory_bytes: 26420
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int yakusu(int n) {
  int ret = 0;
  for (int i = 1; i <= n; i++) {
    if (n % i == 0) ret++;
  }
  return ret;
}

int main() {
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; i+=2) {
    if (yakusu(i) == 8) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
using namespace std;

int main()
{
  int N,K,ans=1000000010;
  cin>>N>>K;
  vector<int> h(N);
  for(int i=0;i<N;i++)cin>>h[i];
  sort(h.begin(),h.end());
  for(int i=0;i+K-1<N;i++){
    ans=min(ans,h[i+K-1]-h[i]);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
string s[100100];

void solve() {
    map<string, int> m;
    for (int i = 0; i < n; i++) m[s[i]]++;

    for (string r : {"AC", "WA", "TLE", "RE"}) {
        cout << r << " x " << m[r] << endl;
    }
}

void input() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> s[i];
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    solve();
}


Measured memory_bytes: 6768
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <math.h>
#include <limits>

template <typename T>
void vc(T t) {
    std::cout << t << " ";
}

template<typename T, typename... Args>
void vc(T t, Args... args) {
// recursive variadic function
    std::cout << t << " ";
    vc(args...) ;
}

const int N = 100000;
std::vector<std::vector<long long> > dp(100 + 1, std::vector<long long>(100000 + 1, -1));
long long dpf(const std::vector<int>& vw, const std::vector<long long>& vv, int w, int r, int n) {
  // vc("call", r, w, "- \n");
  if (w < 0) {
    return 0;
  }
  if (dp[r][w] != -1) {
    return dp[r][w];
  }
  if (r == n) {
    if (w >= vw[r]) {
      dp[r][w] = vv[r];
    } else {
      dp[r][w] = 0;
    }
    // vc("return ", r, w, vw[r], dp[r][w], "\n");
    return dp[r][w];
  }
  if (w >= vw[r]) {
    auto take = vv[r] + dpf(vw, vv, w - vw[r], r + 1, n);
    auto not_take = dpf(vw, vv, w, r + 1, n);
    // vc("in ", r, w, take, not_take, "\n");
    dp[r][w] = std::max(take, not_take);
    // dp[r][w] = std::max(vv[r] + dpf(vw, vv, w - vw[r], r + 1, n),
    //                  dpf(vw, vv, w, r + 1, n));
  } else {
    dp[r][w] = dpf(vw, vv, w, r + 1, n);
  }
  // vc("return ", r, w, dp[r][w], "\n");
  return dp[r][w];
}

void once() {
  int n, w;
  std::cin >> n >> w;
  std::vector<int> vw(n + 1);
  std::vector<long long> vv(n + 1);
  for (int i = 1; i <= n; ++i) {
    std::cin >> vw[i] >> vv[i];
  }
  // vc("return , r, w, dp[r][w], \n");
  std::cout << dpf(vw, vv, w, 1, n) << std::endl;
}

int
main() {
  int n = 1;
  std::ios::sync_with_stdio(false);
  // std::cin >> n;
  while (n--) {
    once();
  }
}

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

using namespace std;

#define ll long long
#define pb push_back
#define debug2(x,y) cout << x << " " << y << "\n"

ll const mod  = 1e9+7;

int main() {
    int n;
    cin >> n;
    vector<ll>arr(n);
    for(int i = 0; i < n; i++)
        cin >> arr[i];

    ll ans = 0, sum = 0;
    for(int i = 0; i < n ; i++){
        ans = (ans + (arr[i] * sum) % mod) % mod;
        sum = (sum + arr[i]) % mod;
    }
    cout << ans << "\n";
}






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

using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
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;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    string s;
    cin >> n >> s;
    vector<int> w(n + 1, 0);
    vector<int> e(n + 1, 0);
    REP(i, n) {
        if (s[i] == 'W') {
            w[i + 1] = w[i] + 1;
            e[i + 1] = e[i];
        } else {
            w[i + 1] = w[i];
            e[i + 1] = e[i] + 1;
        }
    }
    int ans = INF;
    REP(i, n) chmin(ans, w[i] + e[n] - e [i + 1]);
    cout << ans << EOL;
}



Measured memory_bytes: 2964
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

int N;
vector<int> G[10005];
vector<int> v;
int id;
int w[10005];

int main(){
  cin >> N;
  rep(i,N-1){
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  rep(i,N){
    int c;
    cin >> c;
    v.push_back(c);
  }
  sort(ALLOF(v));
  reverse(ALLOF(v));

  ll sum = 0;
  REP(i,1,N) sum += v[i];
  
  rep(i,N+1) w[i] = -1;
  id = 0;
  queue<int> que;
  que.push(1);
  while(!que.empty()){
    int x = que.front(); que.pop();
    w[x] = v[id++];

    rep(i,G[x].size()){
      if(w[G[x][i]] != -1) continue;
      que.push(G[x][i]);
    }
  }

  cout << sum << endl;
  REP(i,1,N+1){
    if(i > 1) cout << " ";
    cout << w[i];
  }
  cout << endl;
  
  return 0;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;
using AtCoderBeginnerContest161.Questions;
using AtCoderBeginnerContest161.Extensions;

namespace AtCoderBeginnerContest161
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

namespace AtCoderBeginnerContest161.Questions
{
    // ここにQuestionクラスをコピペ
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<string> Solve(TextReader inputStream)
        {
            var n = inputStream.ReadIntArray();
            Swap(ref n[0], ref n[1]);
            Swap(ref n[0], ref n[2]);
            yield return $"{n[0]} {n[1]} {n[2]}";
        }

        private void Swap(ref int a, ref int b)
        {
            int temp = b;
            b = a;
            a = temp;
        }
    }


    #region Base Classes

    public interface IAtCoderQuestion
    {
        IEnumerable<string> Solve(string input);
        IEnumerable<string> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<string> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<string> Solve(TextReader inputStream);
    }

    #endregion
}

#region Extensions

namespace AtCoderBeginnerContest161.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 13396
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define ort (bas+son)/2

const lo MAX = -1000000000000000000; 
const lo MIN = 1000000000000000000; 
const lo inf = 1000000000; 
const lo KOK = 100000; 
const lo LOG = 30; 
const lo li = 100005; 
const lo mod = 1000000007; 

int n,m,cev,b,a[li],k;
string s;
vector<int> v;

int main(void){
	cin>>s;
	for(int i=0;i<(int)s.size();i++){
		if(s[i]=='+') cev++;
		else cev--;
	}
	cout<<cev<<endl;
	
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

class MyClass
{
    public static void Main(string[] args)
    {
        var x = int.Parse(Console.ReadLine());
        var youbi = new[] { "mon", "tue", "wed", "thu", "fri", "sat", "sun" };
        Console.WriteLine(youbi[(x + 3) % 7]);
    }
}


Measured memory_bytes: 17984
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
constexpr auto mod = 1000000007;
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
int COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
struct edge { int to, cost; };
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int m, k;
signed main() {
	cin >> m >> k;
	if (m == 1) {
		if (k == 0)cout << 0 << " " << 0 << " " << 1 << " " << 1;
		else puts("-1");
	}
	else {
		if (pow(2, m) <= k)puts("-1");
		else {
			for (int i = pow(2, m) - 1; i >= 0; i--) {
				if (i != k)cout << i << " ";
			}
			cout << k << " ";
			for (int i = 0; i <= pow(2, m) - 1; i++) {
				if (i != k)cout << i << " ";
			}
			cout << k;
		}
	}
	ggr
}


Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    int ans = -1;
    int cur = 1;
    for (int i = 1; i < n; ++i) {
        if (a[i - 1] >= a[i])
            ++cur;
        else {
            ans = max(ans, cur);
            cur = 1;
        }
    }
    ans = max(ans, cur);
    cout << ans - 1 << '\n';
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

struct state{
  int v,cost,time;
  //state(int a,int b):v(a),h(b){}
};

bool operator<(const state& a,const state& b){
  return a.cost>b.cost;
}

struct edge{
  int to,cost,time,comp;
  //edge(int a,int b,int c,int d,int e):from(a),to(b),cost(c),time(d),comp(e){}
};

int n,m,h,k;
int s,t,p;
int ccost[256];
int dist[111][55];

int main(){
	cin.sync_with_stdio(false);
  while(1){
    cin>>n>>m>>h>>k;
    if(n==0)break;
    vector<edge> g[111];
    rep(i,m){
      int a,b,c,d,e;
      cin>>a>>b>>c>>d>>e;
      a--;b--;e--;
      g[a].push_back((edge){b,c,d,e});
      g[b].push_back((edge){a,c,d,e});
    }
    cin>>s>>t;
    s--; t--;

    int cs=(1<<k);
    rep(i,cs)ccost[i]=INF;
    ccost[0]=0;
    cin>>p;
    rep(i,p){
      int l,d,S=0;
      cin>>l>>d;
      rep(j,l){
        int kk;
        cin>>kk;
        kk--;
        S|=1<<kk;
      }
      rep(j,cs){
        if((S&j)==j)minch(ccost[j],d);
      }
    }
    rep(S,cs){
      rep(i,cs)rep(j,cs){
        if((i|j)==S){
          minch(ccost[S],ccost[i]+ccost[j]);
        }
      }
    }
    int res=INF;
    rep(S,cs){
      if(ccost[S]==INF)continue;
      priority_queue<state> que;
      que.push((state){s,0,0});
      rep(i,111)rep(j,55)dist[i][j]=INF;
      while(que.size()){
        state ns=que.top(); que.pop();
        if(dist[ns.v][ns.time]!=INF)continue;
        dist[ns.v][ns.time]=ns.cost;
        rep(i,g[ns.v].size()){
          int nv=g[ns.v][i].to,nt=ns.time+g[ns.v][i].time,ncomp=g[ns.v][i].comp;
          if(nt>h)continue;
          if(((S>>ncomp)&1)==0){
            que.push((state){nv,ns.cost+g[ns.v][i].cost,nt});
          }else{
            que.push((state){nv,ns.cost,nt});
          }
        }
      }
      rep(i,h+1)minch(res,dist[t][i]+ccost[S]);
    }
    if(res==INF)cout<<-1<<endl;
    else cout<<res<<endl;
  }
	return 0;
}

Measured memory_bytes: 3420
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(i,j,n) for(ll i = (ll)(j); i < (ll)(n); i++)
#define mrep(i,n) for (ll i = (ll)(n-1); i >= 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main(){
	string s; cin >> s;
	if(s[0]=='9'||s[1]=='9') cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

#define int long long

using namespace std;

vector<int> a;
int dp[100000][11];

void Init(void) {
  a.clear();
}

void dp_init(void) {
  for (int i = 0; i < a.size(); i++) {
    for (int j = 0; j < 11; j++) {
      dp[i][j] = 0;
    }
  }
}

void Prepro(void) {
  int m = -1;
  int l = 1;
  for (auto&v : a) {
    l *= m;
    v *= l;
  }
  for (auto&v : a) {
    if (v >= 0) {
      v %= 11;
    } else {
      v %= 11;
      v = 11 + v;
    }
  }
}

void Solve(void) {
  dp_init();

  for (int i = 0; i < a.size(); i++) {
    for (int j = 0; j < 11; j++) {
      if (a[i] > 0 && a[i] == j) {
        dp[i][j] += 1;
      }
      if (i > 0) dp[i][j] += dp[i - 1][(11 + j - a[i]) % 11];
    }
  }
  int ans = 0;
  for  (int i = 0;i < a.size(); i++) ans += dp[i][0];

  cout << ans << endl;
}

signed main(void) {
  while (true) {
    Init();
    string s;
    cin >> s;
    if (s.size() == 1 && s[0] == '0') break;
    for (auto c : s) {
      a.push_back(c - '0');
    }
    Prepro();
    Solve();
  }
}


Measured memory_bytes: 10576
#include <stdio.h>
int main(){

  int a,x;

  x=1;
  a=1;

  while (x <= 10000){

    scanf("%d",&x);

    if (x >= 1 && 10000 >= x){

      printf("Case %d: %d\n",a,x);

      a++;

    } else {

      break;

    }

  }

  return 0;
  
}

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

#define ll long long 
#define int long long 
#define mod 1e9 + 7
void add(ll &a, ll b){
	a += b;
	if(a >= mod)
		a -= mod;
	}
	
void sub(ll &a, ll b){
	a -= b;
	if(a >= mod)
		a -= mod;
	else if(a < 0)
		a += mod;
	}
	
signed main(){
	int n, k;
	cin>>n>>k;
	//~int arr[n];
	vector<ll> dp(k+1, 0);
	dp[0] = 1;
	for(int i = 0; i<n; i++)
	{
		int maxa;
		cin>>maxa;
		vector<ll> fake(k+1, 0);
		for(int j = k; j>=0; j--){
			ll temp = dp[j];
			int l = j+1;
			int r = j + maxa;
			if(l <= k)
				add(fake[l], temp);
			if(r < k)
				sub(fake[r+1], temp);
			}
		for(int j = 1; j <=k; j++)
		{
			add(fake[j], fake[j-1]);
			add(dp[j], fake[j]);
			}
		}
	cout << dp[k] << endl;
	return 0;
	}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
using namespace std;
int main()
{
  int num;
  cin>>num;
  vector<int> m(num+1);
  for(int i=0;i<num;i++) cin>>m.at(i)>>m.at(i+1);

  //dp[i][j]はi行列iからjまでの計算回数の最小値を格納している
  int dp[num+1][num+1];
  //スタートとゴールは等しくならないので0を入れる
  for(int i=1;i<=num;i++) dp[i][i]=0;


  //対象とする行列の数l
  for(int l=2;l<=num;l++)
  {
    for(int i=1;i<=num-l+1;i++)
    {
      int j=i+l-1;
      dp[i][j]=(1<<21);
      for(int k=i;k<=j-1;k++)
      {
        dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+m.at(i-1)*m.at(k)*m.at(j));
      }
    }
  }
  cout<<dp[1][num]<<endl;


}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int ChangeToInt(string s){
	return stoi(s);
}

int main() {
	string s; cin >> s;
	int l = s.length();
	int ans = 1000000;
	for (int i = 0; i < l - 2; ++i)
	{
		int hypo = ChangeToInt(s.substr(i,3));
		int hypo_ans = abs(753 - hypo);
		ans = min(ans, hypo_ans);

	}

	cout << ans << endl;



}

Measured memory_bytes: 256
A, B, C, D, E, F = map(int, input().split())
density = 0
for i in range(F//(100*A) +1):
    for j in range((F-100*A*i)//(100*B)+1):
        water = 100*A*i + 100*B*j
        if water == 0:
            continue
        for k in range((F-water)//C+1):
            for l in range((F-water-C*k)//D+1):
                sugar = C*k + D*l
                if density <= sugar/(sugar + water) and sugar <= (E/100)*water:
                    density = sugar/(sugar + water)
                    ans = [sugar+water, sugar]
print(ans[0], ans[1])

Measured memory_bytes: 3064
#include<stdio.h>
#define MAX 110
#define INF 100000000

int m[MAX+1][MAX+1] = {};
int p[MAX+1];

int minimum(int a,int b){
  if( a > b) return b;
  else return;
         }

int main(){
  int n,i,j,k,l,q;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d%d",&p[i-1],&p[i]);
  }

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

  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j = i + l - 1;
      m[i][j] = INF;
      for(k=i;k<j;k++){
        q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
        m[i][j] = minimum(m[i][j],q);
      }
    }
  }
  printf("%d\n",m[1][n]);

  return 0;
}



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

int main(){
  string s;
  cin >> s;
  
  int news[4] = {0};
  
  for ( int i = 0; i < s.size(); i++ ){
    if ( s[i] == 'N' ) news[0] = 1;
    if ( s[i] == 'E' ) news[1] = 1;
    if ( s[i] == 'W' ) news[2] = 1;
    if ( s[i] == 'S' ) news[3] = 1;
  }
  
  if( news[0] == news[3] && news[1] == news[2] )
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<stack>
#include<queue>
#include<sstream>
#include<string>
#include<set>
#include<array>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i);
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

using namespace std;

int main(){

  string str;
  cin >> str;

  string code="CODEFESTIVAL2016";

  int cnt=0;
  rep(i,16){
    if(code[i]!=str[i]) cnt++;
  }

  cout << cnt  << endl;
}




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

int main(){
    char s[19];
    rep(i,19) cin >> s[i];
    
    rep(i,19){
        if(s[i]==','){
            s[i] = ' ';
        }
    }
    
    rep(i,19) cout << s[i];
}



Measured memory_bytes: 256
MOD = 10**9 + 7

N, K = map(int, input().split())

def getInvs(n, MOD):
    invs = [1] * (n+1)
    for x in range(2, n+1):
        invs[x] = (-(MOD//x) * invs[MOD%x]) % MOD
    return invs
def getCombNs(n, invs, MOD):
    combNs = [1] * (n//2+1)
    for x in range(1, n//2+1):
        combNs[x] = (combNs[x-1] * (n-x+1) * invs[x]) % MOD
    return combNs + combNs[:(n+1)//2][::-1]

invs = getInvs(N+3, MOD)
combN1s = getCombNs(K-1, invs, MOD)
combN2s = getCombNs(N-K+1, invs, MOD)

anss = []
for i in range(1, K+1):
    if K-i < 0 or N-K-i+1 < 0:
        ans = 0
    else:
        ans = combN1s[K-i] * combN2s[N-K-i+1] % MOD
    anss.append(ans)

print('\n'.join(map(str, anss)))


Measured memory_bytes: 3300
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(R):
    if R < 1200:
        return 'ABC'
    elif R < 2800:
        return 'ARC'
    return 'AGC'


def main():
    R = read_int()
    print(slv(R))


if __name__ == '__main__':
    main()


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

signed
main(){
	int n;
	while(cin >> n && n!=0)
	{
			vector<int> a(n);
			for(int i=0;i<n;i++)
					cin >> a[i];

			sort(a.begin(),a.end());
			int sa;
			int ans = INT_MAX;
			for(int i=1;i<n;i++){
					sa  = a[i] - a[i-1];
					if(ans > sa){
							ans = sa;
					}
			}
			cout << ans << endl;
	}
}


Measured memory_bytes: 3124