akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main(int argc, char** argv) {
  ios::sync_with_stdio(false), cin.tie(0);
  
  auto solve = [&]() {
    double r;
    cin >> r;
    cout << (2.0*3.1415926*r) << '\n';
  };
  
  int t;
  t = 1;
  while (t--)
    solve();
  
  return 0;
}


Measured memory_bytes: 3816
#include<iostream>
#include<unordered_map>
#include<string>
#include<utility>

using namespace std;

int main(){
  int n;cin >> n;
  unordered_map<string,int> m;
  string s1,s2;
  for(int i=0;i<n;i++){
    cin>> s1 >> s2;
    if(s1=="find"){
      //findはキーで検索を行う
      if(m.find(s2)==m.end()){
        cout << "no" << endl;
      }else{
        cout << "yes" << endl;
      }
    }
    if(s1=="insert"){
      //キーと値のペアになって保存されている
      m.insert(make_pair(s2,1));
    }
  }
}



Measured memory_bytes: 36324
#include<iostream>

using namespace std;

int main() {

	int a, b,c;
	char  op;


	for (c = 0; c > -1; c++) {

		cin >> a >> op >> b;

		if (op == '+') {
			cout << a + b << endl;
		}

		else if (op == '-') {
			cout << a - b << endl;
		}

		else if (op == '*') {
			cout << a * b << endl;
		}

		else if (op == '/') {
			cout << a / b << endl;
		}

		else if (op == '?') {
			return 0;
		}

	}


}

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

using namespace std;

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e18+7;

signed main(){

    int n, a, b;
    cin >> n >> a >> b;
    cout << min(a, b) << " " << max(a + b - n, 0) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  a=read(),b=read()
#define in3(a,b,c)  a=read(),b=read(),c=read()
#define in4(a,b,c,d)  a=read(),b=read(),c=read(),d=read()
#define inl(a)  a=readl()
#define inl2(a,b)  a=readl(),b=readl()
#define inl3(a,b,c)  a=readl(),b=readl(),c=readl()
#define inl4(a,b,c,d)  a=readl(),b=readl(),c=readl(),d=readl()
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x,y) memset(x,y,sizeof(x))
inline int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
inline ll readl(){
    char c;ll s=0;int t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 200010
#define inf 0x7fffffff
/*------------------------------------------------------------*/
int f[maxn];
int main(){
	int n,m;
	in2(n,m);
	int k=0;
	FOR(i,1,n){
		int c;
		in(c);
		if(!f[c])k++;
		f[c]++;
	}
	k-=m;
	if(k<=0){out(0);return 0;}
	int ans=0; 
	sort(f+1,f+n+1);
	FOR(i,1,n)
		if(f[i]){
			k--;ans+=f[i];
			if(k<=0){
				out(ans);
				return 0;
			}
		}
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
int a1=a+b;
int a2=a-b;
int a3=a*b;
int maxi=a1;
if(maxi<a2)
maxi=a2;
if(maxi<a3)
maxi=a3;
cout<<maxi;
return  0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define pb(b) push_back(b) 
#define all(a) a.begin(),a.end()
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
const int mod=1e9+7;
/* 
UnionFind：素集合系管理の構造体(union by size)
isSame(x, y): x と y が同じ集合にいるか。 計算量はならし O(α(n))
unite(x, y): x と y を同じ集合にする。計算量はならし O(α(n))
treeSize(x): x を含む集合の要素数。
*/
struct UnionFind{
 vector<int>size,parents;
 UnionFind(){}
 UnionFind(int n){//make n trees.
  size.resize(n,0);
  parents.resize(n,0);
  for(int i=0;i<n;i++)makeTree(i);
 }
 void makeTree(int x){
   parents[x]=x;//the parent of x is x
   size[x]=1;
  }
 bool isSame(int x,int y){return findRoot(x)==findRoot(y);}
 bool unite(int x,int y){
  x = findRoot(x);
  y = findRoot(y);
  if(x==y)return false;
  if(size[x]>size[y]){
   parents[y]=x;
   size[x]+=size[y];
  } 
  else{
   parents[x]=y;
   size[y]+=size[x];
  }
  return true;
 }
 int findRoot(int x){//木の根を探す,計算量削減のため低く
  if(x!=parents[x])parents[x]=findRoot(parents[x]);
  return parents[x];
 }
 int treeSize(int x){return size[findRoot(x)];}
};
/*pi*/const double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll i,fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=0,tmp=n;while(tmp/10>0){tmp/=10;d++;}return d;}
/*迷路移動*/const int dx[4]={1,0,-1,0};const int dy[4]={0,1,0,-1};
llfor;////////////////////////////////////////////////////////////
int main(){
 string s;
 cin>>s;
 ll n=s.length();
 ll c1=0,c0=0,ans=0;
 rep(i,0,n){
  if(s[i]=='0')c0++;
  else c1++;
  if(c1>0&&c0>0){
   c1--;c0--;
   ans+=2;
  }
 // cout<<i<<" "<<c0<<" "<<c1<<" "<<ans<<endl;
 }
 pr(ans);
return 0;}

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

int bit[35], rlt[35][2], a[200005], b[200005];
vector<int> dp[30][2];
int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i ++) cin >> a[i];
	for(int i = 0; i < n; i ++) cin >> b[i];
	for(int i = 0; i < n; i ++){
		int tmp = b[i];
		for(int j = 0; j < 30; j ++) {
			if(tmp & (1 << j)) bit[j] = 1;
			else bit[j] = 0;	
		}
		tmp = 0;
		for(int j = 0; j < 30; j ++){
			dp[j][bit[j]].push_back(tmp);
			tmp = tmp + bit[j] * (1 << j);
		}
	}
	for(int i = 0; i < 30; i ++){
		sort(dp[i][0].begin(), dp[i][0].end());
		sort(dp[i][1].begin(), dp[i][1].end());
	}
	for(int i = 0; i < n; i ++){
		int tmp = a[i];
		for(int j = 0; j < 30; j ++){
			if(tmp & (1 << j)) bit[j] = 1;
			else bit[j] = 0;
		}
		tmp = 0;
		for(int j = 0; j < 30; j ++){
			int x = (1 << (j)) - tmp;
			int t0 = lower_bound(dp[j][0].begin(), dp[j][0].end(), x) - dp[j][0].begin();
			int t1 = lower_bound(dp[j][1].begin(), dp[j][1].end(), x) - dp[j][1].begin();
			int m0 = dp[j][0].size(), m1 = dp[j][1].size();
//			cout << i << ' ' << j << ' ' << t0 << ' ' << t1 << ' ' << m0 << ' ' << m1 << '\n';
			rlt[j][bit[j]] += t0 + (m1 - t1);
			rlt[j][1 - bit[j]] += (m0 - t0) + t1; 
			tmp = tmp + bit[j] * (1 << j);
		}
		for(int j = 0; j < 30; j ++){
			for(int k = 0; k < 2; k ++) rlt[j][k] = rlt[j][k] % 2; 
		}
//		cout << rlt[2][1] << '\n';
	}
	int ans = 0;
	for(int i = 0; i < 30; i ++){
		if(rlt[i][1] % 2 == 1) ans += (1 << i);
	}
	cout << ans << '\n';
}


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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  string a,b,c; cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int a[4];
int main()
{
	for (int i=0;i<4;i++) cin >>a[i];
	sort(a,a+4);
	if (a[0]==1 && a[1]==4 && a[2]==7 && a[3]==9) cout <<"YES";
	else cout <<"NO";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
};


int main() {
  ll n,k;
  cin >> n >> k;
  ll nn=n+1;
  mint ans=0;
  while(nn>=k){
      ans+=(n+1-nn)*nn+1;
      nn--;
  }
  cout << ans.x << endl;
}

Measured memory_bytes: 3628
N = int(input())
words = {}
for _ in range(N):
  word = input()
  if word in words:
    words[word] += 1
  else:
    words[word] = 1
sorted_words = sorted(words.items(), key=lambda x: (-x[1], x[0]))
max_v = sorted_words[0][1]
for k, v in sorted_words:
  if v == max_v:
    print(k)
  else:
    exit()
  


Measured memory_bytes: 150132
#include<bits/stdc++.h>
using namespace std;
void reads(string &s){
	register char ch=getchar();s="";
	for(;ch==' '||ch=='\n';ch=getchar());
	for(;ch!=' '&&ch!='\n';s+=ch,ch=getchar());
}
void write(int x){
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
void output(int x,int y){
	write(x),putchar('\n'),write(y);exit(0);
}
string s,rs;
int n,z[500004],rz[500004];
bool ng[500004],rng[500004];
void ans_is_n(){for(int i=1;i<n;i++)if(s[i]!=s[i-1])return;output(n,1);}
void Z(string &S,int *z_,bool *ng_){
	int l=0,r=0;
    for (int i=1;i<S.size();i++){
        if (i>r){
            l=i,r=i;
            while(r<S.size() && S[r-l]==S[r])r++;
            z_[i]=r-l,r--;
		}else{
            int k=i-l;
            if(z_[k]<r-i+1) z_[i]=z_[k];
            else{
                l=i;
                while(r<S.size() && S[r-l]==S[r])r++;
                z_[i]=r-l,r--;
        	}
        }
    }
	for(int i=0;i<S.size()-1;i++)if(!ng_[i])
		for(l=i+1,r=2*i+1;r<S.size();l+=i+1,r+=i+1){
			if(z_[l]+l-1>=r)ng_[r]=1;
			else break;
		}
}
int main(){
	reads(s),n=s.size(),rs=s,reverse(rs.begin(),rs.end());
	ans_is_n();
	Z(s,z,ng);
	if(!ng[n-1])output(1,1);
	Z(rs,rz,rng);
	int ans=0;
	for(int i=0;i<n-1;i++)
		if(!ng[i]&&!rng[n-i-2])ans++;
	output(2,ans);
}

Measured memory_bytes: 9136
#include <stdio.h>

int main(void) {
	int i,j,H,W;

	do{
		scanf("%d %d",&H,&W);

		for(i=1;i<=H;i++){
			for(j=1;j<=W;j++){
				if((j%2!=0&&i%2!=0)||(i%2==0&&j%2==0)){
					printf("#");
				}
				else{
					printf(".");
				}
			}
			printf("\n");
		}
		if(H!=0&&W!=0){
			printf("\n");
		}
	}while(H!=0&&W!=0);
	return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

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

int main() {
  ll H, W, N;
  cin >> H >> W >> N;
  vector<ll> a(N), b(N);
  rep(i, N) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }

  typedef pair<ll, ll> P;
  set<P> s;

  vector<ll> ans(10);
  ans[0] = (H - 2) * (W - 2);
  rep(n, N) {
    repp(i, max(a[n] - 1, 1LL), min(a[n] + 1, H - 2)) {
      repp(j, max(b[n] - 1, 1LL), min(b[n] + 1, W - 2)) {
        int cnt = 0;
        repp(ii, -1, 1) {
          repp(jj, -1, 1) {
            if (s.find(mp(i + ii, j + jj)) != s.end())
              cnt++;
          }
        }
        ans[cnt]--;
        ans[cnt + 1]++;
      }
    }
    s.insert(mp(a[n], b[n]));
  }

  rep(i, 10) {
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 8064
fun main(args : Array<String>) {
    val s = readLine()!!

    if (s != s.reversed()) {
        println("No")
        return
    }

    var idx = (s.length-1)/2
    var subS = s.take(idx)

    if (subS != subS.reversed()) {
        println("No")
        return
    }

    idx = (s.length+3)/2
    subS = s.takeLast(s.length-(idx-1))

    if (subS != subS.reversed()) {
        println("No")
        return
    }

    println("Yes")
}


Measured memory_bytes: 33480
# coding: utf-8

import sys
def input(): return sys.stdin.readline().strip()

MOD = 10**9 + 7
# N = int(input())
# L = [int(x) for x in input().split()]
N, M = map(int, input().split())
# S = input()

dp = [0] * (N + 5)
dp[0] = 1

if M != 0:
    for _ in range(M):
        dp[int(input())] = -1

for i in range(N):
    if dp[i] == -1:
        continue
    if dp[i + 1] != -1:
        dp[i + 1] += dp[i]
        dp[i + 1] %= MOD
    if dp[i + 2] != -1:
        dp[i + 2] += dp[i]
        dp[i + 2] %= MOD

print(dp[N])


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

string S;
int cnt[3];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S;
	FORR(c,S) cnt[c-'a']++;
	sort(cnt,cnt+3);
	if(abs(cnt[0]-cnt[2])<=1) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>
int max_sugar_sub(int x, int c, int d, int e, int f) {
  int cnt = -1;
  
  for (int i = 0; i <= e*x/c; i++) {
    for (int j = 0; j <= e*x/d; j++) {
      int sugar = i*c + j*d;
      if (sugar <= e*x && 100*x + sugar <= f) {
        cnt = max(cnt, sugar);
      }
    }
  }
  return cnt;
}
int main () {
    ll a , b , c , d , e , f ;
    cin >> a >> b >> c >> d >> e >> f ;

    int max_all = -1, max_sugar = -1,sugar;
  double max_con = -1;
  for (int i = 0; i <= f/(100*a); i++) {
    for (int j = 0; j <= f/(100*b); j++) {
      if (i == 0 && j == 0) {
        continue;
      }
      int water = 100*a*i + 100*b*j;
      
      if (water > f) {
        break;
      }
      int sugar = max_sugar_sub(water/100, c, d, e, f);
      
      double con = (double)sugar / (double)(water+sugar);
      
      if (con > max_con) {
        max_con = con;
        max_all = water + sugar;
        max_sugar = sugar;
        
      }
      
    }
  }
  
  printf("%d %d\n",max_all, max_sugar);

    return 0 ;
}

 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define MOD 1000000007

int cnt[26];

int main(){
  int h,w;
  cin>>h>>w;
  for(int i=0;i<26;i++) cnt[i]=0;
  for(int i=0;i<h;i++){
    string s;
    cin>>s;
    for(int j=0;j<w;j++){
      int x=s[j]-'a';
      cnt[x]++;
    }
  }
  sort(cnt,cnt+26);
  reverse(cnt, cnt+26);
  int c4=0,c2=0,c1=0;
  c4=(h/2)*(w/2);
  if(h%2==1&&w%2==1){
    c2=h/2+w/2;
    c1=1;
  }else if(h%2==1){
    c2=w/2;
  }else if(w%2==1){
    c2=h/2;
  }
  //cout<<c4<<" "<<c2<<" "<<c1<<endl;
  for(int i=0;i<26;i++){
    if(c4==0) break;
    if(cnt[i]>=4){
      cnt[i]-=4;
      c4--;
      i--;
    }
  }
  for(int i=0;i<26;i++){
    if(c2==0) break;
    if(cnt[i]>=2){
      cnt[i]-=2;
      c2--;
      i--;
    }
  }
  for(int i=0;i<26;i++){
    if(cnt[i]>=1){
      cnt[i]--;
      c1--;
      break;
    }
  }
  bool flag=true;
  for(int i=0;i<26;i++){
    if(cnt[i]!=0) flag=false;
  }
  if(!flag||c4!=0||c2!=0||c1!=0){
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
n,m=gets.chomp.split(" ").map(&:to_i)
x=gets.chomp.split(" ").map(&:to_i)
if m==1 or n>m
  puts 0
else
x.sort!
ans=x[m-1]-x[0]
dis=[]
(m-1).times do|i|
  dis.push(x[i+1]-x[i])
end
dis.sort!.reverse!
(n-1).times do|i|
  ans-=dis[i]
end
puts ans

end


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

int main() {
	int A,B ;
	cin >> A>> B;
	if ((A+B)%2==0 ) {
		cout <<(A+B)/2 << '\n';
	}
	else
	{
		cout << "IMPOSSIBLE"<< '\n';
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
#define myCeil(dividend, divisor) ceil((double)(dividend) / (double)(divisor))
#define myFloor(dividend, divisor) floor((double)(dividend) / (double)(divisor))
#define calcDigits(num) floor(log10(num))+1

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl;
#define dv(name, value) cerr << (name) << " is " << (value) << endl;
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl;
#define dpa(v) cerr << "[ " << endl;REPI(itr, v) { cerr << "  [" << (*itr).first << ", " << (*itr).second << ']' << (itr != --v.end() ? "," : "") << endl; } cerr << "]" << endl;


void solve(long long N, std::vector<long long> v){
  sort(v.begin(), v.end());
  double a = 0.0;  
  FOR(x, 1, N){
    if (x == 1) {
      a = (v.at(x) + v.at(x-1)) / 2.0; 
    } else {
      a = (v.at(x) + a) / 2.0;
    }
    dv("a", a);
  } 
  cout << a << endl;
}

signed main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> v(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&v[i]);
  }
  solve(N, std::move(v));
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=998244353;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin>>n;
    vector<ll>a(n+1);
    rep(i,n-1){
        ll b;cin>>b;
        a[b]++;
    }
    REP(i,1,n+1){
        cout<<a[i]<<endl;
    }
}

Measured memory_bytes: 4788
import java.util.Scanner;
public class Main
{
        public static void main(String args[]) throws Exception
        {
                Scanner cin=new Scanner(System.in);
                int n,k;
                long r,s,p,sum=0;
                String str;
                char ch[]=new char[200050];
                n=cin.nextInt();
                k=cin.nextInt();
                r=cin.nextInt();
                s=cin.nextInt();
                p=cin.nextInt();
                str=cin.next();
                cin.close();
                for(int i=0; i<k; ++i) {
            		if(str.charAt(i)=='r') {
            			sum+=p;
            			ch[i]='p';
            		}
            		if(str.charAt(i)=='s') {
            			sum+=r;
            			ch[i]='r';
            		}
            		if(str.charAt(i)=='p') {
            			sum+=s;
            			ch[i]='s';
            		}
                }
                for(int i=k; i<n-k; ++i) {
                	if(str.charAt(i)=='r') {
                		if(ch[i-k]=='p') {
                			if(str.charAt(i+k)=='s')
                				ch[i]='s';
                			if(str.charAt(i+k)=='r')
                				ch[i]='r';
                			if(str.charAt(i+k)=='p')
                				ch[i]='r';
                		}
                		else {
                			sum+=p;
                			ch[i]='p';
                		}
                	}
                	if(str.charAt(i)=='s') {
                		if(ch[i-k]=='r') {
                			if(str.charAt(i+k)=='s')
                				ch[i]='s';
                			if(str.charAt(i+k)=='r')
                				ch[i]='s';
                			if(str.charAt(i+k)=='p')
                				ch[i]='p';
                		}
                		else {
                			sum+=r;
                			ch[i]='r';
                		}
                	}
                	if(str.charAt(i)=='p') {
                		if(ch[i-k]=='s') {
                			if(str.charAt(i+k)=='s')
                				ch[i]='p';
                			if(str.charAt(i+k)=='r')
                				ch[i]='r';
                			if(str.charAt(i+k)=='p')
                				ch[i]='r';
                		}
                		else {
                			sum+=s;
                			ch[i]='s';
                		}
                	}
                }
                int pppp;
                if(n-k<k)pppp=k;
                else pppp=n-k;
                for(int i=pppp; i<n; ++i) {
                	if(str.charAt(i)=='r') {
                		if(i-k<0)
                			sum+=p;
                		else if(ch[i-k]!='p')
                			sum+=p;
            		}
            		if(str.charAt(i)=='s') {
            			if(i-k<0)
            				sum+=r;
            			else if(ch[i-k]!='r')
            				sum+=r;
            		}
            		if(str.charAt(i)=='p') {
            			if(i-k<0)
            				sum+=s;
            			else if(ch[i-k]!='s')
            				sum+=s;
            		}
                }
                System.out.println(sum);
        }
}

Measured memory_bytes: 27456
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
#from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import breadth_first_order, depth_first_order, shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
import sys

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

max_ = 10 ** 18
N = ni()
A = na()
A.sort()
ans = 1
for i in range(N):
    ans *= A[i]
    if ans > max_:
        ans = -1
        break
print(ans)

Measured memory_bytes: 24052
from collections import Counter
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = int(input())
a = list(map(int, input().split()))

cntA = Counter(a)
all = 0
for i in cntA:
    if cntA[i] > 1:
        all += combinations_count(cntA[i], 2)
for i in range(len(a)):
    if cntA[a[i]] > 1:
        print(all - (cntA[a[i]] -1))
    else:
        print(all)

Measured memory_bytes: 26780
#include <bits/stdc++.h>
  
using namespace std;
  
#define MAX_N 15
  
bool isTri(double a,double b,double c){
    if(c < a+b && a < b+c && b < c+a){
	return true;
    }
    return false;
}
  
double getArea(double a,double b,double c){
    double s = (a+b+c)/2.0;
    return sqrt(s*(s-a)*(s-b)*(s-c));  
}
  
double S(double x){
    return x*x;
}
  
double calc(vector<double> &v){
    double a = S(v[0])*S(v[4])*(S(v[1])+S(v[2])+S(v[3])+S(v[5])-S(v[0])-S(v[4]));
    double b = S(v[1])*S(v[5])*(S(v[0])+S(v[2])+S(v[3])+S(v[4])-S(v[1])-S(v[5]));
    double c = S(v[2])*S(v[3])*(S(v[0])+S(v[1])+S(v[4])+S(v[5])-S(v[2])-S(v[3]));
    double d = -S(v[0])*S(v[1])*S(v[3])-(S(v[1])*S(v[2]))*S(v[4])-
	S(v[0])*S(v[2])*S(v[5])-S(v[3])*S(v[4])*S(v[5]);
    return sqrt((a+b+c+d)/144.0);
}
  
double getVolume(vector<double> &v){
    if(!isTri(v[0],v[1],v[3])) return 0.0; 
    if(!isTri(v[0],v[2],v[5])) return 0.0; 
    if(!isTri(v[1],v[2],v[4])) return 0.0; 
    if(!isTri(v[3],v[4],v[5])) return 0.0; 
    return calc(v);
}
  
double solve(int S,vector<double> &v,vector<double> &a){
    if(__builtin_popcount(S) == 6){
	return getVolume(v);
    }
    double res = 0;
    for(int i = 0 ; i < (int)a.size() ; i++){
	if((S >> i) & 1) continue;
	v.push_back(a[i]);
	res = max(res,solve(S|(1<<i),v,a));
	v.pop_back();
    }
    return res;
}
  
int main(){
    int N;
    while(cin >> N,N){
	vector<double> a(N),v;
	for(int i = 0 ; i < N ; i++){
	    cin >> a[i];
	}
	printf("%.10f\n",solve(0,v,a));
    }
    return 0;
}

Measured memory_bytes: 3200
using System;

public class Hello
{
    public static void Main()
    {
        var f = new int[100003];
        var fsum = new int[100003];
        var n = int.Parse(Console.ReadLine().Trim());
        var bmax = 0;
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var a = int.Parse(line[0]);
            var b = int.Parse(line[1]);
            bmax = Math.Max(bmax, b);
            f[a]++;
            f[b + 1]--;
        }
        fsum[1] = f[1];
        var imax = 0;
        for (int i = 2; i <= bmax; i++)
        {
            fsum[i] = fsum[i - 1] + f[i];
            if (fsum[i] + 1 >= i) imax = i;
            if (i > n + 1) break;
        }
        Console.WriteLine(imax == 0 ? 0 : imax - 1);
    }
}



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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int f(vector<int> in){
    if(in.size() <= 2){
        return 0;
    }
    int n = in.size() - 1;
    vector<int> dp[4];
    for(int i = 0; i <= n; i++){
        dp[0].push_back(0);//left one of '1's
        dp[1].push_back(0);//used all '1's
        dp[2].push_back(0);//left all '1's
        dp[3].push_back(0);//used one '1's
    }
    for(int i = 2; i <= n; i++){
        dp[1][i] = max(dp[3][i - 1], max(dp[0][i - 1], dp[2][i - 1])) + in[i];
        dp[2][i] = max(max(max(dp[0][i - 1], dp[1][i - 1]), dp[2][i - 1]), dp[3][i - 1]);
        //if(in[i] == 1) continue;
        //dp[0][i] = max(dp[3][i - 1], max(dp[0][i- 1], dp[2][i - 1])) + in[i] - 1;
        int sub1 = max(dp[3][i - 1], max(dp[0][i- 1], dp[2][i - 1])) + in[i] - 1;
        //dp[3][i] = max(dp[0][i - 1] + 1, max(dp[2][i - 1] + in[i - 1], dp[3][i - 1] + in[i - 1] - 1));
        int sub2 = max(dp[0][i - 1] + 1, max(dp[2][i - 1] + in[i - 1], dp[3][i - 1] + in[i - 1] - 1));
        if(in[i] == 1){
            dp[1][i] = max(dp[1][i], sub2);
            continue;
        }
        dp[0][i] = sub1;
        dp[3][i] = sub2;
    }
    /*for(int i = 1; i <= n; i++){
        cout << in[i] <<" ";
    }
    cout << endl;
    for(int i = 0; i <= n; i++){
        cout << dp[0][i] << " " << dp[1][i] << " " << dp[2][i] << " " << dp[3][i] << endl;
    }
    cout << endl;*/
    return max(dp[3][n], max(dp[2][n], max(dp[0][n], dp[1][n])));
}

int main() {
    //cout.precision(10);
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> field;
    field.push_back(0);
    for(int i = 0; i < n; i++){
        if(s[i] == '0'){
            field.push_back(0);
            continue;
        }
        if(field.back() == 0){
            field.push_back(1);
            continue;
        }
        field.back() += 1;
    }
    field.push_back(0);
    field.push_back(0);
    vector<int> subfield;
    subfield.push_back(0);
    int ans = 0;
    for(int i = 0; i < field.size() - 2; i++){
        //cout << field[i] << endl;
        if(field[i] == 0) continue;
        subfield.push_back(field[i]);
        if((field[i + 1] == 0) && (field[i + 2] == 0)){
            //cout << i << " " << f(subfield) << endl;
            ans += f(subfield);
            subfield.clear();
            subfield.push_back(0);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    //IOS;
    //ll t;cin>>t;while(t--)
    {
        ll a,b,c,d,i,j,k,l,m,n,sum=0,temp=0,f=0,cnt=0;
        string s;
        cin>>s;
        if(s[s.length()-1]=='s')cout<<s<<"es"<<endl;
        else cout<<s<<"s"<<endl;



    }
}


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

int main(){
	int a,b;
	double a_d,b_d;
	scanf("%d %d",&a,&b);
	a_d = static_cast<double>(a);
	b_d = static_cast<double>(b);
	printf("%d %d %.5f\n",a/b,a%b,a_d/b_d);
}



Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,(v).size())
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define bit(n)(1ll<<(n))
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&){}template<class T,class...U>void _print(ostream&s,const T&t,const U&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(const T&...t){_print(cout,t...);}template<class...T>void dprint(const T&...t){_print(cerr,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#endif
template<class T>bool chmax(T&a,const T&b){bool x=a<b;x?a=b:b;return x;}template<class T>bool chmin(T&a,const T&b){bool x=a>b;x?a=b:b;return x;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>class iterable{static false_type c(string v);template<class U>static auto c(U v)->decltype(all(v),true_type());static false_type c(...);public:const static bool value=decltype(c(declval<T>()))::value;};
template<class T,typename=enable_if_t<iterable<T>::value>>ostream&operator<<(ostream&o,const T&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n;
    cin>>n;
    cout<<((n+1)/2)/(double)n<<endl;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)) {
			ArrayList<Integer> A = new ArrayList<>();
			int n = sc.nextInt();
			for(int i = 0; i < n; i++) {
				int q = sc.nextInt();
				switch(q) {  // 文字列に対し switch を使って良い
				case 0 /* pushBack*/: {
					int x = sc.nextInt();
					A.add(x);
					break;  /* break を忘れない */
				}
				case 1 /* randomAccess*/: {
					int p = sc.nextInt();
					/* ArrayList は、a[p] の代わりに a.get(p) */
					System.out.println(A.get(p));
					break;  /* break を忘れない */
				}
				case 2: /* remove */ {
					A.remove(A.size()-1);
					break;  /* break を忘れない */
				}
				}
			}
		}
	}
}



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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vst;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;


const ll mod=1e9+7;
const ll inf=1e16; 

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m;i>=n;i--)

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

 ll n,r;
  cin >> n >> r;
 
  if(n<10) r+=100*(10-n); 
    
    cout << r << endl;
  
  
  
  
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int sum_digit(int n){
    int sum=0;
    while(n>0){
        sum+=(n%10);
        n/=10;
    }
    return sum;
}

int main(){
    int n;
    cin >> n;
    int ans=n;
    for(int i=1; i<n; i++){
        int sum=sum_digit(i)+sum_digit(n-i);
        if(sum<ans) ans=sum;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
mod = 10**9+7

ans = 0
y01 = (y[1] - y[0])%mod
ynum = m-1
for i in range(n-1):
    s = (((x[i+1] - x[i])%mod) * y01) % mod
    xnum = (i+1) * (n-i-1)
    ans = (ans + (s*xnum*ynum) % mod) % mod
band = ans

inv = [0] * (m + 1)
inv[1] = 1
for i in range(2, m):
    inv[i] = mod - inv[mod % i] * (mod // i) % mod

for j in range(1, m-1):
    band = (((((band * inv[j])%mod) * inv[m-j])%mod) * (((j+1) * (m-j-1))%mod))%mod
    band = ((band * ((y[j+1] - y[j])%mod))%mod * pow(((y[j]-y[j-1])%mod), mod-2, mod))%mod
    ans = (ans + band)%mod

print(ans)


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

int main(){
	// sengen
	int n;
	// nyuryoku
	cin >> n;
	int c[n],v[n];
	for(int i=0;i<n;i++) cin >> v[i];
	for(int i=0;i<n;i++) cin >> c[i];
	int s[n];
	for(int i=0;i<n;i++) s[i] = v[i] - c[i];
	sort(s,s+n,greater<int>());
	int ans = 0;
	// keisan
	int i=0;
	while(s[i] > 0 && i < n){
		ans += s[i];
		i++;
	}
	// syutsuryoku
	cout << ans << endl;
}

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

int main() {
	int X, Y;
	cin >> X >> Y;
	bool answer;
	if (Y % 2) {
		answer = false;
	}
	else {
		if ((Y >= 2 * X) && (Y <= 4 * X)) answer = true;
		else answer = false;
	}
	if (answer)printf("Yes");
	else printf("No");
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


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

int x,a,b;
cin >> x >> a >> b;
if(b <= a) cout << "delicious" << endl;
else if (b <= a+x) cout << "safe" << endl;
else cout << "dangerous" << endl;

return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>  
using namespace std;  
bool isprime(int n){  
    int m=sqrt(n);  
    for(int i=2;i<=m;i++){  
        if(n%i==0)
		return 0;  
    }  
    return 1;  
}  
int main()  
{  
    int n;  
    cin>>n;  
    int x=11;  
    while(n){  
        if(isprime(x)&&x%10==1){  
            cout<<x<<' ';  
            n--;  
        }
        x=x+10;  
    }  
    cout<<endl;  
    return 0;  
}  

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define S second
#define F first

using namespace std;

const int N = 2e5 + 15, M = 2e5 + 5;

#define arr(t, n, s, e) t _##n[e-s+1], *n= _##n+(-s);

ll n, k, arr[3];
char str[N], alpha[] = "rspx", opp[] = "sprx";
ll dp[N][5];

ll solve(int ind, int prv)
{
    if(ind >= n) return 0;
    ll &ret = dp[ind][prv];
    if(~ret) return ret;
    ret = 0;
    for(int i = 0 ; i < 3 ; i++)
    {
        if(prv != i) ret = max(ret, solve(ind + k, i) + arr[i] * (str[ind] == opp[i]));
    }
    return ret;
}

int main()
{
    memset(dp, -1, sizeof dp);
    scanf("%lld%lld%lld%lld%lld%s", &n, &k, arr, arr + 1, arr + 2, str);
    ll ans = 0;
    for(int i = 0 ; i < k ; i++) ans += solve(i, 3);
    printf("%lld\n", ans);
    return 0;
}

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

int main() {
  double l, r;

  int al = 0, ar = 0;
  int bl = 0, br = 0;
  int cl = 0, cr = 0;
  int dl = 0, dr = 0;
  while(cin >> l >> r) {
    if(l >= 1.1) al++;
    else if(l >= 0.6) bl++;
    else if(l >= 0.2) cl++;
    else dl++;

    if(r >= 1.1) ar++;
    else if(r >= 0.6) br++;
    else if(r >= 0.2) cr++;
    else dr++;
  }

  cout << al << " " << ar << endl;
  cout << bl << " " << br << endl;
  cout << cl << " " << cr << endl;
  cout << dl << " " << dr << endl;
  return 0;
}



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

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  int n;cin>>n;
  string s;cin>>s;

  for(int i=0;i<s.size();i++){
    char c = s[i];
    c += n;
    if('Z'<c)c-=26;
    cout<<c;
  }
  cout<<endl;
  
  return 0;
}


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

const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	string s; cin >> s;
	if(s == "ABC") cout << "ARC" << endl;
	else cout << "ABC" << endl;
} 

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
using namespace std;

int main() {
  int n; cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }

  sort(v.begin(), v.end());
  if (n == 2) {
    for (int i = 1; i <= v.at(0); i++) {
      if (v.at(0) % i == 0 && v.at(1) % i == 0) {
        cout << i << endl;
      }
    }
  } else {
    for (int i = 1; i <= v.at(1); i++) {
      if (v.at(0) % i == 0 && v.at(1) % i == 0 && v.at(2) % i == 0) {
        cout << i << endl;
      }
    }
  }
}



Measured memory_bytes: 3152
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define rep(i, N) for(int i = 0; i < N; ++i)

using namespace std;
typedef long long ll;

int main()
{
    ll x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;

    vector<ll> p(a);
    vector<ll> q(b);
    vector<ll> r(c);
    rep(i, a)
    {
        ll tmp;
        cin >> tmp;
        p.push_back(tmp);
    }
    rep(i, b)
    {
        ll tmp;
        cin >> tmp;
        q.push_back(tmp);
    }
    rep(i, c)
    {
        ll tmp;
        cin >> tmp;
        r.push_back(tmp);
    }
    sort(p.begin(), p.end(), greater<ll>());
    sort(q.begin(), q.end(), greater<ll>());
    sort(r.begin(), r.end(), greater<ll>());

    vector<ll> pq(x+y);

    rep(i, x)
    {
        pq.push_back(p[i]);
    }
    rep(i, y)
    {
        pq.push_back(q[i]);
    }
    sort(pq.begin(), pq.end(), greater<ll>());

    rep(i, c)
    {
        if (r[i] > pq[x+y-1])
        {
            pq.push_back(r[i]);
        }
    }
    sort(pq.begin(), pq.end(), greater<ll>());

    ll sum = 0;
    rep(i, x+y)
    {
        sum += pq[i];
    }
    cout << sum << endl;
    
    return 0;
}


Measured memory_bytes: 12368
#include<cstdio>

int main(){
    int N, min, max;
    scanf("%d %d %d", &N, &min, &max);
    int x,y;
    x = max/N;
    y = (min-1)/N;
    if(x == y) printf("NG");
    else printf("OK");
    return 0;
}

Measured memory_bytes: 1680
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int s,g,a;

	public void kei(){
		for(a=0;a<10;a++){
			s = sc.nextInt();
			g += s;
		}
	}

	public void hyou(){
		System.out.println(g);
	}

	public static void main(String[] args) {
		Main a = new Main();
		a.kei();
		a.hyou();
	}
}

Measured memory_bytes: 17164
#include<cstdio>
const static int MAX_N = 100;
bool is_open[MAX_N][5][2];
int P[MAX_N][11];

int main(){
	int N;
	scanf("%d", &N);
	for (int i = 0; i < N; ++i){
		for (int j = 0; j < 5; ++j){
			for (int k = 0; k < 2; ++k){
				int tmp;
				scanf("%d", &tmp);
				is_open[i][j][k] = tmp == 1;
			}
		}
	}
	for (int i = 0; i < N; ++i){
		for (int j = 0; j <= 10; ++j){
			scanf("%d", &P[i][j]);
		}
	}
	int answer = -1000000000;
	for (unsigned status = 1; status < 1<<10; ++status){
		int profit = 0;
		for (int shop = 0; shop < N; ++shop){
			int competition = 0;
			for (int day = 0; day < 5; ++day){
				for (int time = 0; time < 2; ++time){
					if((status >> day*2 + time & 1) & is_open[shop][day][time]) competition++;
				}
			}
			profit += P[shop][competition];
		}
		if(answer < profit) answer = profit;
	}
	printf("%d\n", answer);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<int,int> P;

int par[55],r[55];
void unite(int a,int b);
int root(int a);

int main(void){
  int n,m,i,j,a,b,ans=0;
  vector<P> e;
  cin >> n >> m;
  for (i=0;i<m;i++){
    cin >> a >> b;
    e.push_back(P(a,b));
  }
  for (i=0;i<m;i++){
    int p=0;
    for (j=1;j<=n;j++){
      par[j]=j;
      r[j]=1;
    }
    for (j=0;j<m;j++){
      if (i==j) continue;
      unite(e[j].first,e[j].second);
    }
    p=root(1);
    for (j=2;j<=n;j++) if (root(j)!=p) break;
    if (j!=n+1) ans++;
  }
  cout << ans << endl;
  return 0;
}

int root(int a){
  if (par[par[a]]==par[a]) return par[a];
  else return par[a]=root(par[a]);
}

void unite(int a,int b){
  a=root(a);
  b=root(b);
  if (r[par[a]]>r[par[b]]){
    par[par[a]]=par[b];
    r[par[b]]++;
  }else{
    par[par[b]]=par[a];
    r[par[a]]++;
  }
  return;
}

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

int main(){
	int n, m;
	cin >> n >> m;
	vector<pair<bool, bool>> s;
	for(int i = 0; i < 250000; i++){
		pair<bool, bool> sg;
		sg.first = false;
		sg.second = false;
		s.push_back(sg);
	}
	for(int i = 0; i < m; i++){
		int a; cin >> a;
		int b; cin >> b;
		if(a == 1)s[b].first = true;
		if(b == n)s[a].second = true;
	}
	string ans = "IMPOSSIBLE";
	for(int i = 0; i < 250000; i++){
		if(s[i].first == true && s[i].second == true) ans = "POSSIBLE" ;
	}
	cout << ans << endl;

}

Measured memory_bytes: 892
N=int(input())
A=[0]*N
B=[0]*N
C=[0]*N
for i in range(N):
    A[i],B[i]=map(int,input().split())
    C[i]=[A[i],B[i]]
C.sort(key=lambda x:(x[1],x[0]))
t=0
for i in range(N):
    t+=C[i][0]
    if C[i][1]<t:
        print('No')
        exit()
print('Yes')

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

int main()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	if(n>=1 && n<=999)
		cout<<"ABC\n";
	else
		cout<<"ABD\n";
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>
#include <type_traits>

/* template start */
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, long long b) {
  if(b==0)return 1;
  if (a==0)return 0;
  Num x = 1;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

using ll = long long;

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

  ll n,k;
  std::cin>>n>>k;

  std::vector<ll> a(n);
  for(auto&& e:a)std::cin>>e;

  rep(i,0,n-k){
    if(a[i]<a[i+k])std::cout<<"Yes\n";
    else std::cout<<"No\n";
  }

  return 0;
}

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

int main()
{
    cin >> s;
    int len = s.length();
    if(len & 1)
    {
        if(s[0] == s[len - 1]) cout << "Second";
        else cout << "First";
    }
    else
    {
        if(s[0] ^ s[len - 1]) cout << "Second";
        else cout << "First";
    }
}

Measured memory_bytes: 512