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

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		double C=Math.toRadians(c);
		double S=0.5*a*b*Math.sin(C);
		double L=a+b+Math.sqrt(a*a+b*b-2*a*b*Math.cos(C));
		double h=b*Math.sin(C);
		System.out.printf("%.8f\n", S);
		System.out.printf("%.8f\n", L);
		System.out.printf("%.8f\n", h);
	}
}

Measured memory_bytes: 26352
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = (a), i_len = (b); i < i_len; ++i)

int main()
{
    ll N;
    cin >> N;
    ll a = 0, b = 0;
    for(ll i = 1; i * i <= N; ++i) if(N%i == 0LL) a = i, b = N/i;
    cout << (a-1) + (b-1) << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define llp 1000000007
#define mod 1000000007

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;


int32_t main(){
	ios::sync_with_stdio(false);

    int H,W;
    cin>>H>>W;
    int h,w;
    cin>>h>>w;
    int ans=H*W-h*W-w*H+w*h;
    cout<<ans<<"\n";


	return 0;
}

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

using namespace std;

int main()
{
    int n;
    cin >> n;
    int cnt = 0;
    for(int i = 1; i <= n; i ++)
    {
        int x = i, r = 0;
        while(x) { x /= 10, r ++; }
        if(r % 2) cnt ++;
    }
    cout << cnt <<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#define lp(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int n,a,b;
	string row,com;
	cin>>row>>n;
	lp(i,n){
		cin>>com>>a>>b;
		if(com=="replace"){
			string in;
			cin>>in;
			int k=0;
			for(int i=a;i<=b;i++){
				row[i]=in[k];
				k++;
			}
		}
		else if(com=="reverse"){
			int i=a,j=b;
			while(i<j){
				swap(row[i],row[j]);
				i++;
				j--;
			}
		}
		else {
			for(int i=a;i<=b;i++){
				cout<<row[i];
			}
			cout<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3196
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

const int MOD = 1000000007;

long long solve(const vector<int>& a)
{
    int n = a.size();
    vector<int> b(n);
    b[0] = a[0];
    for(int i=1; i<n; ++i)
        b[i] = a[i] ^ b[i-1];

    long long ans = 1;
    if(b.back() == 0){
        for(int i=0; i<n-1; ++i){
            if(b[i] == 0){
                ans *= 2;
                ans %= MOD;
            }
        }
    }

    int cnt = 0;
    map<long long, long long> dp1, dp2, prev;
    for(int i=0; i<n; ++i){
        if(b[i] == 0){
            ++ cnt;
        }
        else{
            dp1[b[i]] += dp2[b[i]] * (cnt - prev[b[i]]);
            dp1[b[i]] %= MOD;
            prev[b[i]] = cnt;
            dp2[b[i]] += dp1[b[i]] + 1;
            dp2[b[i]] %= MOD;
        }
    }
    if(b.back() == 0){
        for(const auto& p : dp2){
            ans += p.second;
            ans %= MOD;
        }
    }
    else{
        ans += dp1[b.back()];
        ans %= MOD;
    }
    return ans;
}

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

    cout << solve(a) << endl;

    return 0;
}


Measured memory_bytes: 57984
#include <cstdio>

int n, c1, c2, c4;

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        static int t;
        scanf("%d", &t);
        if (t % 4 == 0)
            c4++;
        else if (t % 2 == 0)
            c2++;
        else
            c1++;
    }

    if (c2 ? (c1 - c4 <= 0) : (c1 - c4 <= 1))
        puts("Yes");
    else
        puts("No");

    return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <tr1/unordered_map>
using namespace std;
#define ll long long
#define re register
#define pb push_back
#define fi first
#define se second
const int N=1e7+10;
const int M=1e7;
const int mod7=1e9+7;
const int mod=1e9+7;
void read(int &a)
{
    a=0;int d=1;char ch;
    while(ch=getchar(),ch>'9'||ch<'0')
        if(ch=='-')
            d=-1;
    a=ch^48;
    while(ch=getchar(),ch>='0'&&ch<='9')
        a=(a<<3)+(a<<1)+(ch^48);
    a*=d;
}
void read(ll &a)
{
    a=0;int d=1;char ch;
    while(ch=getchar(),ch>'9'||ch<'0')
        if(ch=='-')
            d=-1;
    a=ch^48;
    while(ch=getchar(),ch>='0'&&ch<='9')
        a=(a<<3)+(a<<1)+(ch^48);
    a*=d;
}
int gcd(int a,int b) {return !b?a:gcd(b,a%b);}
int main()
{
    int n;read(n);
    ll ans=0;
    for(re int i=1;i<=n;i++)
    {
        for(re int j=1;j<=n;j++)
        {
            for(re int k=1;k<=n;k++)
            {
                ans+=gcd(i,gcd(j,k));
            }
        }
    }
    printf("%lld\n",ans);
    return 0;
}

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

int main(void){
  ll k; cin >> k;
  queue<ll> x;
  for(int i = 1; i <= 9; i++){
    x.push(i);
  }
  for(int i = 0; i < k-1; i++){
    ll y = x.front();
    x.pop();
    ll z = y % 10;
    if(z != 0) x.push(y*10+z-1);
    x.push(y*10 + z);
    if(z != 9) x.push(y*10 + z + 1);
  }
  cout << x.front() << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

int main()
{
    std::cin.tie(0);
    std::ios_base::sync_with_stdio(false);
    long long a, b, c, k;
    std::cin >> a >> b >> c >> k;
    long long sign = (k % 2 == 0) ? 1 : -1;
    long long ans = (a - b) * sign;
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 632
def average(points):
    sum = 0
    for i in points:
        sum += i
    return sum / len(points)

outputs = []

while True:
    num = int(input())
    if num == 0:
        break

    points = []
    for _ in range(num):
        point = int(input())
        points.append(point)

    points = sorted(points)
    points = points[1:len(points)-1]

    ave = average(points)
    outputs.append(int(ave))

for ave in outputs:
    print(ave)

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

using namespace std;

int d[100005];

int main(){
	int N;
	scanf("%d", &N);
	assert(N%2 == 0);
	
	for(int i = 0; i < N; i ++){
		scanf("%d", &d[i]);
	}
	sort(d, d+N);
	printf("%d", d[N/2] - d[(N-2)/2]);
}


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

bool check_palindromic_number(int n) {
		string s = to_string(n);
		bool is_palindromic_number = true;

		for(int i=0; i<(s.size()/2); i++) {
			if (s[i] != s[(s.size()-1)-i]) {
					is_palindromic_number = false;
					break;
			}
		}

		return is_palindromic_number;
}

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

		int n_palindromic_number = 0;

		for(int number=A; number<=B; number++) {
			if (check_palindromic_number(number)) {
					n_palindromic_number++;
			}
		}

		cout << n_palindromic_number << endl;
		return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Node{
  int key;
  struct Node *r, *l, *p;
};
void insert(int f);
void inorder(struct Node *v);
void preorder(struct Node *w);
struct Node *root, *NIL;

int main(){
  char C[10];
  int n, i, a;
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%s", C);
    if(strcmp(C, "insert") == 0){
      scanf("%d", &a);
      insert(a);
    }
    else if (strcmp(C, "print") == 0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
  }

void insert(int f){
  struct Node *x = root;
  struct Node *y = NIL;
  struct Node *z;
  z = ((struct Node *)malloc(sizeof(struct Node)));
  z->key = f;
  z->l = NIL;
  z->r = NIL;
  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->l;
    }
    else {
      x = x->r;
    }
  }
  z->p = y;
  if(y == NIL){
    root = z;
  }
  else {
    if(z->key < y->key){
      y->l = z;
    } else {
      y->r = z;
    }
  }
}

void inorder(struct Node *v){
  if(v == NIL) return;
  inorder(v->l);
  printf(" %d", v->key);
  inorder(v->r);
  }

  void preorder(struct Node *w){
    if(w == NIL) return;
    printf(" %d", w->key);
    preorder(w->l);
    preorder(w->r);
}



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

typedef long long ll;
typedef long double ld;
using namespace std;

const int MOD = 1e9 + 7;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int h, w;
  cin >> h >> w;
  char grid[h][w];
  char newgrid[h][w];
  for(int i = 0; i < h; i++)
  {
    for(int j = 0; j < w; j++)
    {
      cin >> grid[i][j];
    }
  }
  for(int i = 0; i < h; i++)
  {
    int j = 0;
    while(j < w)
    {
      if(grid[i][j] == '#')
      {
        break;
      }
      j++;
    }
    if(j == w)
    {
      for(int k = 0; k < w; k++)
      {
        newgrid[i][k] = 'x';
      }
    }
  }
  for(int i = 0; i < w; i++)
  {
    int j = 0;
    while(j < h)
    {
      if(grid[j][i] == '#')
      {
        break;
      }
      j++;
    }
    if(j == h)
    {
      for(int k = 0; k < h; k++)
      {
        newgrid[k][i] = 'x';
      }
    }
  }
  for(int i = 0; i < h; i++)
  {
    bool flag = 0;
    for(int j = 0; j < w; j++)
    {
      if(newgrid[i][j] != 'x')
      {
        flag = 1;
        cout << grid[i][j];
      }
    }
    if(flag)
    {
      cout << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int n, a, b;
	cin >> n >> a >> b;
	if ((b - a) % 2 == 1) cout << "Borys\n";
	else cout << "Alice\n";

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    string ans;
    ll base = 1;
    while (n) {
        if (n % (base * 2) == 0) ans += '0';
        else {
            ans += '1';
            n -= base;
        }
        base *= -2;
    }
    reverse(ans.begin(), ans.end());
    if (ans == "") ans += '0';
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    vector<int> c(5);
    for (int i = 0; i < 3; i++)
    {
        int a, b;
        cin >> a >> b;
        c[a]++;
        c[b]++;
    }
    int k = 0, t = 0;
    for (int i = 1; i <= 4; i++)
    {
        if (c[i] == 1) k++;
        if (c[i] == 2) t++;
    }
    if (k == 2 && t == 2) cout << "YES";
    else cout << "NO";
}


Measured memory_bytes: 256
package main

import "fmt"

type Pair struct{
    fst int
    snd int
}

func main() {
    var s string
    ans := Pair{-1, -1}

    fmt.Scan(&s)
    for i:=0; i<len(s)-2; i++ {
        if s[i] == s[i+1]  || s[i+1] == s[i+2] || s[i] == s[i+2] {
            ans = Pair{i+1, i+3}
            break
        }
    }

    if len(s) == 2 && s[0] == s[1] {
        ans = Pair{1, 2}
    }

    fmt.Println(ans.fst, ans.snd)
}

Measured memory_bytes: 1280
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			int k = sc.nextInt();
			while (k > 0) {
				if (a < b && c > b) {
					break;
				}
				if (a >= b) {
					b *= 2;
					k--;
				}
				if (b >= c) {
					c *= 2;
					k--;
				}
			}
			if (a < b && c > b && k >= 0) {
				System.out.print("Yes");
			} else {
				System.out.print("No");
			}
		}
	}
}

Measured memory_bytes: 35624
#include <vector>
#include <iostream>
#include <climits>
#include <functional>

template <typename T, typename F>
struct SegmentTree{
private:
  // using F = std::function<T(T,T)>;
  int n;
  F f;
  T ti;
  std::vector<T> dat;
public:
  SegmentTree(){};
  SegmentTree(F f,T ti) : f(f),ti(ti) {}
  void build(int n_){
    n = n_;
    dat.assign(2*n,ti);
  }
  void build(const std::vector<T> &v){
    int n_ = v.size();
    build(n_);
    for(int i = 0; i < n; ++i) dat[n+i]=v[i];
    for(int i = n-1; i >= 0; --i)
      dat[i]=f(dat[2*i+0],dat[2*i+1]);
  }
  void set_val(int k,T x){
    dat[k+=n] = x;
    while(k > 0){
      k = k/2;
      dat[k]=f(dat[2*k+0],dat[2*k+1]);
    }
  }
  T query(int a,int b){
    if(a == b) return ti;
    T vl = ti, vr = ti;
    for(int l = a+n, r = b+n; l < r; l >>= 1, r >>= 1){
      if(l&1) vl = f(vl,dat[l++]);
      if(r&1) vr = f(dat[--r],vr);
    }
    return f(vl,vr);
  }
};

#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;

int main(){
  int H, W, M;
  cin >> H >> W >> M;
  map<pair<int,int>,int> cnt;
  map<int,vector<int>> X;
  map<int,int> Y;
  vector<int> XX, YY;
  for(int i = 0; i < M; ++i){
    int x, y;
    cin >> x >> y;
    XX.emplace_back(x);
    YY.emplace_back(y);
    ++cnt[{x,y}];
    X[x].emplace_back(y);
    ++Y[y];
  }
  sort(XX.begin(), XX.end());
  XX.erase(unique(XX.begin(), XX.end()),XX.end());
  sort(YY.begin(), YY.end());
  YY.erase(unique(YY.begin(), YY.end()),YY.end());
  int ans = 0;
  SegmentTree rmq([](int a, int b){ return max(a,b); }, 0);
  int m = Y.size();
  vector<int> ini(m);
  for(int i = 0; i < m; ++i){
    ini[i] = Y[YY[i]];
    Y[YY[i]] = i;
  }
  rmq.build(ini);
  for(auto x : XX){
    for(auto y : X[x]){
      int i = Y[y];
      int v = rmq.query(i,i+1);
      rmq.set_val(i,v-1);
    }
    int s = X[x].size();
    ans = max(ans,rmq.query(0,m)+s);
    for(auto y : X[x]){
      int i = Y[y];
      int v = rmq.query(i,i+1);
      rmq.set_val(i,v+1);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 74604
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int lli;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef pair <lli,lli> pii;
#define ff first
#define ss second
#define mod 1000000007
#define pb push_back
#define EPS 1e-6
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
long long const INF = 1e18 + 42;

 
int main(){
	fast;
	lli n;
	cin>>n;
	vector<lli> v(n);
	map<lli,lli> mp;
	for(int i=0; i<n ;i++){
	    cin>>v[i];
	    mp[v[i]]++;
	}
	lli ans=0;
	for(auto i: mp){
	    ans+= (i.ss)*(i.ss-1)/2;
	}
	for(int i=0; i<n; i++){
	    lli sum=ans;
	    lli r=mp[v[i]];
	    cout<<(ans-(r)*(r-1)/2+ (r-1)*(r-2)/2)<<"\n";
	}
	return 0;
}

Measured memory_bytes: 11136
#include<stdio.h>
int main(void) {
	char n[10];
	int i;
	int count[10];
	
	scanf("%s", &n);
	for (i = 0; i < 10; i++) {
		count[i] = 0;
	}
	int j=0;
		#include<stdio.h>

	
	for (i = 0; n[i] != '\0'; i++) {
		if (n[i] == 'A' || n[i] == 'C' || n[i] == 'G' || n[i] == 'T') {
			count[j]++;
		}
		else {
			j++;
		}
	}
	int max;
	max = count[0];
	for (i = 1; i < 10; i++) {
		if (max < count[i]) {
			max = count[i];
		}
	}
	printf("%d\n", max);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
struct node
{
    int x,y;
};
stack<node> d;
#define mo 1500
int a[mo][mo];
int main()
{
    int n,m;
    while(cin>>n>>m)
    {
        int x;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                cin>>x;
                if(!x)
                    a[i][j]+=a[i-1][j]+1;

            }
        }

        /*
        cout<<endl;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                cout<<a[i][j]<<' ';
            }
            cout<<endl;
        }
        */


        node t;
        int maxs=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m+1;j++)
            {
                t.x=a[i][j];
                t.y=j;

                if(d.size()==0||t.x>d.top().x) d.push(t);
                else if(t.x<d.top().x)
                {
                    int l=j;
                    while(d.size()&&d.top().x>t.x)
                    {
                        maxs=max(maxs,(l-d.top().y)*d.top().x);
                        t.y=d.top().y;
                        d.pop();
                    }
                    if(j<=m)d.push(t);
                }
            }

        }
        cout<<maxs<<endl;
    }

}



Measured memory_bytes: 10216
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a;double b;cin>>a>>b;
  ll c=floor(100*b+0.1);
  print(a*c/100);
  return 0;
}

Measured memory_bytes: 3808
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <bitset>

using namespace std;
const int MAX = 1000010;
//bool isPrime[MAX] = {0};
bitset<MAX> isPrime;

void sieve(){
    bitset<MAX> find;
    int i;
    for(i=2;i*i < MAX;i++){
        if(find[i]) continue;
        isPrime.set(i);
        for(int j=i;j<MAX;j++){
            if(j%i == 0){
                find.set(j);
            }
        }
    }
    for(;i<MAX;i++){
        if(!find[i]) {
            //isPrime[i] = true;
            isPrime.set(i);
        }
    }
}

int main(){
    sieve();

    while(true){
        int n,x;
        cin >> n >> x;
        if(n==0 && x==0) return 0;
        vector<int> R(n);
        for(int i=0;i<n;i++){
            cin >> R[i];
        }

        bitset<MAX> S;
        S.set(0);
        //set<int> S;
        //S.insert(0);
        for(int i=0;i<R.size();i++){
            //    for(set<int>::iterator it=S.begin();it!=S.end();++it){
            for(int j=0;j<=x;j++){
                if(!S[j]) continue;
                //int newe = *it + R[i];
                int newe = j + R[i];
                if(newe > x) continue;
                //S.insert(newe);
                if(S[j]){
                    S.set(newe);
                }
            }
        }
        int maxn = -1;
        /*
        for(set<int>::iterator it=S.begin();it!=S.end();++it){
            if(isPrime[*it] && *it > maxn) maxn = *it;
        }
        */
        for(int i=0;i<=x;i++){
            if(isPrime[i] && S[i]) maxn = i;
        }
        if(maxn == -1) cout << "NA" << endl;
        else cout << maxn << endl;
    }
    return 0;
}

Measured memory_bytes: 1556
package main
import "fmt"
func main() {
  var a,b,c,d int
  fmt.Scanf("%d",&d)
  a = d / 1000
  d -= a * 1000
  b = d / 100
  d -= b * 100
  c = d / 10
  d -= c * 10
  switch 7-a {
    case  b+c+d : fmt.Printf("%d+%d+%d+%d=7\n",a,b,c,d)
    case -b+c+d : fmt.Printf("%d-%d+%d+%d=7\n",a,b,c,d)
    case  b-c+d : fmt.Printf("%d+%d-%d+%d=7\n",a,b,c,d)
    case  b+c-d : fmt.Printf("%d+%d+%d-%d=7\n",a,b,c,d)
    case -b-c+d : fmt.Printf("%d-%d-%d+%d=7\n",a,b,c,d)
    case  b-c-d : fmt.Printf("%d+%d-%d-%d=7\n",a,b,c,d)
    case -b+c-d : fmt.Printf("%d-%d+%d-%d=7\n",a,b,c,d)
    case -b-c-d : fmt.Printf("%d-%d-%d-%d=7\n",a,b,c,d)
  }
}

Measured memory_bytes: 512
/************************************************************LET US BREAK BAD!****************************************************************/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define pb push_back
#define pll pair<ll, ll> 
#define vi vector<int>
#define vl vector<ll> 
#define vvl vector< vector<ll> > 
#define vvi vector< vector<int> >
#define vlp vector< pair<ll, ll> >
#define vllp vector<pair<ll, ll>, ll > 
#define mll map<ll, ll> 
#define rep(i,a)  for(ll i=0; i< a; i++)
#define rep1(i,a)   for(ll i = 1; i< a; i++)
#define foi(i, a, b)    for(ll i = a; i<b ; i++)
#define fod(i, a, b)    for(ll i = a; i>=b ; i--)
#define mp make_pair
#define fst first
#define sec second
#define ff first.first
#define fs first.second
#define pi pair<int, int>
#define ppi pair<pair<int, int>, int>
#define max3(a, b, c)   max(max(a, b), c)
#define min3(a, b, c)   min(min(a, b), c)
#define MAX 1000001
#define MOD 1000000007
// #define MOD 998244353
#define endl "\n"
#define INF (ll)1e18
#define s(v) v.size()
#define e(v) v.empty()
#define bscount(x) __builtin_popcountll(x)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

ll gcd(ll a, ll b){if(b==0)return a;return gcd(b, a%b);}
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
ll fexp(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%MOD; b/=2;a=a*a%MOD;}return ans;}
ll inverse(ll a, ll p){return fexp(a, p-2);} 
void ingraph(vvl& graph, ll m){ll x, y;rep(i, m){cin>>x>>y;x--, y--;graph[x].pb(y);graph[y].pb(x);}}
ll modify(ll n){ll res = n;res%=MOD;res+=MOD;res%=MOD;return res;}

int main(){
	//#ifndef ONLINE_JUDGE
	//    freopen("../input.txt", "r", stdin);
	//    freopen("../output.txt", "w", stdout);
	//#endif
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	ll t;
	//cin>>t;
	t = 1;
	while(t--){
		ll n;
		cin>>n;
		n<30?cout<<"No":cout<<"Yes";
		cout<<endl;    
	}
return 0;
}


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

def main():
    N, C, K = map(int, input().split())
    times = sorted([int(input()) for _ in range(N)])
    passengers = []
    ans = 0
    while True:
        if len(times) == 0:
            if len(passengers) > 0:
                ans += 1
            break
        elif len(passengers) == 0:
            passengers.append(times.pop(0))
        elif times[0] - passengers[0] <= K:
            passengers.append(times.pop(0))
        elif times[0] - passengers[0] > K:
            ans += 1
            passengers = []

        if len(passengers) == C:
            ans += 1
            passengers = []
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 8280
#include <stdio.h>
#include <string.h>
  
#define Length 1000
 
int LSCLength(char *X, char *Y){
  
    int i, j, m, n;
    int c[Length+1][Length+1];
  
    m = strlen(X+1);
    n = strlen(Y+1);
    
    for(i = 1; i <= m; i++){
        c[i][0] = 0;
    }
  
    for(j = 0; j <= n; j++){
        c[0][j] = 0;
    }
  
    for(i = 1; i <= m; i++){
        for(j = 1; j <= n; j++){
            if(X[i] == Y[j]){
                c[i][j] = c[i-1][j-1] + 1;
            }
            else if(c[i-1][j] >= c[i][j-1] ){
                c[i][j] = c[i-1][j];
            }
            else{
                c[i][j] = c[i][j-1];
            }
        
        }
    }
    
    return c[m][n];
}
 
int main(){
  
   int i, n, match;
    char X[Length];
    char Y[Length];
    
    scanf("%d",&n);
  
    for(i = 0; i < n; i++){
        scanf("%s %s", X+1, Y+1);
        
        match = LSCLength(X ,Y);
        printf("%d\n",match);
    }
  
    return 0;
}

Measured memory_bytes: 4520
N = int(input())
a = list(map(int,input().split()))
dp = [[-1,-1,-1,1] for _ in range(N+1)]
for i in range(N):
    check = dp[i][:3]
    pattern = check.count(a[i]-1)
    dp[i+1][3] *= dp[i][3]*pattern
    dp[i+1][3] = dp[i+1][3]%1000000007
    for k in range(3):
        dp[i+1][k]= dp[i][k]
    if dp[i][0]== a[i]-1:
        dp[i+1][0] = a[i]
    elif dp[i][1] ==a[i]-1:
        dp[i+1][1] = a[i]
    elif dp[i][2] ==a[i]-1:
        dp[i+1][2] = a[i]
print(dp[N][3])

Measured memory_bytes: 100280
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <unordered_map>
// #include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x)  if(DEBUG_Switch) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
ll poww(ll a, ll b) { if (a == 0ll) {return 0ll;} ll ans = 1; while (b) {if (b & 1) {ans = ans * a ;} a = a * a ; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
void pvarr_int(int *arr, int n, int strat = 1) {if (strat == 0) {n--;} repd(i, strat, n) {printf("%d%c", arr[i], i == n ? '\n' : ' ');}}
void pvarr_LL(ll *arr, int n, int strat = 1) {if (strat == 0) {n--;} repd(i, strat, n) {printf("%lld%c", arr[i], i == n ? '\n' : ' ');}}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
#define DEBUG_Switch 0
int main()
{
#if DEBUG_Switch
    freopen("C:\\code\\input.txt", "r", stdin);
#endif
    //freopen("C:\\code\\output.txt","r",stdin);
    int a = readint();
    int r = readint();
    printf("%d\n", a * r );
    return 0;
}




Measured memory_bytes: 3768
using System;
class Program
 {
        static void Main(string[] args)
        {
    　　int count = 0;
            string S = Console.ReadLine();//2つ以上のスペース区切り入力の取得
            string T = Console.ReadLine();//2つ以上のスペース区切り入力の取得
          for(int i = 0;i < T.Length ; i++){
            if(S[i] == T[i]){
              count++;
            }
          }
       Console.Write(count);
        }
 }

Measured memory_bytes: 13140
#include <iostream>
 #include <math.h>
using namespace std;

int main() {
	// your code goes here
double x1,x2,y1,y2,xq,yq,r,xs,ys;
char s;
while(cin>>x1>>s>>y1>>s>>x2>>s>>y2>>s>>xq>>s>>yq){
	double xm,ym;
r=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));

	xs=xq-x1;
	ys=yq-y1;
	double n=(xs*(x2-x1)+ys*(y2-y1))/r;
	xm=x1+n*(x2-x1)/r;
	ym=y1+n*(y2-y1)/r;

	double ya,xa;
	xa=2*xm-xq;
	ya=2*ym-yq;
	printf("%.6f %.6f\n",xa,ya);
}
	return 0;
}

Measured memory_bytes: 1232
import java.io.*;
import java.util.*;

public class Main {
  private static int solve(String s) {
    return s.lastIndexOf("Z") - s.indexOf("A") + 1;
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    out.println(solve(reader.next()));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 27092
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")

#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007;

int main(){
  int a,b; cin >> a >> b;
  if(a < 10 && b < 10){
    cout << a*b << "\n";
  }else{
    cout << -1 << "\n";
  }
}


Measured memory_bytes: 256
// lcm、__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで
#include <bits/stdc++.h>
#define ll long long
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    ll i,j,k,l,m,n,maxi=0,f=0,mini=1e10,sum=0;
    string str;
    ll cnt=0;
    ll a,b;
    cin>>a>>b;
    if(a*b%2){
        sum++;
    }
    if(a==1||b==1){
        cout<<1<<endl;
        return 0;
    }
    cout<<a*b/2+sum;
    return 0;
}

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

int main() {
  ll N;
  cin >> N;
  vector<ll> a(N);
  ll sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    sum += a[i];
  }
  ll num = 0, sub = 2000000001;
  for (int i = 0; i < N; i++) {
    num += a[i];
    if (abs(sum - 2*num) < sub) sub = abs(sum - 2*num);
    if (i == N-2) break;
  }
  cout << sub << endl;
}


Measured memory_bytes: 4824
#include <bits/stdc++.h>
#include <cctype>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, std::greater<>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
typedef long long int64;
typedef unsigned long long uint64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//*/998244353;
const int base = 2187;
const double eps = 1e-9;
const int N = 300'000;
const int LOGN = 19;

int n, m, k;

void solve(int) {
  cin >> m >> n;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    m -= x;
  }
  if (m <= 0) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}

void precalc() {
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i) {
    solve(i);
  }
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
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;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

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

Measured memory_bytes: 3644
#pragma GCC optimize("O3")
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000


int main() {
	int c[N];
	f(i, N)c[i] = 0;
	int x;
	int n;
	f(i, 100) {
		f(j, 100) {
			f(ii, 100) {
				x = 0;
				x += ((i + 1)*(i + 1));
				x += ((j + 1)*(j + 1));
				x += ((ii + 1)*(ii + 1));
				x += ((i + 1)*(j + 1));
				x += ((j + 1)*(ii + 1));
				x += ((ii + 1)*(i + 1));
				c[x]++;
			}
		}
	}
	scanf("%d", &n);
	f(i,n)printf("%d\n", c[i+1]);

	return 0;
}

Measured memory_bytes: 2508
n,m=map(int,input().split())
ab=[]
for i in range(n):
    a,b=map(int,input().split())
    ab.append((a,b))
    
cd=[]
for i in range(m):
    a,b=map(int,input().split())
    cd.append((a,b))

for _ in range(n):
    ans=9e9
    ret=0
    a=ab[_][0]
    b=ab[_][1]
    for i,j in enumerate(cd):
        c=j[0]
        d=j[1]
        man=abs(a-c)+abs(b-d)
        if man<ans:
            ans=man
            ret=i+1
    print(ret)

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for (int i=0; i<n; i++)
        cin >> h[i];

    sort(h.begin(), h.end());
    long long ret = 0;
    for (int i=0; i<n-k; i++)
        ret += h[i];

    cout << ret << "\n";

    return 0;
}


Measured memory_bytes: 3996
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
#define mp make_pair
#define pb push_back
using namespace std;
typedef pair <string, string> pss;

int n;
string s;

map <pss, int> cnt;
void calc_cnt()
{
    for(int i = 0; i < (1 << n); i++)
    {
        string s1, s2;
        s1 = s2 = "";

        for(int j = 0; j < n; j++)
        {
            int ind = n + j;
            if(i & (1 << j))
                s1.pb(s[ind]);
            else
                s2.pb(s[ind]);
        }

        cnt[mp(s1, s2)]++;
    }
}

long long ans;

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

    cin >> n;
    cin >> s;

    calc_cnt();

    for(int i = 0; i < (1 << n); i++)
    {
        string s1, s2;
        s1 = s2 = "";

        for(int j = 0; j < n; j++)
        {
            int ind = j;
            if(i & (1 << j))
                s1.pb(s[ind]);
            else
                s2.pb(s[ind]);
        }

        reverse(s1.begin(), s1.end());
        reverse(s2.begin(), s2.end());
        ans += cnt[mp(s1, s2)];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 87040
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

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

typedef pair<int, int> P;
#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define mod 1000000007LL
#define INF 12345678901234567

const int maxn = 1e5 + 10;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	// your code is here

	string s1, s2, s3; cin >> s1 >> s2 >> s3;
	cout << (char)(s1[0] - 'a' + 'A')  << (char)(s2[0] - 'a' + 'A')  << (char)(s3[0] - 'a' + 'A') << endl;
	return 0;

}

Measured memory_bytes: 256
#AGC044D
import sys
import math

def ds(n,b):
 s=0
 while n>0:
  s+=n%b
  n/=b
 return s
 
n=int(raw_input())
s=int(raw_input())
if n<s:
 print -1
 sys,exit()
if n==s:
 print n+1
 sys.exit()

i=2
while i*i<=n:
 if ds(n,i)==s:
  print i
  sys,exit()
 i+=1
 
i=int(math.sqrt(n))
while i>0:
 b=(n-s)/i+1
 if b>1 and b>s-i and b>i:
  if ds(n,b)==s:
   print b
   sys,exit()
 i-=1  
print -1


Measured memory_bytes: 2820
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n; ll m;
  cin >> n >> m;
  vector<ll> a(n);
  rep(i,0,n) cin >> a[i];
  map<ll,ll> p;
  ll k = 0, ans = 0;
  p[0]++;
  rep(i,0,n) {
    k += a[i];
    k %= m;
    ans += p[k];
    p[k]++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7796
#!/usr/bin/env python3
#CODE FESTIVAL 2016 qual B C
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def root(x):
    if par[x] == x:
        return x
    par[x] = root(par[x])
    return par[x]

def union(x,y):
    x = root(x)
    y = root(y)
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1
w,h = LI()
p = [I() for _ in range(w)]
q = [I() for _ in range(h)]
hq = []
for i in p:
    heappush(hq,(i,0))
for i in q:
    heappush(hq,(i,1))
ans = 0
w += 1
h += 1
while hq:
    v,flg = heappop(hq)
    if flg:
        ans += v*w
        h -= 1
    else:
        ans += v*h
        w -= 1
print(ans)

Measured memory_bytes: 72412
import java.util.*;
import static java.lang.System.*;

public class Main {

	Scanner sc = new Scanner(in);
	
	void run() {
		int n;
		int a[];
		int ans;
		while (true) {
			n = sc.nextInt();
			if (n == 0) break;
			a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = sc.nextInt();
			Arrays.sort(a);
			ans = 0;
			for (int i = 1; i < n-1; i++) {
				ans += a[i];
			}
			System.out.println(ans/(n-2));
		}
		
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 20948
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;
typedef long long ll;

int main() {
	int N, M;
	cin >> N;
	vector<string> blue(N);
	for (int i = 0; i < N; i++) cin >> blue.at(i);
	cin >> M;
	vector<string> red(M);
	for (int i = 0; i < M; i++) cin >> red.at(i);
	int ans = 0;
	for (int i = 0; i < N; i++) {
		string s = blue.at(i);
		int cnt = 0;
		for (int j = 0; j < N; j++) {
			if (s == blue.at(j))cnt++;
		}
		for (int j = 0; j < M; j++) {
			if (s == red.at(j)) cnt--;
		}
		ans = max(ans, cnt);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3604
N,M = map(int,input().split())
if N>=M:
  print(0)
  exit()
X = list(map(int,input().split()))
X.sort()
diffX = []
for i in range(len(X)-1):
  diffX.append(X[i+1]-X[i])
diffX.sort()
totalWidth = X[len(X)-1]-X[0] 
for i in range(N-1):
  totalWidth -= diffX[len(X)-2-i]
print(totalWidth)
  

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

int main(int argc, char** argv){
  long long N;
  long long fee[5];
  cin >> N;
  for(int cnt0 = 0; cnt0 < 5; cnt0++) cin >> fee[cnt0];
  
  long long minFee = 1e15;
  for(int cnt0 = 0; cnt0 < 5; cnt0++) minFee = min(minFee, fee[cnt0]);
  
  long long addTime = 0;
  if(N > minFee){
    if(N % minFee == 0){
      addTime = N/minFee -1 ;
    }else{
      addTime = N/minFee;
    }
  }
    
  cout << 5 + addTime << endl;
  
  return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  int x;cin>>x;

  if(x<1200)out("ABC")
  else out("ARC")

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
const int mod = 1e9 + 7;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
int main(){
    int n; cin >> n;
    int tmp = n% 10;
    if(tmp == 3)cout << "bon" << endl;
    else if(tmp == 0 || tmp == 1 || tmp == 6 || tmp == 8)cout << "pon" << endl;
    else cout << "hon" << endl;
    return 0;
}  

Measured memory_bytes: 3632
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<bitset>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<deque>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

int main() {

    int n, p;
    while(cin >> n >> p && (n || p)) {
        int stones[n];
        int bowl = p;
        int now = 0;
        REP(i, n)   stones[i] = 0;
        
        while(true) {
            if (bowl > 1) {
                bowl -= 1;
                stones[now] += 1;
            } else if (bowl == 1) {
                bowl = 0;
                stones[now] += 1;
                if (stones[now] == p) break;
            } else {
                bowl = stones[now];
                stones[now] = 0;
            }
            now += 1;
            if(now == n)    now = 0;
        }
        cout << now << endl;
    }
     
    return 0;
}

Measured memory_bytes: 868