akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
typedef long long ll;
using namespace std;

int main(void){
  int a;
  string s;
  cin>>a>>s;
  if(a>=3200)cout<<s<<endl;
  else cout<<"red"<<endl;
	return 0;
}

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

using namespace std;

int main(void) {
    long n, m;
    cin >> n >> m;

    vector<vector<long>> G(n);
    for(long i=0; i<m; i++) {
        long a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    long r = 0;
    {
        auto dfs = [&](auto dfs, long cur, long mask) -> void {
            if(mask == (1l<<n)-1) r++;

            for(auto v: G[cur]) {
                if((mask >> v)&1) continue;
                dfs(dfs, v, mask | (1l<<v));
            }
        };

        dfs(dfs, 0, 1);
    }
    cout << r << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <list>
#include <map>
using namespace std;

int dx[4] = {0,-1,1,0};
int dy[4] = {-1,0,0,1};
int state[51][51];
int H, W;
int cost;
void solve(int x, int y){
  state[x][y] = 0;
  ++cost;
  for(int k = 0; k < 4;k++){
    int nx = x+dx[k];
    int ny = y+dy[k];
    if(nx < 0 || ny < 0 || nx >= W || ny >= H)continue;
    if(state[nx][ny] != 1)continue;
    solve(nx, ny);
  }
}
int main(void){
  cin >> H >> W;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
        char c;
        cin >> c;
        if(c == '#'){
          state[j][i] = 1;
        }else{
          state[j][i] = 0;
        }
    }
  }
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(state[j][i] == 1){
        cost = 0;
        solve(j,i);
        if(cost == 1){
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }
  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long int
#define pb                      push_back
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
//#define mp                      make_pair
#define vpll                    vector<pair<ll,ll>>
#define sll                     set<ll>
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define umcl                    um<char,ll>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define test                    ll Testcases;cin>>Testcases;while(Testcases--)
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

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

int main()
{
	fastIO
	//inp_out();
	ll a,b;
	cin>>a>>b;
	
	if((a==1)||(b==1))
	{
		cout<<1;
	}
	else
	cout<<(a*b+1)/2;

	return 0;
}



Measured memory_bytes: 256
import collections

n=int(input())
a=list(map(int,input().split()))
a=collections.Counter(a)
ans=0
#print(a)

for i in a:
    if i<a[i]:
        ans+=a[i]-i
    elif i>a[i]:
        ans+=a[i]

print(ans)
   
    

Measured memory_bytes: 18672
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}

int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
ll _pfact(ll a);
static ll pf[100000000];
static ll pc;

ll _pfact(ll a) {
	long i, r;
	if (a % 2 == 0) {
		pf[pc] = 2; pc++;
		return(_pfact(a / 2));
	}
	r = sqrt(a);
	for (i = 3; i <= r; i += 2) {
		if (a % i == 0) {
			pf[pc] = i; pc++;
			return(_pfact(a / i));
		}
	}
	if (a != 1) {
		pf[pc] = a; pc++;
	}
	return 0;

}


#pragma endregion

//ABC  -B Half and Half

int main(void) {
	int     a, b,c, x, y;

	scanf("%d %d %d %d %d", &a,&b,&c,&x,&y);

	long cx = 2 * c * x,
	   	cy = 2 * c * y,
		ab = a * x + b * y;

    if (a * x > cx && b * y > cy) {
		printf("%ld\n",2 * (long)c * (long)((x < y) ? y : x));
		return 0;
	}

	long ac = 2 * c * x + b * ((y - x < 0) ? 0 : y - x);
	long bc = 2  *c * y +  a* ((x - y < 0) ? 0 : x - y);
	//printf("%ld %ld %ld", ab,ac, bc);
	long    ans;

	ans = _min(ab, _min(ac, bc));

	printf("\n%ld\n", ans);
	return 0;
}


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

int color[101010], sz[101010];
vector<int> f[101010], b[101010];

void dfs(int x){
    sz[x] = 1;
    for(auto to : f[x]){
        if(color[to] != -1)continue;
        color[to] = color[x];
        dfs(to);
        sz[x] += sz[to];
    }
}


int main(){
    int n, m, k;
    cin >> n >> m >> k;
    for(int i=0;i<m;i++){
        int x, y;
        cin >> x >> y;
        --x; --y;
        f[x].push_back(y);
        f[y].push_back(x);
    }
    for(int i=0;i<k;i++){
        int x, y;
        cin >> x >> y;
        --x; --y;
        b[x].push_back(y);
        b[y].push_back(x);
    }

    for(int i=0;i<n;i++)color[i] = -1;

    for(int i=0;i<n;i++){
        if(color[i] != -1)continue;
        color[i] = i;
        dfs(i);
    }
    vector<int> ans(n);
    for(int i=0;i<n;i++){
        ans[i] = sz[color[i]] - 1;
        for(auto to : f[i]){
            if(color[i] == color[to])--ans[i];
        }
        for(auto to : b[i]){
            if(color[i] == color[to])--ans[i];
        }
    }
    for(int i=0;i<n;i++){
        cout<<ans[i]<<" \n"[i+1==n];
    }
    return 0;
}

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

int main() {
  int N, sum;
  cin >> N;
  sum = 0;
    
  for (int i=0; i<N; i++){
    int l, r;
    cin >> l >> r;
    sum += (r-l+1);
  }
  
  cout << sum << endl;
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long 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; }

int main(){
    int n; cin >> n;
    string s; cin >> s;
    
    int ans = 0, tmp = 0;
    for(int i=0; i<n; i++){
        if(s[i] == 'I'){
            tmp++;
            ans = max(ans, tmp);
        }   
        else{
            tmp--;
        }
     
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<ll(n);i++)
long long gcd(long long a, long long b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}
int main() {
    ll n;
    cin >> n;
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            for (int k = 1; k <= n; k++) {
                ans += gcd(i, gcd(j, k));
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
#include<stdio.h>
#include<stdlib.h>

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

int compare_int(const void *a,const void *b){
	return *(long long*)a-*(long long*)b;
}

int main(){
	int n,j;
	long long a[520]={0},k,i;
	scanf("%d%lld",&n,&k);
	for(i=0;i<n;i++)scanf("%lld",&a[i+1]);n++;
	qsort(a,n,sizeof(long long),compare_int);
	long long sum=0;
	for(i=0;i<n;i++)sum+=a[i];
	if(sum<=k){
		printf("%lld\n",sum);
		return 0;
	}
	long long yak[5000]={1},c=1;
	for(i=2;i*i<=sum;i++){
		if(sum%i==0)yak[c++]=i;
	}
	for(i=0;i<c;i++)yak[c+i]=sum/yak[i];
	if(yak[c-1]*yak[c-1]==sum)c=2*c-1;
	else c=2*c;
	long long ans=1;
	for(i=1;i<c;i++){
		long long y=yak[i],tmp=0,tmm=0,tmh=0,tmhm=0;
		long long pa[520];
		for(j=0;j<n;j++){
			pa[j]=a[j]%y;
			if(pa[j]>y-pa[j])pa[j]=y-pa[j];
			else pa[j]= -pa[j];
			if(pa[j]<0){
				tmhm-=pa[j];
			}
			else {
				tmh+=pa[j];
			}
		}
		qsort(pa,n,sizeof(long long),compare_int);
		while(tmh>tmhm){
			for(j=n-1;j>=0;j--){
				tmhm+=(y-pa[j]);
				tmh-=(pa[j]);
				if(tmh==tmhm)break;
			}
		}while(tmh<tmhm){
			for(j=0;j<n;j++){
				tmh+=(y+pa[j]);
				tmhm+=(pa[j]);
				if(tmh==tmhm)break;
			}
		}
		if(tmh<=k)ans=max(ans,y);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

vector<ll>E[101010];
vector<ll>num(101010,-inf);
vector<ll>ans(101010);
vector<pair<ll, ll>>rec(101010);
vector<ll>parity(101010, 2);

void err() {
	puts("No");
	exit(0);
}
void dfs(ll now,ll p){
	ll ma = inf;
	ll mi = -inf;
	set<ll>st;
	fore(x, E[now]) {
		if (x != p) {
			dfs(x,now);
			st.insert(parity[x]);
			ma = min(ma, rec[x].second + 1);
			mi = max(mi, rec[x].first - 1);
		}
	}
	if (st.count(0) && st.count(1))err();
	if (mi > ma)err();
	if (parity[now] == 2) {
		if (st.count(0))parity[now] = 1;
		else if (st.count(1))parity[now] = 0;
		rec[now].first = mi;
		rec[now].second = ma;
	}
	else {
		if ((st.count(1) && parity[now] == 1) || (st.count(0) && parity[now] == 0))err();
		if (ma < num[now] || num[now] < mi)err();
		rec[now].first = num[now];
		rec[now].second = num[now];
	}
}

void dfsr(ll now,ll p){
	ll ma = ans[now] + 1;
	ll mi = ans[now] - 1;
	fore(x, E[now]) {
		if (x != p) {
			if ((rec[x].first <= mi) && (mi <= rec[x].second))ans[x] = mi;
			else ans[x] = ma;
			dfsr(x, now);
		}
	}
}

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

	int N;
	cin >> N;
	for (int i = 0; i < N-1; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		E[a].pb(b);
		E[b].pb(a);
	}
	int K;
	cin >> K;
	for (int i = 0; i < K; i++) {
		int v, p;
		cin >> v >> p;
		v--;
		num[v] = p;
		parity[v] = p % 2;
	}


	dfs(0,-1);
	ans[0] = rec[0].first;
	dfsr(0,-1);
	puts("Yes");
	for (int i = 0; i < N; i++)puts(ans[i]);


	return 0;
}


Measured memory_bytes: 25984
N = int(input())
Xi = list(map(int, input().split()))
Si = sorted(Xi)

idx = N // 2
center1 = Si[idx - 1] #N>=2なのでoutofboundsにはならない
center2 = Si[idx]

for x in Xi:
    if x == center1 and x == center2:
        print(x)
    elif x <= center1:
        print(center2)
    else:
        print(center1)



Measured memory_bytes: 25556
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	ll a, b;
	cin >> a >> b;
	cout << (a + b) % 24 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 3

int pane[MAX][MAX];
int temp[MAX][MAX];
int d_x[4]={0,1,0,-1};
int d_y[4]={1,0,-1,0};

void empty(int *row,int *col){
  int i,j;
  for(i=0;i<MAX;i++)
    for(j=0;j<MAX;j++)
      if(!pane[i][j]){
	*row=j;
	*col=i;
	return;
      }  
}
   
void swap(int *a,int *b){
  int temp;
  temp = *a;*a = *b;*b = temp;
}
  
int cal(){
  int i,e;
  int count=0; 
  for(i=0;i<9;i++){
    e=pane[i/3][i%3];
    if(e){
      e--;
      count+=abs(i/3-e/3)+abs(i%3-e%3);
    }
  }   
  return count;
}
  
int dfs(int x,int y,int p,int deep,const int limt){
  int i;
  int len;
  int x_2,y_2;
  int emc;   
  len=cal();
  if(len==0) return deep;
  if(deep+len>limt) return -1; 
  for(i=0;i<4;i++){
    x_2=x+d_x[i];
    y_2=y+d_y[i];      
    if(~p&&i==(p+2)%4) continue;
    if(!(0<=x_2 && x_2<3 && 0<=y_2 && y_2<3)) continue;    
    swap(&pane[y][x],&pane[y_2][x_2]);
    emc=dfs(x_2,y_2,i,deep+1,limt);
    if(~emc) return emc;       
    swap(&pane[y][x],&pane[y_2][x_2]);
  }   
  return -1;
} 

int main() {
  int i,j;
  int h,a,row,col;
      
  for(i=0;i<MAX;i++){
    for(j=0;j<MAX;j++)
      scanf("%d",&pane[i][j]);
  }  
  empty(&row,&col);  
  for(h=0;h<100;h++){
    for(i=0;i<MAX;i++){
      for(j=0;j<MAX;j++)
	temp[i][j]=pane[i][j];
    }    
    a=dfs(row,col,-1,0,h);    
    if(a!=-1){
      printf("%d\n",a);
      break;
    }    
    for(i=0;i<MAX;i++){
      for(j=0;j<MAX;j++)
	pane[i][j]=temp[i][j];
    }    
    a=-1;
    if(h==99) printf("%d\n\n",a);
  }      
  return 0;
}



Measured memory_bytes: 2112
#include <cstdio>
#include <cmath>

#include <iostream>
#include <string>

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define inc( i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec( i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

template<typename T> void swap(T & x, T & y) { T t = x; x = y; y = t; return; }
template<typename T> T abs(T x) { return (0 <= x ? x : -x); }
template<typename T> T max(T a, T b) { return (b <= a ? a : b); }
template<typename T> T min(T a, T b) { return (a <= b ? a : b); }
template<typename T> bool setmin(T & a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T & a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

std::string s;

int main() {
	std::cin >> s;
	
	bool ans = ((s[0] == s[s.size() - 1]) == (s.size() % 2 == 0));
	
	printf("%s\n", ans ? "First" : "Second");
	
	return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>

int main()
{
	long ret;
	long i;
	long X;
	long depo = 100;
	ret = scanf("%ld", &X);

	for (i = 1;; i++) {
		/* rishi */
		depo += depo/100*1;
		if (depo >= X)
			break;
	}
	printf("%ld\n",i);
	fflush(stdout);
	return EXIT_SUCCESS;
}


Measured memory_bytes: 1736
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
    int N,K;
    int ans = 1;
    cin >> N >> K;
    rep(i,N) ans = min(ans*2,ans+K);
    pr(ans);
}

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

typedef long long ll;
typedef pair<int, int> P;

const int INF = 1000000007;

int main(void){
	string S; cin>>S;

	bool can = false;
	int a[4]={0};
	for(int i=0;i<S.size();i++) {
		if(S[i] == 'N') a[0] = 1;
		if(S[i] == 'W') a[1] = 1;
		if(S[i] == 'S') a[2] = 1;
		if(S[i] == 'E') a[3] = 1;
	}

	if(a[0] == a[2] && a[1] == a[3]) can = true;

	if(can) printf("Yes\n");
	else printf("No\n");

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
typedef long long int ll;      
int main()
{   
	ll n,d,x,sum=0;
	cin>>n>>d;
	std::vector<std::vector<ll> > a(n);
	for (int i = 0; i < n; ++i)
	{
		for (int j=0;j<d; ++j)
		{
			cin>>x;
			a[i].push_back(x);
		}
	}
	for (int i = 0; i < n; ++i)
	{
		for (int j=i+1;j<n; ++j)
		{
			double f=0;
			for (int k=0;k<d; ++k)
			{
				f+=pow(a[i][k]-a[j][k],2);
			}
			double p=sqrt(f);
			ll z=p;
			if(z==p)
				sum++;

		}
	}
	cout<<sum<<"\n";
}

Measured memory_bytes: 256
A=int(input())
B=int(input())
C=int(input())
D=int(input())

# 小さいものを出す時
print(min(A,B)+min(C,D))


# if A+C>B+D:
# 	print(B+D)
# elif A+C<B+D:
# 	print(A+C)
# elif A+D<B+C:
# 	print(A+D)
# elif A+D>B+C:
# 	print(B+C)
# 	

Measured memory_bytes: 9088
#include<stdio.h>
#include<iostream>
#include<string>
#include<complex>
#include<algorithm>

bool check()
{
	char s[16];
	int count{};
	scanf("%s", s);
	if (s[0] != 'A') return false;
	for (int i = 2; s[i+1] != '\0'; ++i)
	{
		if (s[i] == 'C') count++;
	}
	if (count != 1) return false;
	count = 0;
	for (int i = 0; s[i] != '\0'; ++i)
	{
		if (s[i] >= 'A' && s[i] <= 'Z') count++;
		if (count > 2) return false;
	}
	return true;
}

int main()
{
	if (check())
		printf("AC\n");
	else
		printf("WA\n");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    long sum=0;
    vector<long> v(n),c(n);
    for(int i=0;i<n;i++)cin >> v.at(i);
    for(int i=0;i<n;i++)cin >> c.at(i);
    for(int j=0;j<n;j++){
        long abs=v.at(j)-c.at(j);
        if(abs>0)sum+=abs;
    }
    cout << sum << endl;
    return 0;
    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String d = scanner.nextLine();
		int sum = 0;
		while (true) {
			String a = scanner.nextLine();
			if (a.equals("END_OF_TEXT"))
				break;
			for (String s : a.split(" ")) {
				if (s.equalsIgnoreCase(d))
					sum++;
			}
		}
		System.out.println(sum);

	}
}

Measured memory_bytes: 17168
#ifndef CLion
//#pragma GCC optimize ("O3")
#endif

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>

#define F first
#define S second
#define pb push_back
#define ll long long
#define all(x) x.begin() , x.end()
#define rep(i,s,e) for (int i = s; i < e; ++i)
#define rev(i,s,e) for (int i = s; i > e; --i)
#define mem(a,v) memset(a , v , sizeof a)
//#define mod(x,m) ((x%m + m)%m)
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
        tree_order_statistics_node_update>;

const int N = 2e5 + 99 , mod = 1e9 + 7;


void Main(int cse , bool last){
    bool x; cin >> x;
    cout << !x;
}

int main(){

#ifndef CLion
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif
#ifdef CLion
    freopen( "in.txt" , "r" , stdin  );
//    freopen( "out.txt", "w" , stdout );
    clock_t st = clock();
#endif

    int t = 1;
//    cin >> t;
    for ( int cse = 1; cse <= t; ++cse ) Main(cse, cse == t);

#ifdef CLion
    clock_t en = clock();
    cout << "\n\nTime: " << fixed << (en - st - 0.0) / CLOCKS_PER_SEC;
#endif
    return 0;
}

Measured memory_bytes: 3604
/******************************************
* AUTHOR : AAYUSH GARG*
* NICK : aayushgarg_03 *
* INSTITUTION : BIT MESRA *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define mod 1000000007
#define dd double
#define ld long double
#define f(i,a,b) for(ll i=a; i<b; i++)
#define vec vector<ll>
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define VP vector< pii >
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
#define ascii(c) (int)char (c)
#define all(v) (v).begin(),(v).end()
#define Sort(v) sort(v.begin(), v.end(), sortbysec)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define addmod(a,b,mod) (a%mod + b%mod)%mod
#define submod(a,b,mod) (a%mod - b%mod + mod)%mod
#define N 1000000
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define max4(a,b,c,d) max(a,max3(b,c,d))
#define min4(a,b,c,d) min(a,min3(b,c,d))

ll prime[N];

ll mulmod(ll a, ll b, ll m) 
{ 
    ll res = 0;  
    a = a % m; 
    while (b > 0) 
    { 
        if (b % 2 == 1) 
            res = (res + a) % m; 

        a = (a * 2) % m; 
        b /= 2; 
    } 
  
    return res % m; 
} 

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;     
  
    x = x % p;  
  
    while (y > 0) 
    {    
      if (y & 1) 
            res = (res*x) % p; 
    
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
}

void sieve() {
    for(ll i = 0;i < N;i++)
        prime[i] = 1;
    prime[0] = 0;
    prime[1] = 0;
    for(ll i = 2;i*i < N;i++) {
        if(prime[i] == 0)
            continue;
        for(ll j = i*i;j < N;j+=i) {
            prime[j] = 0;
        }
    }
    for(ll i = 1;i < N;i++)
        prime[i] += prime[i-1];
}



bool sortbysec(const pair<ll,ll> &a, const pair<ll,ll> &b) 
{ 
    return (a.second < b.second); 
} 

/*vec v;
void divisors(ll n)
{
    
for(ll i=1;i<=sqrt(n);i++)
{
    if(n%i==0)
    {
        if(i==n/i)
        v.pb(i);
        else
        {
            v.pb(i);
            v.pb(n/i);
        }
        
    }
}

sort(all(v));
}*/




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

//ll t; cin>>t; while(t--){}
ll h,w;
cin>>h>>w;

ll a[h+3][w+3],dp[h+3][w+3];

MEM(a,-1);
MEM(dp,0);

char c;

f(i,1,h+1)
{
    f(j,1,w+1)
    {
        cin>>c;
        if(c == '.')
        a[i][j]=1;
    }
}

dp[1][1] = 1;

f(i,1,h+1)
{
    f(j,1,w+1)
    {
        
        if(a[i][j]==1){
        dp[i+1][j] = (dp[i+1][j]%mod + dp[i][j]%mod)%mod;
        dp[i][j+1] = (dp[i][j+1]%mod + dp[i][j]%mod)%mod;
        }
    }
}



cout<<dp[h][w]<<endl;


return 0;
}


Measured memory_bytes: 16000
from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1

INF = 1e10
maze = []

dh = [-1,0,1,0]
dw = [0,1,0,-1]

for i in range(H):
    tmp = list(input())
    maze.append(tmp)

reached = [[INF]*W for _ in range(H)]

l = deque()
l.appendleft((Ch, Cw))
reached[Ch][Cw] = 0
while l:
    h, w = l.popleft()
    d = reached[h][w]
    for i in range(4):
        nh = h + dh[i]
        nw = w + dw[i]
        if not (0 <= nh <= H-1 and 0 <= nw <= W-1):
            continue
        if not maze[nh][nw] != "#":
            continue
        if not reached[nh][nw] > d:
            continue
        reached[nh][nw] = d
        l.appendleft((nh, nw))
    for i in range(-2, 3):
        for j in range(-2, 3):
            nh = h + i
            nw = w + j
            if not (0 <= nh <= H-1 and 0 <= nw <= W-1):
                continue
            if not maze[nh][nw] != "#":
                continue
            if not reached[nh][nw] > d + 1:
                continue
            reached[nh][nw] = d + 1
            l.append((nh, nw))

ans = reached[Dh][Dw]
if ans != INF:
    print(ans)
else:
    print(-1)

    

Measured memory_bytes: 137740
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	long long int H;
	long long int count = 0;
	long long int ans = 0;
	cin >> H;
	while ( H != 0 ) {
		count++;
		ans = ans + pow(2,count);
		H = H / 2;
	}
	cout << ans / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int n; cin >> n;
    priority_queue<int, vector<int>, greater<int>> num;
    int ans = 0;
    REP(i, n){
        int tmp; cin >> tmp;
        num.push(tmp);
        if(tmp == num.top()) ans++;
    }
    cout << ans << endl;


}

Measured memory_bytes: 1400
open System

[<EntryPoint>]
let main _ =
    let [| a; b; c; |] = stdin.ReadLine().Split() |> Array.map int
    let isOdd n = n % 2 = 1
    let isEven n = n % 2 = 0
    let rec simulate n (a, b, c) =
        if isOdd a || isOdd b || isOdd c then
            n
        else
            simulate (n + 1) ((b + c) / 2, (a + b) / 2, (c + a) / 2)
    if a = b && b = c && isEven a && isEven b && isEven c then
        stdout.WriteLine -1
    else
        (a, b, c) |> simulate 0 |> stdout.WriteLine
    0


Measured memory_bytes: 11220
n = int(input())
a = list(map(int, input().split()))

ans = a[0]

if 0 in a:
    print(0)
else:
    for i in range(1,n):
        ans = ans * a[i]
        if ans > 10 ** 18:
            break  
    if ans > 10 ** 18:
        print(-1)
    else:
        print(ans)  

Measured memory_bytes: 21568
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

struct P {
  double x,y,z;
};

double dis2(P a, P b) {
  return (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) + (a.z-b.z)*(a.z-b.z);
}

int main() {
  int n;
  while(cin>>n,n) {
    P p[n];
    REP(i,n) {
      double x,y,z;
      cin >>x>>y>>z;
      p[i] = (P){x,y,z};
    }
    P now = (P){50,50,50};
    double move = 0.5;
    double ans;
    while(move > 1e-9) {
//      printf("(%f,%f,%f)\n", now.x,now.y,now.z);
      REP(i,100) {
        int k;
        double ma = 0;
        REP(j,n) {
          double d = dis2(now, p[j]);
          if (ma < d) {
            ma = d;
            k = j;
          }
        }
        now.x += (p[k].x-now.x)*move;
        now.y += (p[k].y-now.y)*move;
        now.z += (p[k].z-now.z)*move;
        ans = ma;
      }
      move /= 2;
    }
    printf("%.5f\n", sqrt(ans));
  }
}

Measured memory_bytes: 0
import math

N = int(input())
li = list(map(int, input().split()))

lis = []
for index, i in enumerate(li):
  lis.append(i - (index + 1))

lis.sort()
x = lis[math.floor(N/2)]

ans = 0
for i in lis:
  ans += max(x - i, -x + i)

print(ans)

Measured memory_bytes: 26832
#include <stdio.h>
#include <stdlib.h>
    
   int main(void){
       int a;
       scanf("%d",&a);
       if(a==7){
           printf("YES");
       }else if(a==5){
           printf("YES");
       }else if(a==3){
           printf("YES");
       }else{
           printf("NO");
       }
       
   }

Measured memory_bytes: 128
#include <cstdio>

using namespace std;

int main()
{
	int pt[10];
	int sum = 0;
	
	for (int i = 0; i < 10; i++){
		scanf("%d", &pt[i]);
		sum += pt[i];
	}
	
	printf("%d\n", sum);
	
	return (0);
}

Measured memory_bytes: 1028
#include <stdio.h>
int main(void){
	long long a,b;
	scanf("%lld %lld",&a,&b);
	long long temp_a,temp_b,c=1,GCD;
	if(a<=b){
		temp_a=b;
		temp_b=a;
	}
	else{
		temp_a=a;
		temp_b=b;
	}
	while(1){
		c=temp_a%temp_b;
		if(c==0){ 
			temp_a=temp_b;
			break;
		}
		temp_a=temp_b;
		temp_b=c;
	}
	GCD=temp_a;
	printf("%lld\n",GCD);
	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#define debug(x) cerr << #x << ':' << x << endl
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<int> A(n+2,0);
    A[0]=0;
    REP(i,n) cin >> A[i+1];
    A[n+1]=0;
    // REP(i,n+2) cout << A[i] <<" ";
    // cout << endl;
    // 0 3 5  -1 0 
    //  3 2 -6  1
    vector<int> cost(n+1,0);
    REP(i,n+1) cost[i]=A[i+1]-A[i];
    // REP(i,cost.size()) cout << cost[i] <<" ";
    // cout << endl;

    int total=0;
    REP(i,cost.size())
        total+=abs(cost[i]);

    REP(i,n){
        int tmp = total;
        tmp -= abs(cost[i]) + abs(cost[i+1]);
        tmp += abs(cost[i]+cost[i+1]);
        cout << tmp << endl;
    }
    return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int N; cin >> N;
    vector<long long> ans(90, 0);
    ans[0] = 2, ans[1] = 1;
    rrep (i, 2, N) ans[i] = ans[i-1] + ans[i-2];
    cout << ans[N] << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
                Out.Flush();
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var N = IO.RInt;
            var a = IO.RSInt;

            Array.Sort(a);
            Array.Reverse(a);

            long len1 = -1;
            long len2 = -1;

            for (int i = 0; i < N - 1; i++)
            {
                if (a[i] == a[i + 1] && len1 == -1)
                {
                    len1 = a[i];
                    i++;
                }
                else if (a[i] == a[i + 1] && len2 == -1)
                {
                    len2 = a[i];
                    i++;
                }
            }
            long ans;
            if (len1 == -1 || len2 == -1)
            {
                ans = 0;
            }
            else
            {
                ans = len1 * len2;
            }
            WriteLine(ans);
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

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

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> size = new ArrayList<Integer>();
		int coin = 0;
		for(int i =0;i<2;i++) {
			size.add(Integer.parseInt(sc.next()));
		}
		for(int j=0;j<2;j++) {
			int max = Collections.max(size);
			int min = Collections.min(size);
			coin = coin + max;
			max = max -1;
			size.clear();
			size.add(max);
			size.add(min);
		}
		System.out.println(coin);
	}

}


Measured memory_bytes: 22996
import scala.collection.mutable
import scala.io.StdIn.{readInt, readLine}

case class Node(id: Int, parent: Int, depth: Int, children: List[Int])

object Main extends App {
  import Solver.solve

  val n     = readInt()
  val lines = Iterator.fill(n)(readLine())

  val xs = solve(lines, n)

  xs.foreach {
    case Node(id, parent, depth, children) =>
      val typeName =
        if (parent == -1) "root"
        else if (children.isEmpty) "leaf"
        else "internal node"

      val cs = children.mkString("[", ", ", "]")
      println(s"node $id: parent = $parent, depth = $depth, $typeName, $cs")
  }
}

object Solver {
  def solve(lines: Iterator[String], n: Int): Array[Node] = {

    val (childrenMap, rootId) = {
      val childrenMap = mutable.Map.empty[Int, List[Int]]
      val allChildren = mutable.Set(0 until n: _*)
      for {
        line               <- lines
        id :: _ :: children = line.split(' ').map { _.toInt }.toList
      } {
        childrenMap(id) = children
        allChildren --= children
      }

      val rootId = allChildren.head
      (childrenMap, rootId)
    }

    val xs = new Array[Node](n)
    def setDepth(id: Int, parent: Int, depth: Int): Unit = {
      val children = childrenMap(id)
      xs(id) = Node(id, parent, depth, children)

      val d = depth + 1
      for (childNodeId <- children) {
        setDepth(childNodeId, id, d)
      }
    }

    setDepth(rootId, -1, 0)

    xs
  }
}



Measured memory_bytes: 280620
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, m;
	cin >> n >> m;
	map<int, vector<int>>a;
	for (int i = 0; i < n; i++) {
		int ai, bi;
		cin >> ai >> bi;
		a[ai].push_back(bi);
	}
	int ans = 0;
	priority_queue<int>res;
	for (int i = 1; i <= m; i++) {
		for (auto now : a[i])res.push(now);
		if (res.size() > 0) {
			ans += res.top(); res.pop();
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 10880
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii; typedef long long ll;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

struct UnionFind {
	vector<int> data;
	void init(int n) { data.assign(n, -1); }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if(x != y) {
			if(data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) { return root(x) == root(y); }
	int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
	int size(int x) { return -data[root(x)]; }
};

int main() {
	int N;
	scanf("%d", &N);
	char buf1[11], buf2[11];
	map<string,int> names;
	vector<int> x(N);
	rep(i, N) {
		scanf("%s%d", buf1, &x[i]);
		names[buf1] = i;
	}
	int M;
	scanf("%d", &M);
	UnionFind uf; uf.init(N);
	rep(i, M) {
		scanf("%s%s", buf1, buf2);
		int s = names[buf1];
		int t = names[buf2];
		uf.unionSet(s, t);
	}
	vi minCost(N, INF);
	rep(i, N)
		amin(minCost[uf.root(i)], x[i]);
	int ans = 0;
	rep(i, N)
		ans += minCost[uf.root(i)];
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1848
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  ll n, d, a;
  cin >> n >> d >> a;
  vector<P> V(n);
  rep(i, n) {
    ll x, h;
    cin >> x >> h;
    V[i] = make_pair(x, h);
  }
  sort(all(V));
  ll ans = 0;
  vector<ll> invalid(n + 1, 0);
  ll valid = 0;
  int j = 0;
  rep(i, n) {
    valid -= invalid[i];
    ll remain = V[i].second - valid * a;
    if(remain <= 0) continue;
    ll k = (remain + a - 1) / a;
    valid += k;
    ans += k;
    for(; abs(V[j].first - V[i].first) <= 2 * d && j < n;
        j++) {
    }
    invalid[j] += k;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4992
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_7_A

while true
    m,f,r = gets.split.map(&:to_i)
    break if(m+f+r==-3)
    if m == -1 || f == -1
        puts 'F'
    elsif m + f >= 80
        puts 'A'
    elsif m + f >= 65
        puts 'B'
    elsif m + f >= 50
        puts 'C'
    elsif m + f >= 30
        if r >= 50 
            puts 'C'
        else
            puts 'D'
        end
    else
        puts 'F'
    end
end

Measured memory_bytes: 6104
#include "bits/stdc++.h"
using namespace std;
#define fst first
#define scd second
int main()
{
	int n;
	scanf("%d", &n);
	set<int> a;
	for(int i = 0, j; i < n; ++i)
	{
		scanf("%d", &j);
		a.insert(j);
	}
	printf(a.size() == n ? "YES\n" : "NO\n");
}


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

int main() {
  const double PI = acos(-1);
  double a, b, x;
  cin >> a >> b >> x;
  double s = x / a;
  double rad;
  if (a * b / 2 < s) {// x more than a half
    double h = 2 *(b - s / a);
    rad = atan2(h, a);
    std::cout << std::setprecision(10) << rad /(2 * PI) * 360;
  } else {
    double w = 2 * s / b;
    rad = atan2(b, w);
    std::cout << std::setprecision(10) << rad /(2 * PI) * 360;
  }
  
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

struct dice
{
  vector<int> num;

  dice(int t[]) : num(7){
    for(int i=0;i<6;++i)num[i+1]=t[i];
  };
  int state(){return num[1];}
  int right(){return num[3];}

  void s()
  {
    vector<int> tmp(7);
    tmp[1] = num[5];
    tmp[2] = num[1];
    tmp[3] = num[3];
    tmp[4] = num[4];
    tmp[5] = num[6];
    tmp[6] = num[2];
    num = tmp;
  }
  void n()
  {
    vector<int> tmp(7);
    tmp[5] = num[1];
    tmp[1] = num[2];
    tmp[3] = num[3];
    tmp[4] = num[4];
    tmp[6] = num[5];
    tmp[2] = num[6];
    num = tmp;
  }
  void e()
  {
    vector<int> tmp(7);
    tmp[1] = num[4];
    tmp[2] = num[2];
    tmp[3] = num[1];
    tmp[4] = num[6];
    tmp[5] = num[5];
    tmp[6] = num[3];
    num = tmp;
  }
  void w()
  {
    vector<int> tmp(7);
    tmp[4] = num[1];
    tmp[2] = num[2];
    tmp[1] = num[3];
    tmp[6] = num[4];
    tmp[5] = num[5];
    tmp[3] = num[6];
    num = tmp;
  }
  void r()
  {
    vector<int>tmp(7);
    tmp[1]=num[1];
    tmp[2]=num[3];
    tmp[3]=num[5];
    tmp[4]=num[2];
    tmp[5]=num[4];
    tmp[6]=num[6];
    num = tmp;
  }

  void top(int val)
  {
    if(num[1]==val)
      return;
    else if(num[2]==val)
      n();
    else if(num[3]==val)
      w();
    else if(num[4]==val)
      e();
    else if(num[5]==val)
      s();
    else
    {
      n(); n();
    }
  }
  void front(int val)
  {
    if(num[2]==val)
      return;
    else if(num[3]==val)
      r();
    else if(num[4]==val)
    {
      r(); r(); r();
    }
    else if(num[5]==val)
    {
      r(); r();
    }
  }
};

int main()
{
  int n[6];
  for(int i=0;i<6;++i)cin>>n[i];
  dice d(n);
  int q;
  cin >> q;
  for(int i=0;i<q;++i)
  {
    int a, b;
    cin >> a >> b;
    d.top(a);
    d.front(b);
    cout << d.right() << endl;
  }

  return 0;
}



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

using namespace std;

typedef long long ll;
const ll INF = 1LL << 60;

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

    cin >> N;

    vector< vector<ll> > M;
    M.resize(N);

    for (ll i = 0; i < N; ++i) {
        M[i].clear();
    }

    for (ll i = 0; i < N-1; ++i) {
        ll a;
        ll b;

        cin >> a >> b;
        a--;
        b--;

        M[a].push_back(b);
        M[b].push_back(a);
    }

    ll K;
    vector<ll> P;

    P.resize(N);
    fill(P.begin(), P.end(), -1);

    cin >> K;

    for (ll i = 0; i < K; ++i) {
        ll v;
        ll p;
        
        cin >> v >> p;
        v--;

        P[v] = p;
    }

    vector< pair<ll, ll> > R;
    R.resize(N);

    function<pair<ll, ll> (ll, ll)> dfs = [&](ll u, ll p) {
        ll mv = -INF; // min 
        ll xv = INF;  // max

        for (ll nu: M[u]) {
            if (nu != p) {
                pair<ll, ll> rv = dfs(nu, u);

                mv = max(mv, rv.first);
                xv = min(xv, rv.second);
            }
        }

        if (P[u] >= 0) {
            mv = max(mv, P[u]);
            xv = min(xv, P[u]);
        }

        R[u] = make_pair(mv, xv);
        return make_pair(mv-1, xv+1);
    };

    dfs(0, -1);

    //for (ll i = 0; i < N; ++i) {
    //    cout << "i: " << i << ", p: " << P[i] << ", range: " << R[i].first << ", " << R[i].second << endl;
    //}
    //cout << endl;


    function<void (ll, ll)> dfs2 = [&](ll u, ll p) {
        if (p >= 0) {
            R[u].first = max(R[u].first, R[p].first-1);
            R[u].second = min(R[u].second, R[p].second+1);
        }

        for (ll nu: M[u]) {
            if (nu != p) {
                dfs2(nu, u);
            }
        }

    };

    dfs2(0, -1);

    //for (ll i = 0; i < N; ++i) {
    //    cout << "i: " << i << ", p: " << P[i] << ", range: " << R[i].first << ", " << R[i].second << endl;
    //}
    //cout << endl;

    for (ll i = 0; i < N; ++i) {
        if ((abs(R[i].first) % 2 != abs(R[i].second) % 2) || (R[i].first > R[i].second)) {
            cout << "No" << endl;
            exit(0);
        }
    }

    cout << "Yes" << endl;
    for (ll i = 0; i < N; ++i) {
        cout << R[i].first << endl;
    }

    return 0;
}


Measured memory_bytes: 16512
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <stdlib.h>
#include <iomanip>

using namespace std;

#define ll long long
#define vi vector<int>
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pi 3.14159265359



int main() {
	ll N;
	cin >> N;
	if (N / 10 == 9 || N % 10 == 9) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	
	return 0;

	
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/detail/ceil_and_floor.hpp
#ifndef DETAIL_CEIL_AND_FLOOR_HPP
#define DETAIL_CEIL_AND_FLOOR_HPP

namespace tools {
  template <typename T>
  constexpr T floor(T lhs, T rhs);

  template <typename T>
  constexpr T ceil(T lhs, T rhs);

  template <typename T>
  constexpr T floor(const T lhs, const T rhs) {
    return
      lhs >= 0 && rhs >= 0 ?
        lhs / rhs :
      lhs < 0 && rhs >= 0 ?
        -ceil<T>(-lhs, rhs) :
      lhs >= 0 && rhs < 0 ?
        -ceil<T>(lhs, -rhs) :
        floor<T>(-lhs, -rhs);
  }

  template <typename T>
  constexpr T ceil(const T lhs, const T rhs) {
    return
      lhs >= 0 && rhs >= 0 ?
        (lhs - 1 + rhs) / rhs :
      lhs < 0 && rhs >= 0 ?
        -floor<T>(-lhs, rhs) :
      lhs >= 0 && rhs < 0 ?
        -floor<T>(lhs, -rhs) :
        ceil<T>(-lhs, -rhs);
  }
}

#endif

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// lib/ceil.hpp
#ifndef CEIL_HPP
#define CEIL_HPP


/*
usage:

tools::ceil(5, 3) // => 2 (i.e., ceil(5 / 3))
*/

#endif

// main.cpp

int main() {
  i64 A, B, C, D;
  std::cin >> A >> B >> C >> D;
  std::cout << (tools::ceil(C, B) <= tools::ceil(A, D) ? "Yes" : "No") << std::endl;
  return 0;
}

Measured memory_bytes: 3600