akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  string s;
  cin >> s;
  set<char> se;
  for(char c : s){
    se.insert(c);
  }
  if(se.size() == 1){
    cout << 0 << endl;
    return 0;
  }

  int ans = 1001001001;
  for(auto c : se){
    string ss = s;
    while(1){
      string nx;
      bool f = true;
      rep(i, ss.size()-1){
        if(ss.at(i) == c) nx.push_back(c);
        else{
          if(ss.at(i+1)== c) nx.push_back(c);
          else{
            nx.push_back(ss.at(i));
            f = false;
          }
        }
      }
      // if(c == 'a') cout << nx << endl;
      if(f == true){
        int add = s.size() - nx.size();
        ans = min(ans, add);
        break;
      }
      ss = nx;
    }
  }
  cout << ans << endl;
  return 0;
}

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

void show(vector<ll>& vc)
{
    for(auto it:vc)cout<<it<<" ";
    cout<<endl;
}
#define M 300014



/**
int marked[M/64 + 2];

#define on(x) (marked[x/64] & (1<<((x%64)/2)))
#define mark(x)  marked[x/64] |= (1<<((x%64)/2))

void bitwiseSieve() {
  for (int i = 3; i * i <=M; i += 2) {
    if (!on(i)) {
      for (int j = i * i; j <= M; j += i + i) {
        mark(j);
      }
    }
  }
}

bool isPrime(int num) {
  return num > 1 && (num == 2 || ((num & 1) && !on(num)));
}
**/


/**
vector<ll>phi(M+2);
bool p[M+2];

void euler_phi(void)
{

    for(ll i=0;i<=M;i++)phi[i]=i;
    memset(p,0,sizeof p);
    p[1]=1;
    p[0]=1;
    phi[1] = 0;

    for(ll i=2; i<=M; i++)
    {

        if(!p[i])
        {

            for(ll j=i; j<=M; j+=i)
            {
                p[j]=1;
                phi[j]/=i;
                phi[j]*=(i-1);

            }
            p[i]=0;
        }
    }


}
//**/


/**
bool p[M+2];
vector<ll>prime;
void seive(void)
{

    memset(p,0,sizeof p);
    p[1]=1;
    p[0]=1;

    for(ll i=4; i<=M; i+=2)
    {
        p[i]=1;

    }

    for(ll i=3; i*i<=M; i+=2)
    {

        if(!p[i])
        {

            for(ll j=i*i; j<=M; j+=2*i)
            {
                p[j]=1;

            }
        }
    }

    prime.push_back(2);
    for(ll i=3; i<=M; i+=2)prime.push_back(i);
}
//**/


/**
ll dx[] = {-1,-1,0,-1,1,0,1,1};
ll dy[] = {-1,0,-1,1,-1,1,0,1};
**/

/**
typedef pair<ll, ll> pii;
#define x first
#define y second


pii extendedEuclid(ll a, ll b)   // returns x, y | ax + by = gcd(a,b)
{
    if(b == 0) return pii(1, 0);
    else
    {
        pii d = extendedEuclid(b, a % b);
        return pii(d.y, d.x - d.y * (a / b));
    }
}

ll modularInverse(ll a, ll n)
{
    pii ret = extendedEuclid(a, n);
    return ((ret.x % n) + n) % n;
}
//**/


/**
ll bigmod(ll a, ll b, ll c)
{
    if(b==0)return 1;
    if(b%2)
    {
        ll p = bigmod(a,b-1,c);
        return (a*p)%c;
    }
    else
    {
        ll p = bigmod(a,b/2,c);
        return (p*p)%c;
    }
}
//**/





void solve(ll t)
{


    vector<string>vc;
    ll n,l;
    cin>>n>>l;
    for(int i=0; i < n ;i++)
    {
        string temp;
        cin>>temp;
        vc.push_back(temp);
    }
    sort(vc.begin(),vc.end());

    for(auto it:vc)cout<<it;
    cout<<endl;


}


int main()
{
//     freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);

    /**seive();        //**/
    /** euler_phi();    //**/
    /** show(phi);      //**/
    /** bitwiseSieve(); //**/




    ll t=1;
    //scanf("%lld",&t);
    ll T=t;



    while(t--)
    {


        solve(T-t);

    }
    return 0;
}


Measured memory_bytes: 3628
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <fstream>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <assert.h>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007LL 
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
 
 
#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
	std::fill((T*)array, (T*)(array + N), val);
}
 
//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)
 
struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}
 
};
typedef vector<vector<Edge>> Graph;
typedef unsigned long long ull;

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

ll lcm(ll m, ll n)
{
	return m * n / gcd(m, n);
}
ll mod_pow(ll x, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = (res * x) % MODU;
		x = (x*x)%MODU;
		n >>= 1;
	}
	return res;
}
ll divmod(ll a, ll b) { // a/b(mod m)
								  // a/b (mod m)
								  // a*b^-1
								  // b^-1 * b = 1
								  // b^(m-1) = 1 
								  // b^(m-2) * b = 1
								  // b^-1 = b^(m-2)

								  // a/b = a * b^(m-2)

	return (a * mod_pow(b, MODU - 2)) % MODU;
}
struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) { //ｘの入ってる集合と yの入ってる集合を併合
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) { //xとyが同じ集合に入っているかどうかを判定
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	bool isroot(int x) {
		return data[x] < 0;
	}
	int size(int x) {
		return -data[root(x)];
	}
};


int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	REP(i,n){
		cin >> a[i];
	}
	map<long long int,int> cnt;
	long long int acc = 0, ans = 0;

	REP(i,n){
		cnt[acc]++;
		acc += a[i];
		ans += cnt[acc];
	}

	cout << ans << endl;

	return 0;
}   

Measured memory_bytes: 13568
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <queue>
using namespace std;


int main() {
    int n, q ,t;
    string name;
    queue <pair<string, int> > Q;

    cin >> n >> q;
    for(int i=0; i<n; i++) {
        cin >> name >> t;
        Q.push(make_pair(name, t));
    }

    pair<string, int> u;
    int elaps = 0, a;
    while(!Q.empty()) {
        u = Q.front(); Q.pop();
        a = min(u.second, q);
        u.second -= a;
        elaps += a;
        if (u.second > 0) {
            Q.push(u);
        }
        else {
            cout << u.first << " " << elaps << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 6296
import java.util.Map.Entry;
import java.util.*;
import java.math.*;
import org.w3c.dom.css.Counter;
  
public class Main{
    public static void main(final String[] args){
       
        final Scanner sc = new Scanner(System.in);
        Long N = sc.nextLong();
        Long ans =0l;
        Long counter=0l;
        for(;N>1;){
                counter++;
                N =N/2l;
        }
        if(counter==0){
            System.out.println(1);
            return;
        }
        for(;counter>0;counter--){
            ans += (long)Math.pow(2l, counter);
        }
        System.out.println(ans+1);
        /* int K = sc.nextInt();
        Long ans = 0l;
        
        HashSet hoge =new HashSet<Integer>(); 
        ArrayList Zero =new ArrayList<Integer>(); 
        for(int i =0;i<N;i++){
                //hoge.add(sc.nextInt());
                Zero.add(sc.nextLong());
        }
        Collections.sort(Zero);
        int count =0;
        for(int i=N-1;0<K&& i>-1;i--){
            Zero.set(i, 0l);
            K--;
        }
        for(int i =0;i<N;i++){
            ans =ans+(Long)Zero.get(i);
        } */
        
        

/*         String abc = "abcdefghijklmnopqrstuvwxyz";
        Long alf = 26l;
        Long N = sc.nextLong();
        String ans = "";

        for(;N>0;){
            Long Num = N-1;
            int tStr = (int)(Num%alf);
            ans = abc.substring(tStr,tStr+1)+ans;
            N =  Num/alf;
        } */
    }
}
    


    

Measured memory_bytes: 35716
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use std::cmp::min;
use io::read;
fn main(){
    let a=read::<i32>();
    let b=read::<i32>();
    let c=read::<i32>();
    let d=read::<i32>();
    println!("{}",min(a,b)+min(c,d))
}


Measured memory_bytes: 4352
import collections

N,*S = open(0).read().split()
N = int(N)

c = collections.Counter(S)
c = sorted(c.items(),key=lambda x:(-x[1],x[0]))
maxCnt = c[0][1]
for i in range(len(c)):
  if c[i][1] == maxCnt:
    print(c[i][0])
  else:
    break


Measured memory_bytes: 59508
plates = [int(input()) for _ in range(5)]
plates.sort(key=lambda x:x % 10)
time = 0
first = False
for i in plates:
	if i % 10 == 0:
		time += i
	else:
		if not first:
			first = True
			time += i
		else:
			time += (i // 10) * 10 + 10
print(time)


Measured memory_bytes: 2940
#include <cstdio>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
  int n, q, tmp;
  set<int> s;

  scanf("%d", &n);
  for (int i = 0; i < n; i++)
  {
    scanf("%d", &tmp);
    s.insert(tmp);
  }

  scanf("%d", &q);
  vector<int> t(q);
  for (int i = 0; i < q; i++)
    scanf("%d", &t[i]);

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

  int count = 0;
  for (set<int>::iterator itr = s.begin(); itr != s.end(); itr++)
    if (binary_search(t.begin(), t.end(), *itr))
      count++;

  printf("%d\n", count);
  return 0;
}

Measured memory_bytes: 2880
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

//八方向を見るのに使うと便利(楽)
const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};

int n;
vector<int> edge[200005];
int sum;
vector<bool> isvisited(200005, false);

void DFS(int x){
  isvisited[x] = true;
  //cout << x << " ";
  rep(i, edge[x].size()){
    if(!isvisited[edge[x][i]]){
      sum ++;
      DFS(edge[x][i]);
    }
  }
  return;
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int m;
  cin >> n >> m;
  rep(i, m){
    int a, b;
    cin >> a >> b;
    edge[a].pu(b);
    edge[b].pu(a);
  }
  int ans = 0;
  reps(i, n){
    sum = 1;
    DFS(i);
    //cout << '\n';
    ans = max(ans, sum);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 20824
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REPR(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define FOR(i, n, m) for (ll i = (n); i < (m); ++i)
#define FORR(i, n, m) for (ll i = (m) - 1; i >= (n); --i) 
#define FORE(x, xs) for (auto &x: (xs))
#define ALL(v) v.begin(), v.end()
#define ZERO(a) memset(a,0,sizeof(a))

const int INF = 1000000009;
const int MOD = 1000000007;
const double EPS = 1e-14;
const double PI = acos(-1);

const int MAX = 1e5;

ll N;
vi x, y, h;
int check;

ll calc(int xx, int yy) { //xx, yyが中心だった時の高さ
  return abs(x[check]-xx)+abs(y[check]-yy)+h[check];
}

int main() {

  cin >> N;
  x = y = h = vi(N);
  REP (i, N) cin >> x[i] >> y[i] >> h[i];
  check = 0;
  while (h[check] == 0) check++;

  REP (xx, 101) REP (yy, 101) {
    ll H = calc(xx, yy);
    bool ans = true;
    REP (i, N) ans &= (h[i] == max(H-abs(xx-x[i])-abs(yy-y[i]), 0LL));
    if (ans) {
      cout << xx << " " << yy << " " << H << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define MOD 1000000007
#define f(i,a,n) for(lli i = a; i < n; i++)
#define fb(i,a,n) for(lli i=n-1;i>=a;i--)
 
#define p64 pair<lli,lli>
#define v64 vector<lli>
#define p32 pair<int,int>
#define v32 vector<int>
#define vp64 vector<pair<lli , lli >>
#define vp32 vector<pair<int , int>>
 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //cin>>t;
    while(t--){
        int a,b; cin>>a>>b;
        int ans = ceil(double(a)/b);
        cout<<ans<<endl;
}
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,q;
  cin>>n>>q;
  vector<tuple<int, int, int>> stx(n);
  for(int i=0;i<n;i++){
    cin >> get<1>(stx[i]) >> get<2>(stx[i]) >> get<0>(stx[i]);
  }
  sort(ALL(stx));
  set<pair<int,int>> d;
  for(int i=0;i<q;i++) {
    int x;cin>>x;
    d.insert({x,i});
  }
  vector<ll> ans(q,-1);
  for(int i=0;i<n;i++){
    auto first=d.lower_bound(make_pair(get<1>(stx[i])-get<0>(stx[i]),0));
    auto last=d.upper_bound(make_pair(get<2>(stx[i])-get<0>(stx[i])-1,q));

    for(auto it=first;it!=last;it++){
      ans[(*it).second]=get<0>(stx[i]);
    }
    d.erase(first,last);
  }
  for(int i=0;i<q;i++)cout<<ans[i]<<"\n";
}


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

int n, i, j, k, a, b, c, dp[100009][3];

int main()
{
    cin >> n;
    for(i = 1; i <= n; i++)
    {
        cin >> a >> b >> c;
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a;
        dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b;
        dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c;
    }

    cout << max({dp[n][0], dp[n][1], dp[n][2]});
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

/*
 * a b c d ... z
 * aa ab ac ad ... az ba ... bz
 * a -> nxtpos(a, b, ... z)
 * For a subsequence of length k starting at this pos we need to have 2^k
 * or else we have an ans.
 * Now we can fix our starting points as first occurence of (a b c ... z)
 * And try forming a sequence of length k
 * store the nxt[i][26]
 * Do a dfs and have the path to the minimum failure where failure implies
 * not having a nxt[i][k] for some k
 *
 * */
const int N = 200 * 1000 + 5;
vector <int> dp(N, MOD), path(N, -1);
vector <bool> vis;
vector <vector<int>> nxt;
void dfs(int s) {
	vis[s] = true;
	for (int i = 0; i < 26; i++) {
		int g = nxt[s][i];
		if (g == -1) {
			dp[s] = 0;
			path[s] = g;
			return;
		}
		if (!vis[g])
			dfs(g);
		if (dp[g] + 1 < dp[s]) {
			path[s] = g;
			dp[s] = dp[g] + 1;
		}
	}
}
int main() {
	string s;
	cin >> s;
	int n = (int) s.size();
	vector <int> nxtPos(26, -1);
	nxt.assign(n, vector<int>(26));
	for (int i = n - 1; i >= 0; i--) {
		for (int j = 0; j < 26; j++) {
			nxt[i][j] = nxtPos[j];
		}
		nxtPos[s[i] - 'a'] = i;
	}
	for (int i = 0; i < 26; i++) {
	    if (nxtPos[i] == -1) {
	        cout << char(i + 'a');
	        return 0;
	    }
	}
	vis.assign(n, false);
	for (int i = 0; i < n; i++) {
		if (!vis[i])
			dfs(i);
	}
	vector <int> seen(26, 0);
	vector <string> v;
	for (int i = 0; i < n; i++) {
		if (seen[s[i] - 'a']) continue;
		seen[s[i] - 'a'] = true;
		string t = "";
		int x = i, prev = -1;
		while(x != -1) {
			t += s[x];
			prev = x;
			x = path[x];
		}
		for (int j = 0; j < 26; j++) {
			if (nxt[prev][j] == -1) {
				t += char('a' + j);
				break;
			}
		}
		while (!v.empty() && (int) v.back().size() > (int) t.size()) {
			v.pop_back();
		}
		v.push_back(t);
	}
	sort(all(v));
	cout << v[0];
}


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

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

    ll flg = 0;
    for(ll i=n-2;i>=0;i--)
    {
        if(a[i]>a[i+1]) a[i]--;
        if(a[i]>a[i+1])
        {
            flg = 1;
            break;
        }
    }

    if(flg) cout<<"No";
    else    cout<<"Yes";
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>

int main()
{
    int i;
    char moji[10];
    
    scanf("%s", moji);
    i=strlen(moji);
    
    switch(i){
        case 2:
            if(strstr(moji, "hi"))
                printf("Yes");
            else
                printf("No");
            break;
        case 4:
            if(strstr(moji, "hihi"))
                printf("Yes");
            else
                printf("No");
            break;
        case 6:
            if(strstr(moji, "hihihi"))
                printf("Yes");
            else
                printf("No");
            break;
        case 8:
            if(strstr(moji, "hihihihi"))
                printf("Yes");
            else
                printf("No");
            break;
        case 10:
            if(strstr(moji, "hihihihihi"))
                printf("Yes");
            else
                printf("No");
            break;
        default:
            printf("No");
            break;
    }
    
    
    
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl

using namespace std;
using ll = long long;
const int INF = 1001001001;


int main() {
    int d, g; cin >> d >> g;
    vector<int> p(d), c(d);
    rep(i, d) {
        cin >> p[i] >> c[i];
    }

    int ans = INF;
    for (int bit = 0; bit < (1 << d); ++bit) {
        int cnt = 0;
        int score = 0;

        for (int j = 0; j < d; ++j) {
            if (bit >> j & 1) {
                cnt += p[j];
                score += p[j] * (j + 1) * 100 + c[j];
            }
        }

        if (score >= g) {
            ans = min(ans, cnt);
            continue;
        }

        for (int j = d - 1; j >= 0; --j) {
            if (bit >> j & 1) continue;
            for (int k = 0; k < p[j]; ++k) {
                if (score >= g) break;
                cnt++;
                score += 100 * (j + 1);
            }
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val a = io.StdIn.readInt()
    val b = io.StdIn.readInt()
    val c = io.StdIn.readInt()
    val d = io.StdIn.readInt()
    val e = io.StdIn.readInt()
    val k = io.StdIn.readInt()

    if(e - a <= k) println("Yay!")
    else           println(":(")
  }
}

Measured memory_bytes: 27212
A, B, C, D = map(int, input().split())

if B < D:
    if A < C:
        frst = B - C
    else:
        frst = B - A
else:
    if A < C:
        frst = D - C
    else:
        frst = D - A
    
if frst <= 0:
    print(0)
else:
    print(frst)

Measured memory_bytes: 2940
import sys 
input = sys.stdin.readline
MOD = 10**9 +7
INF = 10**9
from bisect import bisect_right

def main():
    a,b,c,d,e,f = map(int,input().split())
    a *= 100
    b *= 100
    X = set()
    Y = []
    for i in range(f//a + 1):
        for j in range((f - a * i)//b + 1):
            if i == 0 and j == 0:
                continue
            X.add(a * i + b * j)
    
    for i in range(f//c + 1):
        for j in range((f - i * c)//d + 1):
            Y.append((c * i + d * j))

    Y.sort()
    c = 0
    ans = (0,0)
    for x in X:
        lim = min(e * x // 100, f - x)
        idx = bisect_right(Y, lim)
        if idx == 0:
            continue
        else:
            y = Y[idx - 1]
            if c * (x + y) <= y:
                c = y / (x + y)
                ans = (x + y, y)
    
    print(*ans)

if __name__=='__main__':
    main()

Measured memory_bytes: 13364
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

int n, m;
int cl[ 100 ][ 100 ];

int main() {
	queue<PII> q;
	set<PII> s;
	while ( ~scanf("%d %d", &n, &m) && n && m ) {
		CLR( cl );
		bool can = false;
		int sx, sy, gx, gy;
		scanf( "%d %d", &sx, &sy );
		--sx;
		--sy;
		scanf( "%d %d", &gx, &gy );
		--gx;
		--gy;
		int k;
		scanf( "%d", &k );
		for ( int i = 0; i < k; i++ ) {
			int c, d, x, y;
			scanf( "%d %d %d %d", &c, &d, &x, &y );
			--x;
			--y;
			if ( d ) {
				for ( int i = 0; i < 4; i++ ) {
					for ( int j = 0; j < 2; j++ ) {
						cl[ y + i ][ x + j ] = c;
					}
				}
			}
			else {
				for ( int i = 0; i < 2; i++ ) {
					for ( int j = 0; j < 4; j++ ) {
						cl[ y + i ][ x + j ] = c;
					}
				}
			}
		}
		q.push( MP( sx, sy ) );
		while ( q.size() ) {
			int x = q.front().first;
			int y = q.front().second;
			q.pop();
			if ( s.count( MP( x, y ) ) ) {
				continue;
			}
			s.insert( MP( x, y ) );
			if ( x == gx && y == gy ) {
				can = true;
				break;
			}
			for ( int i = 0; i < 4; i++ ) {
				if ( x + dx[ i ] < 0 || x + dx[ i ] == n || y + dy[ i ] < 0 || y + dy[ i ] == m || cl[ y ][ x ] != cl[ y + dy[ i ] ][ x + dx[ i ] ] ) {
					continue;
				}
				q.push( MP( x + dx[ i ], y + dy[ i ] ) );
			}
		}
		printf( "%s\n", can ? "OK" : "NG" );
		while ( q.size() ) {
			q.pop();
		}
		s.clear();
	}
	return 0;
}

Measured memory_bytes: 1244
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  int N; cin >> N;
  vector<string> S(N);
  rep(i, N) cin >> S[i];

  vector<int> m(5, 0);
  rep(i, N) {
    if(S[i][0] == 'M') m[0]++;
    if(S[i][0] == 'A') m[1]++;
    if(S[i][0] == 'R') m[2]++;
    if(S[i][0] == 'C') m[3]++;
    if(S[i][0] == 'H') m[4]++;
  }
  
  int ans = 0;
  
  rep(i, 5) rep(j, 5) rep(k, 5) {
    if(i != j && j != k && k != i) {
      ans += m[i]*m[j]*m[k];
    }
  }
  
  

  cout << ans/6 << endl;

}


Measured memory_bytes: 6272
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(x) for(auto it=(x).begin();it!=(x).end();it++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
//#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

int main(){
    string s;
    int ans=0;
    while(cin>>s){
        reverse(all(s));
        string t="";
        rep(i,0,s.size()){
            if('0'<=s[i] && s[i]<='9'){
                int count=0;
                ans+=(s[i]-'0')*pow(10,count);
                //t+=s[i]; //cout<<s[i]<<endl;
                while(i+1<s.size() && '0'<=s[i+1] && s[i+1]<='9'){
                   // t+=s[i+1]; //cout<<s[i+1]<<endl;
                   count++;
                   ans+=(s[i+1]-'0')*pow(10,count);
                   i++;
                }
            }
            /*cout<<t<<endl;
            rep(j,0,t.size()){
                ans+=(t[t.size()-j-1])*pow(10,j);
            }
            t.clear();*/
        }
    }
    cout<<ans<<endl;
    
    return 0;
}



Measured memory_bytes: 3224
n1,m1 = map(int,input().split())
dic = [0 for i in range(n1)]
se = set()
for i in range(m1):
    n,m = input().split()
    if n not in se and m == "WA":
        dic[int(n)-1] += 1
    else:
        se.add(n)
print(len(se),sum([dic[int(i)-1] for i in se]))


Measured memory_bytes: 14852
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int arr[n];
	for(int i=0;i<n;i++)
		cin>>arr[i];
	int c=0;
	for(int i=0;i<n;i+=2)
	{
		if(arr[i]%2!=0)
			c++;
	}
	cout<<c<<"\n";
}

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

using namespace std;


int main() {
	
	int L[12];
	int c[3] = { 0,0,0 };

	for (int i = 0; i < 12; i++)
		cin >> L[i];

	sort(L, L + 12);

	for (int i = 0; i < 3; i++) {
		if (L[0] == L[i + 1])
			c[0]++;
		if (L[4] == L[i + 5])
			c[1]++;
		if (L[8] == L[i + 9])
			c[2]++;
	}

	if (c[0] == 3 && c[0] == c[1] && c[1] == c[2])
		cout << "yes\n";

	else
		cout << "no\n";

	return 0;

}







Measured memory_bytes: 3144
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

int main(){
   int n;
   cin>>n;
   vector<int> a(n);
   for(int i=0;i<n;i++)cin>>a[i];
   vector<int> b(n);
   if(n%2==0){
      for(int i=0;i<n;i++){
         if(i%2==0)b[n/2+i/2]=a[i];
         else  b[n/2-(i+1)/2]=a[i];
      }
   }
   else {
      for(int i=0;i<n;i++){
         if(i%2==0)b[n/2-i/2]=a[i];
         else  b[n/2+(i+1)/2]=a[i];
      }
   }
   for(int i=0;i<n-1;i++){
      cout<<b[i]<<" ";
   }
   cout<<b[n-1]<<endl;
   
   
}

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


int main(){

    int N;
    cin >> N;
    for(int i=1;i<10;i++) {
        for(int j=1;j<10;j++){
            if(i*j == N) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System;
using static System.Console;
class E { static void Main() => new J(); }
class J
{
	public const int Inf = 1073741789;
	int[] G() => ReadLine().Split().Select(int.Parse).ToArray();
	public J()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve() => WriteLine(string.Join(" ", Calc()));
	IEnumerable<int> Calc()
	{
		var N = G()[0];
		var a = G();
		var rev = new int[N];
		var par = new[] { new RMQ(N), new RMQ(N) };
		for (var i = 0; i < N; i++)
		{
			rev[--a[i]] = i;
			par[i & 1][i] = a[i];
			par[1 - (i & 1)][i] = Inf;
		}
		var que = new PriorityQueue();
		var dict = new Dictionary<int, P>();
		Action<P> add = p =>
		{
			var z = par[p.l & 1].Min(p);
			if (z < Inf) { dict[z] = p; que.Enqueue(z); }
		};
		add(new P(0, N));
		while (que.Count > 0)
		{
			int x = que.Dequeue(), i = rev[x];
			var p = dict[x];
			int f = p.l & 1, y = par[1 - f].Min(i + 1, p.r), j = rev[y];
			yield return x + 1;
			yield return y + 1;
			add(new P(p.l, i));
			add(new P(i + 1, j));
			add(new P(j + 1, p.r));
		}
	}
}
struct P
{
	public int l, r;
	public P(int x, int y) { l = x; r = y; }
}
class RMQ
{
	int N2;
	int[] seg;
	public RMQ(int N)
	{
		N2 = 1;
		while (N2 < N) N2 <<= 1;
		seg = new int[2 * N2 - 1];
		for (var i = 0; i < 2 * N2 - 1; i++) seg[i] = J.Inf;
	}
	public void Update(int i, int v)
	{
		i += N2 - 1;
		seg[i] = v;
		while (i > 0)
		{
			i = (i - 1) / 2;
			seg[i] = Math.Min(seg[i * 2 + 1], seg[i * 2 + 2]);
		}
	}
	public int this[int n] { set { Update(n, value); } }
	public int Min(P p) => Min(p.l, p.r);
	public int Min(int from, int to) => Min(from, to, 0, 0, N2);
	int Min(int from, int to, int node, int l, int r)
	{
		if (to <= l || r <= from) return J.Inf;
		else if (from <= l && r <= to) return seg[node];
		else return Math.Min(Min(from, to, 2 * node + 1, l, (l + r) >> 1), Min(from, to, 2 * node + 2, (l + r) >> 1, r));
	}
}
class PriorityQueue
{
	List<int> list = new List<int>();
	public int Count { get; private set; } = 0;
	public void Enqueue(int x)
	{
		var pos = Count++;
		list.Add(x);
		while (pos > 0)
		{
			var p = (pos - 1) / 2;
			if (list[p] <= x) break;
			list[pos] = list[p];
			pos = p;
		}
		list[pos] = x;
	}
	public int Dequeue()
	{
		var value = list[0];
		var x = list[--Count];
		list.RemoveAt(Count);
		if (Count == 0) return value;
		var pos = 0;
		while (pos * 2 + 1 < Count)
		{
			var a = 2 * pos + 1;
			var b = 2 * pos + 2;
			if (b < Count && list[b] < list[a]) a = b;
			if (list[a] >= x) break;
			list[pos] = list[a];
			pos = a;
		}
		list[pos] = x;
		return value;
	}
}

Measured memory_bytes: 45888
#include<bits/stdc++.h>
using namespace std;
long long int ar[1000999];
int main()
{
    int a,b;
    int cnt=0,k,i=0,sum=0,cnt1=0;
    cin>>a;
    b=a;
    while(a--)
    {
        ++i;
        cin>>ar[i];
        sum+=ar[i];

    }
    sort(ar+1,ar+b+1);
    if(sum%b==0)
        k=sum/b;
    else
        k=sum/b+1;

    for(i=1; i<=b; i++)
    {
        cnt=cnt+(abs(ar[i]-k)*abs(ar[i]-k));
    }
    if(k==sum/b+1)
    {
        k=sum/b;
        for(i=1; i<=b; i++)
        {
            cnt1=cnt1+(abs(ar[i]-k)*abs(ar[i]-k));
        }
    }


    cout<<min(cnt,cnt1)<<endl;

}



























Measured memory_bytes: 256
package main

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

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

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

func main() {
	defer stdout.Flush()
	r := readInt()
	D := readInt()
	x := readInt()

	for i := 1; i <= 10; i++ {
		x = r*x - D
		println(x)
	}
}

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


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

typedef long long ll; typedef unsigned long long ull; typedef unsigned int uint; typedef long double ld;

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

int n;
cin >> n;
ll t;
ld ans = 1;
for (int i = 0; i < n; i++)
{
    cin >> t;
    if (ans != -1)
       ans *= t;
    if (ans > 1000000000000000000 || ans < 0)
       ans = -1;
    if (t == 0)
       ans = 0;
}
cout << (ll)ans;
return 0;
}

Measured memory_bytes: 3600
from bisect import *
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

a = sorted(a)
c = sorted(c)

rec = 0
for i in range(n):
    temp = b[i]
    l = bisect_left(a, temp)
    r = bisect_right(c, temp)
    rec += l * (n - r)
print(rec)

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

#if USE_CP_REDIR
#define CP \
    freopen("input.txt","r", stdin); \
    freopen("output.txt","w", stdout);
#endif

int main()
{
#ifdef CP
    CP;
#endif
    int N;
    cin >> N;
    long long cnt=0;

    for(long long x = 1; x <= N; ++x){
        long long Y = N/x;
        cnt += (Y * (Y+1) * x)/2;
    }

    cout << cnt  << endl;
}

Measured memory_bytes: 3636
import re
import doctest


class IO_for_Contest(object):
    @staticmethod
    def my_input():
        # return raw_input()
        return input()

    @staticmethod
    def read_from_input():
        return IO_for_Contest.read_n_int(3)

    @staticmethod
    def read_line():
        return IO_for_Contest.my_input().strip()

    @staticmethod
    def read_int():
        return int(IO_for_Contest.my_input().strip())

    @staticmethod
    def read_n_int(n):
        return list(map(
                    int,
                    re.split('\s+', IO_for_Contest.my_input().strip())))[: n]


def solve():
    buf = IO_for_Contest.read_from_input()
    a, b, x = buf[0], buf[1], buf[2]
    if x >= a and a + b >= x:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    # doctest.testmod()
    solve()

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

using namespace std;

class Group {
public:
    vector<int> root;
    int maxSize = -1;

    Group(int n) {
        root = vector<int>(n, -1);
    }

    int getRoot(int c) {
        return root[c] < 0 ? c : root[c] = getRoot(root[c]);
    }

    void merge(int a, int b) {
        int rootA = getRoot(a);
        int rootB = getRoot(b);
        if (rootA != rootB) {
            root[rootA] += root[rootB];
            root[rootB] = rootA;
            maxSize = root[rootA] < maxSize ? root[rootA] : maxSize;
        }
    }

    int getMax() {
        return -maxSize;
    }
};


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

    int a, b;
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        group.merge(--a, --b);
    }

    cout << group.getMax();
    return 0;
}

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

int main() {
  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;
  if( s == u) cout << a - 1 << " " << b <<endl;
  else cout << a << " " <<b - 1 << endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
//#define pw (ll)pow 
#define MAX 1000005
#define MOD (ll)1e9+7
using namespace std;

int main()	
{
	int a;
	cin >> a;
	cout << a+a*a+a*a*a << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>

#define int long

const int INF = 1000000009;
const long LINF = 1123456789012345678;

int n, e, s, w;
std::string t;

signed main(){
	std::cin >> t;
	for(int i = 0; i < t.length(); i++){
		if(t[i] == 'N'){
			n++;
		}else if(t[i] == 'S'){
			s++;
		}else if(t[i] == 'E'){
			e++;
		}else{
			w++;
		}
	}
	bool flagn = false;
	if(((n == 0 && s == 0) || (n > 0 && s > 0)) && ((e == 0 && w == 0) || (e > 0 && w > 0))){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}


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

using namespace std;

int n, m, l;
int a[123];
int b[123];
int o1, o2;
int odds;

int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; i++)
	{
		cin >> a[i];
		if (a[i] % 2 == 1)
		{
			if (odds == 0) o1 = i;
			else if (odds == 1) o2 = i;
			else
			{
				cout << "Impossible\n";
				return 0;
			}
			odds++;
		}
	}
	if (m == 1)
	{
		b[0] = 1;
		if (a[0] != 1)
		{
			b[1] = a[0] - 1;
			l = 2;
		}
		else
		{
			l = 1;
		}
	}
	else
	{
	if (odds >= 1) swap(a[0], a[o1]);
	if (odds == 2) swap(a[m-1], a[o2]);
	if (odds == 0)
	{
		b[l++] = 1;
		b[l++] = a[0];
	}
	else b[l++] = a[0] + 1;
	for (int i = 1; i < m-1; i++)
	{
		b[l++] = a[i];
	}
	if (a[m-1] - 1 != 0)
		b[l++] = a[m-1] - 1;
	}



	for (int i = 0; i < m; i++)
	{
		if (i) cout << ' ';
		cout << a[i];
	}
	cout << '\n';
	cout << l << '\n';
	for (int i = 0; i < l; i++)
	{
		if (i) cout << ' ';
		cout << b[i];
	}
	cout << '\n';
	return 0;
}



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

int main()
{
	int i,j ;
	while( cin >> i >> j )
	{
		i += j ;
		int count = 0 ;

		while( i > 0 )
		{
			i = i / 10 ;
			count ++ ;
		}

		cout << count << "\n" ;
	}

	return 0 ;
}

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

using namespace std;

int main() {
	int a[3];
	int b, c, d;
	b = c = d = 0;
	while (cin >> a[0] >> a[1] >> a[2]) {
		for (int i = 2; i >= 0; i--) {
			for (int j = 0; j < i; j++) {
				if (a[j] > a[j+1]) {
					swap(a[j], a[j+1]);
				}
			}
		}
		if (a[0] + a[1] <= a[2]) {
			cout << b+c+d << ' ' << b << ' ' << c << ' ' << d << endl;
			while (cin >> a[0] >> a[1] >> a[2]) {
			}
			break;
		}
		if (a[0]*a[0] + a[1]*a[1] == a[2]*a[2]) {
			b++;
		} else if (a[0]*a[0] + a[1]*a[1] > a[2]*a[2]) {
			c++;
		}  else {
			d++;
		}
	}
	return 0;
}

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

#ifdef _DEBUG
    #include "/home/v-o_o-v/deb.h"
    #define deb(x...)cerr << "[" << #x << "] = [";_print(x);
#else
    #define deb(x...)
#endif

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin >> n;
    int v[n], c[n];
    int ans = INT_MIN;
    for(int i = 0; i < n; i++)
        cin >> v[i];
    for(int i = 0; i < n; i++)
        cin >> c[i];

    for(int i = 0; i < (1 << n); i++){
        int cost = 0, sum = 0;
        for(int j = 0; j < n; j++){
            if(i & (1 << j)){
                cost += c[j];
                sum += v[j];
            }
        }
        ans = max(ans, sum - cost);
    }
    cout << ans << '\n';
    return 0;
}
// Write Here


Measured memory_bytes: 3656
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
#include<cstdio>
using namespace std;
pair<int, int>Points;
vector<pair<int,int> >a;
bool cmp(pair<int, int> a, pair<int, int> b)//从小到大
{
    if (a.first < b.first)return true;
    if (a.first == b.first && a.second < b.second)return true;
    return false;
     
}
int main()
{

    int T;
    scanf("%d", &T);
    int x,y;
    int n = T;
    while (T--) {
        scanf("%d%d", &x, &y);
        a.push_back(make_pair(x, y));
    }
    sort(a.begin(), a.end() , cmp);
    for (int i = 0; i < n; i++)
    {
        cout << a[i].first << " " << a[i].second<<endl;
    }
}


Measured memory_bytes: 3872
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

ll gcd(ll a, ll b)
{
    ll x = max(a, b);
    ll y = min(a, b);
    if (x % y == 0)
    {
        return y;
    }
    else
    {
        gcd(y, x % y);
    }
}
int main()
{
    int x, y;
    cin >> x >> y;
    if(y == gcd(x,y)){
        cout << -1 << endl;
    }else{
        cout << x << endl;
    }
    return 0;
}

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

typedef long long ll;

int main(){
  int A, P;
  cin >> A >> P;

  cout << (A*3+P)/2 << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using i64 = long long;

bool check(string s) {
  if (s[0]!='A') return false;
  s[0]='a';
  int j=0;
  rep(i,2,sz(s)-1) {
    if (s[i]=='C') {
      j=i;
      break;
    }
  }
  if (j==0) return false;
  s[j]='c';
  for (char c:s) if (!islower(c)) return false;
  return true;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout<<fixed<<setprecision(10);

  string s;
  cin>>s;
  if (check(s)) cout<<"AC\n"; else cout<<"WA\n";
}


Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		//半径rの円の面積と外周を求める
		Scanner sc=new Scanner(System.in);
		double r=Double.parseDouble(sc.next());//半径
		double pi=Math.PI;//円周率
		double m=r*r*pi;
		String val_m=String.valueOf(m);
		BigDecimal bd_m=new BigDecimal(val_m);
		BigDecimal menseki=bd_m.setScale(6,BigDecimal.ROUND_DOWN);
		double g=2*r*pi;
		String val_g=String.valueOf(g);
		BigDecimal bd_g=new BigDecimal(val_g);
		BigDecimal gaisyu=bd_g.setScale(6,BigDecimal.ROUND_DOWN);
		System.out.println(menseki+" "+gaisyu);
	}

}



Measured memory_bytes: 26456
#include<bits/stdc++.h>
using namespace std;
#define nn 400
#define mod 1000000007
#define int long long
int qpow(int x,int y=mod-2){
	int res=1;while(y){
		if(y&1) res=res*x%mod;
		x=x*x%mod;y=y/2;
	}
	return res;
}
void add(int&x,int y){
	x=(x+y)%mod;
}

int cho[3][nn],n;
int f[nn],rf[nn];
int C(int x,int y){
	if(x<y) return 0;
	return f[x]*rf[y]%mod*rf[x-y]%mod;
}
int A(int x,int y){
	if(x<y) return 0;
	return f[x]*rf[x-y]%mod;
}

int dp[nn][nn];
int eat(){
	dp[0][0]=1;
	for(int i=0;i<n/3;i++) for(int j=0;j<=i*2;j++) for(int h=0;h<=j;h++)
		add(dp[i+1][j+2-h],dp[i][j]*A(j,h));
	int base=0;
	for(int i=0;i<nn;i++) add(base,dp[n/3][i]*f[i]);
	return base;
}

int dif[nn][nn],tome[nn][nn],ua[nn],ub[nn];
void ini(){
	for(int i=1;i<=n;i++) for(int j=1;j<=n;j++){
		memset(ua,0,sizeof ua);memset(ub,0,sizeof ub);
		for(int k=1;k<=i;k++) ua[cho[0][k]]=1;for(int k=1;k<=j;k++) ub[cho[1][k]]=1;
		for(int k=1;k<=n;k++) dif[i][j]+=(ua[k]|ub[k]);
		tome[i][j]=((!ua[cho[1][j]])&&(!ub[cho[0][i]]));
	}
}
int ef[nn],cyka[2][nn][nn];
int solve(){
	#define dp cyka
	int now=0;
	for(int t=n/3;t>=1;t--){
		now^=1;memset(dp[now],0,sizeof dp[now]);
		memset(ef,0,sizeof ef);
		for(int i=n;i>=1;i--) {
			int pre=(t==n/3);
			for(int j=n;j>=1;j--){
				if(tome[i][j]) dp[now][i][j]=pre*(3*t-dif[i][j])%mod;
				add(pre,ef[j]);
				add(ef[j],dp[now^1][i][j]);
			}
		}
	}
	int base=0;
	for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) add(base,dp[now][i][j]);
	return base;
}

signed main(){
//	freopen("c.in","r",stdin);freopen("c.out","w",stdout);
	rf[0]=f[0]=1;for(int i=1;i<nn;i++) f[i]=f[i-1]*i%mod,rf[i]=qpow(f[i]);
	scanf("%lld",&n);for(int j=0;j<2;j++)for(int i=0;i<n;i++) scanf("%lld",&cho[j][i+1]);

	ini();cout<<((solve()*eat())%mod+mod)%mod;
	return 0;
} 
/*
3
1 2 3
2 3 1
*/
/*
6
1 2 3 4 5 6
2 1 4 3 6 5
*/

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const ll INF = 1LL << 58;
const ll MOD = 1000000007;
typedef vector<pii> vpii;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

signed main()
{
    string S;
    cin >> S;
    REP(i, S.size() / 2)
    {
        REP(j, (S.size() - (i + 1) * 2) / 2)
        {
            if (S[j] != S[j + (S.size() - (i + 1) * 2) / 2])
                break;
            if (j == (S.size() - (i + 1) * 2) / 2 - 1)
            {
                cout << S.size() - (i + 1) * 2 << endl;

                return 0;
            }
        }
    }
    // system("pause");
}

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


int main()
{
    int N;
    cin >> N;
    vector<pair<int,int>> ball(N);
    for( int i = 0; i < N; ++i ) cin >> ball[i].first >> ball[i].second;


    int cost = 51;
    for( int i = 0; i < N; ++i ){
        for( int j = 0; j < N; ++j ){
            if( i == j ) continue;
            int p = ball[j].first - ball[i].first;
            int q = ball[j].second - ball[i].second;
            int same_d = 0;
            for( int k = 0; k < N; ++k ){
                for( int l = 0; l < N; ++l ){
                    if( k != l 
                    and p == ball[l].first - ball[k].first
                    and q == ball[l].second - ball[k].second ) ++same_d;
                }
            }
            cost = min(cost, N-same_d);
        }
    }
    if(N == 1) cout << 1 << endl;
    else cout << cost << endl;

    return 0;
}

Measured memory_bytes: 256
s = input()
muximum = 'zyxwvutsrqponmlkjihgfedcba'
if s == muximum:
    print(-1)
else:
    if len(s) == 26:
        d = {c:0 for c in s}
        for i, c in enumerate(reversed(s)):
            for x in range(ord(c), ord('z') + 1):
                if chr(x) not in d:
                    break
            else:
                del d[c]
                continue
            break
        print(s[:-i-1] + chr(x))
    else:
        diff = set(muximum) - set(s)
        print(s + sorted(diff)[0])


Measured memory_bytes: 3064