akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Scanner;




class Main{


	static	ArrayList<Integer> one ;
	static	ArrayList<Integer> two ;
	static	ArrayList<Integer> three ;
	static	ArrayList<Integer> four ;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);			//文字の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(a + b >= 24){
			System.out.println(a + b -24);
		}else{
			System.out.println(a + b );

		}
	}
}

class Pair implements Comparable{
	Character from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}




Measured memory_bytes: 21844
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
ct = 0
for t in T:
    left = 0
    right = n - 1
    while left <= right:
        mid = (left + right) // 2
        if S[mid] == t:
            ct += 1
            break
        elif S[mid] > t:
            right = mid - 1
        else:
            left = mid + 1
print(ct)


Measured memory_bytes: 16708
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define IN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef long long ll;
/////////////////////////(๑•﹏•๑｀)/////////////////////////
///AtCoder Beginner Contest 102///

int main() {
	int N; SCD(N);
	if (N % 2 == 0){
		PRINTD(N);
	}else{
		PRINTD(2*N);
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
int inf = 1000000000;

class tree{
public:
  int node;
  int parent = -1;
  int sibling = -1;
  int deg = 0;
  int depth = 0;
  int h = 0;
  vector<int> child;
  string type = "";
  void output(){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ", node, parent, sibling, deg, depth, h);
    cout << type << endl;
  }
};

vector<tree> bt;
void input(int id, int l, int r){
  bt[id].node = id;
  bt[l].sibling = r;
  bt[r].sibling = l;
  bt[l].parent = id;
  bt[r].parent = id;
  bt[id].deg = 2;
  if( l == -1 ){
    bt[id].deg--;
    bt[id].child.push_back(l);
  }else{
    bt[id].child.push_back(l);
  }
  if( r == -1 ){
    bt[id].deg--;
    bt[id].child.push_back(r);
  }else{
    bt[id].child.push_back(r);
  }
}

void getdepth(int pos, int depth){
  bt[pos].depth = depth;
  for(int i=0; i<bt[pos].child.size(); i++) getdepth(bt[pos].child[i], depth+1);
}

int getheight(int pos, int height){
  if( bt[pos].child.size() == 0 ) return height;
  else{
    int tmp = height;
    for(int i=0; i<bt[pos].child.size(); i++){
      tmp = max(tmp, getheight(bt[pos].child[i], height+1));
    }
    return tmp;
  }
}
vector<int> pre;
vector<int> post;
vector<int> ino;
void preorder(int now){
  // cout << now << endl;
  pre.push_back(now);
  for(int i=0; i<bt[now].child.size(); i++){
    if( bt[now].child[i] == -1 ) continue;
    preorder(bt[now].child[i]);
  }
}

void postorder(int now){
  for(int i=0; i<bt[now].child.size(); i++){
    if( bt[now].child[i] == -1 ) continue;
    postorder(bt[now].child[i]);
  }
  // cout << now << endl;
  post.push_back(now);
}

void inorder(int now){
  // for(int i=0; i<bt[now].child.size(); i++){
  //   inorder(bt[now].child[i]);
  //   ino.push_back(now);
  // }
  if( bt[now].child[0] != -1 ) inorder(bt[now].child[0]);
  ino.push_back(now);
  if( bt[now].child[1] != -1 ) inorder(bt[now].child[1]);

  // cout << now << endl;
}

int main(void) {

  int n;
  cin >> n;
  bt.resize(n);
  int id, l, r;
  for(int i=0; i<n; i++){
    cin >> id >> l >> r;
    input(id, l, r);
  }
  int root = -1;
  for(int i=0; i<n; i++){
    if( bt[i].parent == -1 ) root = bt[i].node;
  }

  getdepth(root, 0);
  // for(int i=0; i<n; i++){
  //   bt[bt[i].node].h = getheight(bt[i].node, 0);
  //   if( bt[bt[i].node].parent == -1 ) bt[bt[i].node].type = "root";
  //   else if( bt[bt[i].node].child.size() == 0 ) bt[bt[i].node].type = "leaf";
  //   else bt[bt[i].node].type = "internal node";
  // }
  // for(int i=0; i<n; i++){
  //   bt[i].output();
  // }
  preorder(root);
  inorder(root);
  postorder(root);
  cout << "Preorder" << endl;
  for(int i=0; i<n; i++){
    cout << " " << pre[i];
  }
  cout << endl << "Inorder" << endl;
  for(int i=0; i<n; i++){
    cout << " " << ino[i];
  }
  cout << endl << "Postorder" << endl;
  for(int i=0; i<n; i++){
    cout << " " << post[i];
  }
  cout << endl;

  return 0;
}

// EOF

Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
typedef pair<ll, ll> Pair;
template <class T> T input() {T t; cin>>t; return t;}
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define CHMAX(a,b) a = max(a,b)
#define CHMIN(a,b) a = min(a,b)
#define FIND(x,key) x.find(key) != x.end()
#define IN_RANGE_V2(v,k,x,y) (0<=x+dx[k]&&x+dx[k]<v[y].size()&&0<=y+dy[k]&&y+dy[k]<v.size())
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define PRINT_ARRAY_H(a) REPALL(__i,a) {cout<<a[__i]<<(__i != a.size()-1 ? " " : "");} newline;
#define PRINT_ARRAY_V(a) REPALL(__i,a) {cout<<a[__i]<<endl;}
#define e1 first
#define e2 second
#define newline putchar('\n')
#define cspace ' '
#define sspace " "
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;
const VI dx = {1, 0, -1, 0};
const VI dy = {0, 1, 0, -1};
//const VI dx = {1, 1, 0, -1, -1, -1, 0, 1};
//const VI dy = {0, 1, 1, 1, 0, -1, -1, -1};

void solve()
{
    ll b, c, d, n, m, l, r, k, x, y, z, ans = 0ll;
    string s, t;
    cin>>n>>k;
    VI a(n);
    REP(i,n) cin>>a[i];
    FOR(i,k,n) {
        Yes(a[i] > a[i-k]);
    }
}

int main()
{
    cout<<fixed<<setprecision(20);
    int __t = 1;
    //cin>>__t;
    REP(i,__t) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4048
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
using namespace std;

struct Node {
    int key;
    Node *right, *left, *parent;
};

Node *root, *NIL;

void insert(int k){
    Node *y = NIL;
    Node *x = root;
    Node *z;
    
    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;
    
    while(x != NIL){
        y = x;
        if(z->key < x->key){
            x = x->left;
        } else {
            x = x->right;
        }
    }
    z->parent = y;
    if(y == NIL){
        root = z;
    } else {
        if(z->key < y->key){
            y->left = z;
        } else {
            y->right = z;
        }
    }
}

void inorder(Node *u){
    if(u == NIL) return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u){
    if(u == NIL) return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main(){
    int n, i, x;
    string com;
    
    scanf("%d", &n);
    
    for(i=0; i<n; i++){
        cin >> com;
        if(com == "insert"){
            scanf("%d", &x);
            insert(x);
        } else if (com == "print"){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }
    
    return 0;
}


Measured memory_bytes: 26748
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll n; cin >> n;
    vector<pair<string, ll>> st(n);
    rep(i, n) cin >> st[i].first >> st[i].second;
    bool fallSleep = false;
    string x; cin >> x;
    ll ans = 0;
    for(ll i=0; i<n; i++){
        if(fallSleep) ans += st[i].second;
        else if(st[i].first == x) fallSleep = true;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3644
X = int(input())
flag = [0 for i in range(X+1)]
flag[1] = 1

for i in range(2, X+1):
  v = i*i
  while(v <= X):
    flag[v] = 1
    v *= i
    
for i in range(X, 0, -1):
  if flag[i] == 1:
    print(i)
    break
    

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

const int INF = 1e9;

int main()
{
	int N, A, B;
	cin >> N >> A >> B;
	vector<int> dp(N + 1, -INF);
	cin >> dp[0];
	for (int i = 0; i < N; i++) {
		int D;
		cin >> D;
		for (int j = i; j >= 0; j--) {
			dp[j + 1] = max(dp[j + 1], dp[j] + D);
		}
	}
	int res = 0;
	for (int i = 0; i <= N; i++) {
		res = max(res, dp[i] / (A + B * i));
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 3080
N, M, X, Y = map(int, input().split())
x_areas = list(map(int, input().split()))
y_areas = list(map(int, input().split()))

x_max = max(x_areas)
y_min = min(y_areas)

if x_max < y_min and x_max < Y and y_min > X:
  print('No War')
else:
  print('War')


Measured memory_bytes: 2940
from bisect import bisect, bisect_left


def bin_search(n):

    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))

    a.sort()
    c.sort()

    ans = 0

    for i in range(n):
        upper_b = bisect_left(a, b[i])
        under_b = n - bisect(c, b[i])
        ans += upper_b * under_b
    return ans


if __name__ == '__main__':
    n = int(input())
    print(bin_search(n))


Measured memory_bytes: 29384
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<58;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

class Graph{
	private:
	int V;
	vvi g;
	vi scc,Vec,used;
	void DFS(int v,int cnt){
		used[v]=1;
		for(int i=0;i<g[v].size();i++){
			int u=g[v][i];
			if(!used[u]) DFS(u,cnt);
		}
		scc[v]=cnt;
	}
	void Order(int v){
		used[v]=1;
		for(int i=0;i<g[v].size();i++){
			int u=g[v][i];
			if(!used[u]) Order(u);
		}
		Vec.push_back(v);
	}
	Graph Rev(){
		Graph G(V);
		for(int i=0;i<V;i++){
			for(int j=0;j<g[i].size();j++){
				int v=g[i][j];
				G.g[v].push_back(i);
			}
		}
		return G; 
	}
	int SCC(){
		scc=used=vi(V);
		for(int i=0;i<V;i++) if(!used[i]) Order(i);
		Graph RG=Rev();
		RG.used=vi(V,0);
		RG.scc=vi(V);
		int cnt=0;
		while(!Vec.empty()){
			int v=Vec.back();
			Vec.pop_back();
			if(!RG.used[v]){
				RG.DFS(v,cnt);
				cnt++;
			}
		}
		scc=RG.scc;
		return cnt;
	}
	ll dfs(int v){
		used[v]=1;
		ll res=1;
		for(int i=0;i<g[v].size();i++) (res*=dfs(g[v][i]))%=mod;
		return res+1;
	}
	public:
	Graph(int v){
		V=v;
		g=vvi(v);
	}
	void add_edge(int s,int t){
		g[s].push_back(t);
	}
	ll Solve(){
		ll res=1;
		used=vi(V);
		vi in(V);
		for(int i=0;i<V;i++) for(int j=0;j<g[i].size();j++) in[g[i][j]]++;
		for(int i=0;i<V;i++) if(!used[i]) (res*=dfs(i))%=mod;
		return res;
	}
	ll solve(){
		int GV=SCC();
		Graph G(GV);
		for(int i=0;i<V;i++) for(int j=0;j<g[i].size();j++){
			int v=g[i][j],su=scc[i],sv=scc[g[i][j]];
			if(su!=sv) G.add_edge(su,sv);
		}
		return G.Solve();
	}
};

int n,m;

int main(){
	cin>>n>>m;
	Graph g(n);
	for(int i=0;i<m;i++){
		int t,s;
		cin>>t>>s;
		g.add_edge(s-1,t-1);
	}
	cout<<g.solve()<<endl;
}

Measured memory_bytes: 3288
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		int c = 0;
		if(a>b) {
			c = a;
		}else if(a<b) {
			c = b;
		}else {
			System.out.println(a+a);
			System.exit(0);
		}
		
		System.out.println(c+(c-1));
		
		
	}

}


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

int main() {
    ll N, M, X;
    cin >> N >> M >> X;
    // vector<vector<ll>> vec(N,vector<ll>(M+1));
    vector<ll> C(N);
    vector<vector<ll>> A(N,vector<ll>(M));
    for (int i=0; i<N; i++) {
        cin >> C[i];
        for (int j=0; j<M; j++) {
            cin >> A[i][j];
        }
    }

    vector<ll> nedan;
    for (int s=0; s<(1<<N); s++) {

        vector<ll> rikaido(M,0);
        ll nedan_temp = 0;

        for (int i=0; i<N; i++) {
            if ((s>>i)&1) {
                nedan_temp += C[i];
                for (int j=0; j<M; j++) {
                    rikaido[j] += A[i][j];
                }
            }
        }

        int count = 0;
        for (int j=0; j<M; j++) {
            if (rikaido[j]>=X) {
                count++;
            }
        }

        if (count==M) {
            nedan.push_back(nedan_temp);
        }

    }

    ll ans;
    if (nedan.size()==0) {
        ans = -1;
    }
    else {
        sort(nedan.begin(),nedan.end());
        ans = nedan[0];
    }
    
    cout << ans << endl;

    /*
    sort(vec.begin(),vec.end(),[](const vector<ll> &alpha,const vector<ll> &beta){return alpha[0] < beta[0];});
    
    vector<ll> rikaido(M,0);
    ll ans = 0;
    ll flag = 0;
    for (int i=0; i<N; i++) {
        ans += vec[i][0];
        ll count = 0;
        for (int j=0; j<M; j++) {
            rikaido[j] += vec[i][j+1];
            if (rikaido[j]>=X) {
                count++;
            }
        }
        if (count==M) {
            flag = 1;
            break;
        }
    }
    if (flag==0) {
        ans = -1;
    }
    cout << ans << endl;
    */
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	ll tot = 0;
	rep(i,1,n+1)tot += 1LL*(n-i+1)*(n-i+2)/2;
	rep(i,0,n-1){
		int u,v;
		cin >> u >> v;
		if(u > v)swap(u,v);
		tot -= 1LL * u * (n + 1- v);
	}
	cout << tot << '\n';
}


Measured memory_bytes: 3652
from collections import deque
import sys
input = sys.stdin.readline


n, d, a = map(int, input().split())
monsters = []
for _ in range(n):
    pos, hp = map(int, input().split())
    monsters.append([pos, hp])

monsters.sort()

bomb_area = deque([])
bomb_power = deque([])
total_damage = 0
ans = 0
for pos, hp in monsters:
    while bomb_area:
        area = bomb_area[0]
        if area < pos:
            bomb_area.popleft()
            power = bomb_power.popleft()
            total_damage -= power
        else:
            break
    if hp <= total_damage:
        continue
    else:
        count = (hp-total_damage + a-1) // a
        ans += count
        power = a * count
        total_damage += power
        bomb_area.append(pos+2*d)
        bomb_power.append(power)

print(ans)

Measured memory_bytes: 45372
a,b=map(int,input().split())
s=input()
li=[str(i) for i in range(10)]
res="Yes"
if s[a]!="-":
    res="No"
for i in range(0,a):
    if s[i] not in li:
        res="No"
for j in range(a+1,a+b+1):
    if s[j] not in li:
        res="No"
print(res)


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

int main() {
  ll s, j = 1000000000;
  cin >> s;
  if (s == 1000000000000000000ll) {
    cout << "0 0 1000000000 0 0 1000000000" << endl;
    return 0;
  }
  cout << "0 0 1000000000 1 " << j - (s % j) << " " << s / j + 1 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

int main(){
    string s;cin>>s;
    ll cnt[2]={0,0};
    for(int i=0;i<s.size();i++){
      cnt[s[i]-'0']++;
    }
    cout<<min(cnt[0],cnt[1])*2<<endl;
    return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int calc(ll a, ll b){
    return pow(a,4) + pow(a, 3) * b + pow(a,2) * pow(b,2) + pow(b,3) * a + pow(b,4);
}

int main() {
    int X;
    cin >> X;

    for (int i=pow(10,2.9)*-1; i<pow(10,2); i++){
        for (int j=pow(10,2.9)*-1; j<i; j++){
            if (X % calc(i,j) == 0){
                if (pow(i,5)  - pow(j,5) == X){
                    cout << i <<  " " << j << endl;
                    return 0;
                } 
            }
        }
    }

}

Measured memory_bytes: 4040
//Gaurav Singh (saintpopo)
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long int
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fbo find_by_order
#define ook order_of_key
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int N=1e5+5;
const int SZ=105;
const int MOD=1e9+7;

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

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

int32_t main(){
    IOS
    //io_set();
    int i,c=0,ans=0;
    string s;
    cin >> s;
    for( i = 0; i < s.size(); i++){
        if(s[i] == 'A' || s[i] == 'G' || s[i] == 'C' || s[i] == 'T'){
            c++;
            ans = max(ans,c);
        }
        else{
            ans = max(ans,c);
            c = 0;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
	using namespace std;
	#define xxx ios::sync_with_stdio(),cin.tie(0),cout.tie(0)
	#define rep(i,n) for(int i=0;i<n;i++)
	#define int long long
	int bp(int a, int b, int m) {
   		a %= m;
   		int res = 1;
    	while (b > 0) {
        	if (b & 1)
            	res = res * a % m;
       		a = a * a % m;
       	 	b >>= 1;
 	    }
    return res;
	}
	int max(int a, int b){
		return (a>b)?a:b;	
	}
	int csb( int n) 
{ 
    int count = 0; 
    while (n) { 
        count += n & 1; 
        n >>= 1; 
    } 
    return count; 
} 
	int solve(int x){
		int r=0;
		while(x>0){
			int t=csb(x);
			x%=t;
			r++;
		}
		return r;
	}

	signed main(){
		int test=1;
		//cin>>test;
		while(test--){
			int n;
			cin>>n;
			int a[n];
			for(int i=0;i<n;i++){
				cin>>a[i];
			}
			int s=0;
			rep(i,n) {
				for(int j=i+1;j<n;j++){
					s+=a[i]*a[j];
				}
			}
			cout<<s<<endl;
		}
		return 0;
	}

Measured memory_bytes: 3584
// AUTHOR: ROSHAN SRIVASTAVA
// WEBSITE: https://www.youtube.com/channel/UC6uQdd7kLLOdlHSVklhV7Cw

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(), x.end()
#define mod 1000000007

int n; 

int main(){

	ios::sync_with_stdio(false);
	cin.tie(0);

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

	cin >> n;
	for(int i = 0; i < n; i++)
		cout << "ACL";
	cout << endl;
	return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(void){
  string a;
  cin >> a;
  for(int i = 0; i < 3; i++){
    if(a[i]=='1') a[i]='9';
    else if(a[i]=='9') a[i]='1';
  }
  cout<<a<<endl;
  return 0;
}


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    string s;cin >> s;
    int ans = 0;
    inc(i, 1, n-1){
        vector<int> cnt1(26, 0), cnt2(26, 0);
        inc(j, 0, i){
            cnt1[s[j]-'a']++;
        }
        inc(j, i, n){
            cnt2[s[j]-'a']++;
        }
        int cnt = 0;
        inc(j, 0, 26){
            cnt += (cnt1[j] > 0 && cnt2[j] > 0);
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;
int main(){
    int N, ans = 0;
    cin >> N;
    for (int i = 1; i <= N - 1; i++)
    {
        ans += (N - 1) / i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3648
#include <stdio.h>
#define NODE (100)
#define INF (100000000)

int U[NODE];
int dist[NODE];
int prev[NODE];
int V;

void dijkstra(int s, int ord[][NODE])
{
	int i, j;
	int v;
	
	dist[s] = 0;
	prev[s] = 0;
	
	for (i = 0; i < V; i++){
		U[i] = 1;
	}
	
	for (i = 0; i < V; i++){
		v = -1;
		
		for (j = 0; j < V; j++){
			if (U[j] == 1 && (v == -1 || dist[v] > dist[j])){
				v = j;
			}
		}
		
		if (v == -1){
			break;
		}
		
		U[v] = 0;
		
		for (j = 0; j < V; j++){
			if ((dist[j] > dist[v] + ord[v][j]) && U[j] == 1){
				dist[j] = dist[v] + ord[v][j];
				prev[j] = v;
			}
		}
	}
}

int main(void)
{
	int i, j, k;
	int n;
	int from, to, m, mm;
    int cost[NODE][NODE];
    int time[NODE][NODE];
	
	while (1){
		scanf("%d%d", &n, &V);
		
        if (n + V == 0){
			break;
		}
		
		for (i = 0; i < V; i++){
			for (j = 0; j < V; j++){
				cost[i][j] = INF;
                time[i][j] = INF;
			}
			dist[i] = INF;
		}
		
		while (n-- != 0){
			scanf("%d%d%d%d", &from, &to, &m, &mm);
			cost[from - 1][to - 1] = cost[to - 1][from - 1] = m;
            time[from - 1][to - 1] = time[to - 1][from - 1] = mm;
		}
		
		scanf("%d", &k);
		
		for (i = 0; i < k; i++){
			scanf("%d%d%d", &from, &to, &m);
            if (m == 0){
                dijkstra(from - 1, cost);
                printf("%d\n", dist[to - 1]);
            }
            else {
                dijkstra(from - 1, time);
                printf("%d\n", dist[to - 1]);
            }
            for (j = 0; j < V; j++){
                dist[j] = INF;
            }
		}
	}
	return (0);
}

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

int ng() {
    cout << -1 << endl;
    return 0;
}

int solve3(int n) {
    int m = n / 3;
    vector<string> a(n, string(n, '.'));
    for (int i = 0; i < m; i++) {
        a[i*3][i*3] = a[i*3][i*3+1] = 'a';
        a[i*3+1][i*3+2] = a[i*3+2][i*3+2] = 'b';
    }

    for (int i = 0; i < n; i++) {
        cout << a[i] << "\n";
    }
    return 0;
}

int solve5(int n) {
    vector<string> a(n, string(n, '.'));
    int m = n / 5;
    for (int i = 0; i < m; i++) {
        a[i*5][i*5] = a[i*5][i*5+1] = 'a';
        a[i*5][i*5+2] = a[i*5][i*5+3] = 'b';
        a[i*5][i*5+4] = a[i*5+1][i*5+4] = 'c';
        a[i*5+1][i*5] = a[i*5+2][i*5] = 'd';
        a[i*5+3][i*5] = a[i*5+4][i*5] = 'e';
        a[i*5+4][i*5+1] = a[i*5+4][i*5+2] = 'f';
        a[i*5+4][i*5+3] = a[i*5+4][i*5+4] = 'g';
        a[i*5+1][i*5+1] = a[i*5+2][i*5+1] = 'h';
        a[i*5+3][i*5+2] = a[i*5+3][i*5+3] = 'i';
        a[i*5+2][i*5+4] = a[i*5+3][i*5+4] = 'j';
    }

    for (int i = 0; i < n; i++) {
        cout << a[i] << "\n";
    }
    return 0;
}

int solve_even(int n) {
    vector<string> a(n, string(n, '.'));
    int m = n / 2;
    for (int i = 0; i < m; i++) {
        a[i*2][i*2] = a[i*2+1][i*2] = 'a';
        a[i*2][i*2+1] = a[i*2+1][i*2+1] = 'b';
        a[i*2][(i*2+2)%n] = a[i*2][(i*2+3)%n] = 'c';
        a[i*2+1][(i*2+2)%n] = a[i*2+1][(i*2+3)%n] = 'd';
    }
    
    for (int i = 0; i < n; i++) {
        cout << a[i] << "\n";
    }
    return 0;
}

int solve7() {
    cout << "aabbcc.\n";
    cout << "e...ggd\n";
    cout << "ew....d\n";
    cout << "jw....i\n";
    cout << "j..k..i\n";
    cout << ".ook..m\n";
    cout << "..qqrrm\n";
    return 0;
}

int other(int n) {
    if (n == 7) return solve7();
    vector<string> a(n, string(n, '.'));
    int p = n;
    n = p - 5;
    int m = n / 2;
    for (int i = 0; i < m; i++) {
        a[i*2][i*2] = a[i*2+1][i*2] = 'x';
        a[i*2][i*2+1] = a[i*2+1][i*2+1] = 'y';
        a[i*2][(i*2+2)%n] = a[i*2][(i*2+3)%n] = 'z';
        a[i*2+1][(i*2+2)%n] = a[i*2+1][(i*2+3)%n] = 'w';
    }
    for (int i = 0; i < 1; i++) {
        a[n][n] = a[n][n+1] = 'a';
        a[n][n+2] = a[n][n+3] = 'b';
        a[n][n+4] = a[n+1][n+4] = 'c';
        a[n+1][n] = a[n+2][n] = 'd';
        a[n+3][n] = a[n+4][n] = 'e';
        a[n+4][n+1] = a[n+4][n+2] = 'f';
        a[n+4][n+3] = a[n+4][n+4] = 'g';
        a[n+1][n+1] = a[n+2][n+1] = 'h';
        a[n+3][n+2] = a[n+3][n+3] = 'i';
        a[n+2][n+4] = a[n+3][n+4] = 'j';
    }

    for (int i = 0; i < p; i++) {
        cout << a[i] << "\n";
    }
    return 0;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    if (n <= 2) return ng();
    if (n % 2 == 0) return solve_even(n);
    else {
        if (n % 3 == 0) return solve3(n);
        else if (n % 5 == 0) return solve5(n);
        else return other(n);
    }
    return 0;
}

Measured memory_bytes: 2304
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val (a, b) = listOfInt()

    println(when {
        a + b >= 10 -> "error"
        else -> a + b
    })
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 37824
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define rev(i,a,b) for (int i=(a)-1;i>=b;i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef queue<int> qi;
typedef vector<int> vi;
typedef vector<string> vs;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };

int main() {

  int in;
  while(cin >> in) {
    int num = in % 39;
    if (num == 0) num = 39;

    cout << "3C";
    if (num < 10) cout << '0';
    cout << num << endl;
  }
	return 0;
}

Measured memory_bytes: 3000
from sys import stdin
S = (stdin.readline().rstrip())
flag = False
for i in range(0,len(S)+1):
    for j in range(0,len(S)+1):
        if j >= i:
            if S[:i]+S[j:] == "keyence":
                flag = True
if flag:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3060
use io::*;
use std::cmp::{max, min};
use std::collections::BinaryHeap;

fn main() {
    let con = read_string();
    let mut sc = Scanner::new(&con);

    let n: usize = sc.next();
    let m: usize = sc.next();
    let mut s: usize = sc.next();
    let mut t: usize = sc.next();
    s -= 1;
    t -= 1;

    let mut ge: Vec<Vec<(usize, i64)>> = vec![vec![]; n];
    let mut gs: Vec<Vec<(usize, i64)>> = vec![vec![]; n];

    for _ in 0..m {
        let mut u: usize = sc.next();
        let mut v: usize = sc.next();
        let a: i64 = sc.next();
        let b: i64 = sc.next();

        u -= 1;
        v -= 1;

        ge[u].push((v, a));
        ge[v].push((u, a));

        gs[u].push((v, b));
        gs[v].push((u, b));
    }

    let de = dist(&ge, s);
    let ds = dist(&gs, t);

    let mut maxv = 0;
    let mut ans = vec![];

    for i in (0..n).rev() {
        maxv = max(maxv, 1000_000_000_000_000 - de[i] - ds[i]);
        ans.push(maxv);
    }

    for &a in ans.iter().rev() {
        println!("{}", a);
    }
}

fn dist(g: &Vec<Vec<(usize, i64)>>, s: usize) -> Vec<i64> {
    let n = g.len();
    let mut dist = vec![-1; n];

    let mut q = BinaryHeap::<(i64, usize)>::new();
    q.push((0, s));

    while let Some((dep, cur)) = q.pop() {
        let dep = -dep;
        if dist[cur] >= 0 {
            continue;
        }

        dist[cur] = dep;

        for &(next, w) in g[cur].iter() {
            if dist[next] >= 0 {
                continue;
            }
            q.push((-(dep + w), next));
        }
    }

    dist
}

//-----

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

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


Measured memory_bytes: 38644
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define mod 1000000007
#define fixed fixed<<setprecision(10)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
  	int o=1;
  	int x[10],y[10];
  	cin >>n;
  	for(int i=0;i<n;i++){
      cin >>x[i]>>y[i];
    }
  	long double sum=0;
  	for(int i=0;i<n-1;i++){
      for(int j=i+1;j<n;j++){
        int xx=abs(x[i],x[j]),yy=abs(y[i],y[j]);
        xx*=xx;
        yy*=yy;
        long double s=sqrt(xx+yy);
      	sum+=s;
      }
    }
  	sum*=2;
  	sum/=n;
  	cout <<fixed<<sum<<'\n';
    return (0);
}

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

struct qms{
  string name;
  int t;
};

int main(){
  int N,T;
  queue<qms> q;
  int sum = 0;

  cin >> N >> T;
  vector<qms> vq;
  for(int i=0;i<N;++i){
    qms Q;
    cin >> Q.name >> Q.t;
    q.push(Q);
  }
  while(!q.empty()){
    qms cq;
    cq = q.front();
    if(cq.t - T <= 0){
      sum += cq.t;
      cq.t = sum;
      vq.push_back(cq);
      q.pop();
    }else{
      sum += T;
      cq.t -= T;
      q.pop();
      q.push(cq);
    }
  }
  for(int i=0;i<N;++i){
    cout << vq.at(i).name << " " << vq.at(i).t << endl;
  }
}



Measured memory_bytes: 7060
#include<iostream>
using namespace std;
int main(){
  int h,w;
  cin >> h >> w;
  while(h!=0){
    int i,j;
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	cout << "#";
      }
      cout << endl;
    }
    cout << endl;
    cin >> h >> w;
  }
  return 0;
}


Measured memory_bytes: 3092
/* Author : fenwick123 */

#include <bits/stdc++.h>
using namespace std;

int main(){
    int k = -1;
    for (int i = 0; i < 5; i++){
        int t;
        cin >> t;
        if (t == 0){
            cout << i + 1 << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3616
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  std::string S;

  std::cin >> S;

  std::set<char> set(ALL(S));

  std::cout << (set.size() > 1 ? "Yes" : "No") << std::endl;

  return 0;
}


Measured memory_bytes: 256
using System;
class Program
 {
   	static void Main(string[] args)
        {
    　　string a = Console.ReadLine(); //標準入力
		string[] aa = a.Split(' ');
		
	       	int A = int.Parse(aa[0]);
       		int B = int.Parse(aa[1]);
			int H = int.Parse(aa[2]);
       		int M = int.Parse(aa[3]);
			double tH = (double)((double)H*360/12 + 30 * (double)M /60);
      		double tM = (double)(360 * (double)M /60);
      
      		double theta = Math.PI * Math.Abs(tH-tM)/180;
      
     		double length = Math.Sqrt(A*A+B*B-2*A*B*Math.Cos(theta));
    
     		Console.WriteLine("{0}", length);
    }
 }

Measured memory_bytes: 27956
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    int n,ans=0,l,r;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>l>>r;
        ans+=r-l+1;
    }
    cout<<ans<<endl;
    return(0);
}

Measured memory_bytes: 3580
// ---------- begin snipet ----------
pub trait MoOperator {
    type Answer;
    fn size(&self) -> usize;
    fn insert(&mut self, x: usize);
    fn delete(&mut self, x: usize);
    fn answer(&self) -> Self::Answer;
}

pub struct MoSolver<S> {
    query: Vec<(usize, usize)>,
    phantom: std::marker::PhantomData<S>,
}

impl<State: MoOperator> MoSolver<State> {
    fn new() -> Self {
        MoSolver {
            query: vec![],
            phantom: std::marker::PhantomData,
        }
    }
    fn add(&mut self, l: usize, r: usize) {
        self.query.push((l, r));
    }
    fn solve_with_size(&mut self, state: &mut State, answer: &mut [State::Answer], batch: usize) {
        let size = state.size();
        let mut q = vec![vec![]; size / batch + 1];
        for (k, &(l, r)) in self.query.iter().enumerate() {
            q[l / batch].push((r, l, k));
        }
        let mut x = 0;
        let mut y = 0;
        for (i, mut q) in q.into_iter().enumerate() {
            q.sort_unstable_by_key(|p| p.0);
            if i % 2 == 1 {
                q.reverse();
            }
            for (r, l, k) in q {
                while l < x {
                    x -= 1;
                    state.insert(x);
                }
                while y < r {
                    state.insert(y);
                    y += 1;
                }
                while x < l {
                    state.delete(x);
                    x += 1;
                }
                while r < y {
                    y -= 1;
                    state.delete(y);
                }
                answer[k] = state.answer();
            }
        }
    }
}
// ---------- end Mo algorithm ----------

struct State {
    c: Vec<usize>,
    cnt: Vec<u32>,
    ans: u32,
}

impl MoOperator for State {
    type Answer = u32;
    fn size(&self) -> usize {
        self.c.len()
    }
    fn insert(&mut self, x: usize) {
        let c = &mut self.cnt[self.c[x]];
        if *c == 0 {
            self.ans += 1;
        }
        *c += 1;
    }
    fn delete(&mut self, x: usize) {
        let c = &mut self.cnt[self.c[x]];
        if *c == 1 {
            self.ans -= 1;
        }
        *c -= 1;
    }
    fn answer(&self) -> Self::Answer {
        self.ans
    }
}

fn solve(c: &[usize], ask: &[(usize, usize)]) -> Vec<u32> {
    let mut solver = MoSolver::new();
    for &(l, r) in ask {
        solver.add(l, r);
    }
    let mut state = State {
        c: c.iter().cloned().collect(),
        cnt: vec![0; c.len()],
        ans: 0,
    };
    let mut ans = vec![0; ask.len()];
    let batch = (c.len() as f64 / (ask.len() as f64).sqrt()).ceil() as usize;
    solver.solve_with_size(&mut state, &mut ans, batch);
    ans
}

use proconio::*;
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
        n: usize,
        q: usize,
        c: [Usize1; n],
        ask: [(Usize1, usize); q],
    }
    let ans = solve(&c, &ask);
    for a in ans {
        println!("{}", a);
    }
}


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

int main(void){
    ll x; cin >> x;
    ll a = 0;
    ll b = 0;
    while( x>= 500) {
        x -= 500;
        a+= 1000;
    }
    while( x>= 5) {
        x -= 5;
        b+=5;
    }
    cout << a+b << endl;
    
    return 0;
}


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

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1000000000;
const ll LINF = (ll) 4000000000000000000;
const ll MOD = (ll) 1000000007;
const double PI = acos(1.0);
const int limit = 100010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define NP(v) next_permutation(v.begin(),v.end())
#define smaller_queue  priority_queue <ll, vector<ll>, greater<ll> >
//------------------------------------------------------
const ll MAX_C = 55;
ll c[MAX_C][MAX_C];

void comb() {
    rep(i, MAX_C) rep(j, MAX_C) c[i][j] = 0;
    c[1][0] = c[1][1] = 1;

    rep(i, MAX_C - 1) rep(j, MAX_C - 1) {
        c[i + 1][j] += c[i][j];
        c[i + 1][j + 1] += c[i][j];
    }
}

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ld v[n];
    rep(i, n) cin >> v[i];
    sort(v, v + n);
    reverse(v, v + n);
    ld sum = 0;

    rep(i, a) sum += v[i];
    cout << setprecision(20) << sum / (ld) a << endl;

    comb();
    ll ans = 0;

    if (v[0] == v[a - 1]) {
        ll cnt = 0;
        rep(i, n) if (v[i] == v[0]) cnt++;

        REP(i, a, b + 1) {
            ans += c[cnt][i];
        }
    } else {
        ll cnt = 0;
        ll first_pos = -1;
        rep(i, n) if (v[i] == v[a - 1]) {
            cnt++;
            if (first_pos == -1) first_pos = i;
        }
        ans = c[cnt][a - first_pos];
    }

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



Measured memory_bytes: 256
n = int(input())
monsters = list(map(int,input().split()))
savers = list(map(int,input().split()))

fii = []
fij = []

fii += [min(monsters[0], savers[0])]
fij += [min(monsters[1], savers[0]-fii[-1])]
for i in range(1,n):
    fii += [min(monsters[i]-fij[-1], savers[i])]
    fij += [min(monsters[i+1], savers[i]-fii[-1])]
print(sum(fii)+sum(fij))

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

int main()
{
  int n,a[100];
  int max=0;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(i!=n){
      swap(a[0],a[i]);
    }
  }
  
  for(int m=1;m<n;m++){
    for(int j=m+1;j<n;j++){
      swap(a[j],a[m]);
    }
  }
  
  for(int k=0;k<n;k++){
    cout << a[k];
    if (k<n-1){
      cout << " ";
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<set>
 
#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.begin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define Brep(n) for(int bit = 0; bit < (1<<n); bit++)
#define rep2nd(n,m) Srep(n) Lrep(j,0,m)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vector<int>>
#define vvi64 vector<vector<int64_t>>
#define P pair<int,int>
#define F first
#define S second
 
using namespace std;

int main(){
  int input;
  set<int> st;
  Srep(3){
    cin >> input;
    st.insert(input);
  }
  cout << st.size() << endl;
}


Measured memory_bytes: 3600
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
    string s;
    cin >> s;
    
    rep(i,0,s.size()){
        if(s[i] <= 'C'){
            cout << (char)('X'+(s[i]-'A'));
        }
        else{
            cout << (char)(s[i]-3);
        }
    }
    cout << endl;
    return 0;
}



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

using namespace std;
int main(){
  int r, d, xi, ans, i;
  cin >> r >> d >> xi;
  ans = xi;
  for(i = 0;i < 10;i++){
    ans = ans * r - d;
    cout << ans << endl;
    

  }

  return 0;
}

Measured memory_bytes: 256
n = int(raw_input())
p = [int(x) for x in raw_input().split(" ")]

a = [i*n for i in range(1,n+1)]
b = [i*n for i in reversed(range(1,n+1))]

d = 1
for i in p:
    a[i-1] += d
    b[i-1] += d
    d += 1

print " ".join([str(n) for n in a])
print " ".join([str(n) for n in b])


Measured memory_bytes: 6612
#include <iostream>
#include <cmath>
#include <bits/stdc++.h>
#include <string>

using namespace std;

// 配列Aにcinする
int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int ans = 0;
  for (int i = 0; i <= N; i++) {
    string stringN = to_string(i);
    int sum = 0;
    for(int j = 0; j < (int)stringN.size(); j++) {
      sum += int(stringN[j]) - 48;
    }
    if (sum >= A && sum <= B) {
      ans += i;
    }
  }
  cout << ans << endl;

  return 0;
}

// 標準入出力
//int main() {
//	int a, b;
//	cin >> a >> b;
//  if (a * b % 2 == 0) {
//	  cout << "Even" << endl;
//  } else {
//	  cout << "Odd" << endl;
//  }
//  return 0;
//}

// 文字列を1文字ずつループ
//int main() {
//  string str;
//  cin >> str;
//  int sum = 0;
//  for(int i = 0; i < (int)str.size(); ++i){
//    char ch = str[i];
//
//    if (ch == '1') {
//      sum++;
//    }
//  }
//  cout << sum << endl;
//  return 0;
//}



Measured memory_bytes: 256
/*
ID: 18126251
LANG: C++
TASK: 
*/
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <time.h>
#include <queue>

using namespace std;

const int maxn = 1005;
const int d[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};

int w, h, n;
int x1[maxn], x2[maxn], y1[maxn], y2[maxn];
int vis[maxn*3][maxn*3];

int comp(int *x1, int *x2, int w){
	std::vector<int> v;
	for(int i = 0; i < n; i++){
		for(int j = -1; j <= 1; j++){
			if(0 <= x1[i]+j && x1[i] + j < w) v.push_back(x1[i]+j);
			if(0 <= x2[i] + j && x2[i] + j < w) v.push_back(x2[i]+j);
		}
	}
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	for(int i = 0; i < n; i++){
		x1[i] = find(v.begin(), v.end(), x1[i]) - v.begin();
		x2[i] = find(v.begin(), v.end(), x2[i]) - v.begin();
	}
	return v.size();
}

void bfs(int y, int x){
	queue<pair<int, int> >q;
	q.push(make_pair(y, x));
	vis[y][x] = 1;
	while(!q.empty()){
		int sy = q.front().first, sx = q.front().second;
		q.pop();
		for(int i = 0; i < 4; i++){
			int tx = sx + d[i][0], ty = sy + d[i][1];
			if(0 <= tx && tx < w && 0 <= ty && ty < h && !vis[ty][tx]){
				vis[ty][tx] = 1;
				q.push(make_pair(ty, tx));
			}
		}
	}
}



int main(int argc, char const *argv[])
{
#ifndef ONLINE_JUDGE
	// freopen("in.txt", "r", stdin);
#endif
	// clock_t start = clock();
	ios::sync_with_stdio(false);
	cin.tie(0);
	while(cin >> w >> h && w){
		cin >> n;
		for(int i = 0; i < n; i++){
			cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
		}

		w = comp(x1, x2, w); 
		h = comp(y1, y2, h);

		for(int y = 0; y < h; y++){
			for(int x = 0; x < h; x++){
				vis[y][x] = 0;
			}
		}
		for(int i = 0; i < n; i++){
			for(int y = y1[i]; y < y2[i]; y++){
				for(int x = x1[i]; x < x2[i]; x++){
					vis[y][x] = 1;
				}
			}
		}


		int ans = 0;
		for(int y = 0; y < h; y++){
			for(int x = 0; x < w; x++){
				if(!vis[y][x]){
					ans++;
					bfs(y, x);
				}
			}
		}
		cout << ans << endl;
	}

	// clock_t ends = clock();
    // cout <<"Running Time : "<<(double)(ends - start)/ CLOCKS_PER_SEC << endl;
	return 0;
}


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

#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPR(i, a, b) for (int i = (a); i >= (b); i--)
#define ALL(container) (container).begin(), (container).end()

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;

const int INF = 1e9;

int main() {
  int N, Q;
  string S;
  cin >> N >> Q >> S;

  vector<int> count(N);
  count[0] = 0;
  REP(i, 1, N) {
    count[i] = count[i-1];
    if (S[i-1] == 'A' && S[i] == 'C') {
      count[i]++;
    }
  }

  int l, r;
  REP(i, 0, Q) {
    cin >> l >> r;
    cout << count[r-1] - count[l-1] << endl;
  }

  return 0;
}


Measured memory_bytes: 1408
n, m = map(int, input().split())
s_c = tuple(set(tuple(map(int, input().split())) for _ in range(m)))

ans = 0
for sc in s_c:
    if sc[0] == 1 and sc[1] == 0 and n != 1:
        print('-1')
        exit()
    
    for s in s_c:
        if s[0] == sc[0] and s[1] != sc[1]:
            print('-1')
            exit()
    
    ans += pow(10, (n - sc[0])) * sc[1]

if ans < pow(10, n - 1) and n != 1:
    ans += pow(10, n - 1)
print(ans)

Measured memory_bytes: 3064
#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 main(){
  ll D, T, S;
  cin >> D >> T >> S;

  if(S*T >= D) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 3648