akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod

int n, m;
vector<vector<int>> g(100);
vector<pair<int, int>> e;

void dfs(int now, int u, int v, vector<bool>& visited) {
    visited[now] = true;
    for (auto nx : g[now]) {
        if (now == u && nx == v) continue;
        if (now == v && nx == u) continue;
        if (visited[nx]) continue;
        dfs(nx, u, v, visited);
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        e.push_back({a, b});
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int ans = 0;
    rep(i, m) {
        vector<bool> visited(n, false);
        dfs(0, e[i].fi, e[i].se, visited);
        bool ok = true;
        rep(j, n) {
            if (!visited[j]) {
                ok = false;
                break;
            }
        }
        if (!ok) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    x = int(input())
    a = x//500
    b = (x%500)//5
    print(1000*a+5*b)
    return

#Solve
if __name__ == "__main__":
    solve()

Measured memory_bytes: 38384
#include<iostream>

using namespace std;

int main() {
	long x;
	long x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	long x3, x4, y3, y4;
	x3 = x2 + (y1 - y2);
	y3 = y2 - (x1 - x2);
	x4 = x1 + (y1 - y2);
	y4 = y1 - (x1 - x2);
	cout << x3 << " ";
	cout << y3 << " ";
	cout << x4 << " ";
	cout << y4 << " ";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N;
  cin >> N;
  vi A(N);
  rep(i,N) {
    cin >> A[i];
  }
  reverse(rng(A));
  vi dp(N,INF);
  rep(i,N) {
    *upper_bound(rng(dp),A[i]) = A[i];
  }
  cout << distance(dp.begin(),lower_bound(rng(dp),INF)) << endl;
  return 0;
}

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

int main(){
    int x,y,g2[4] = {4,6,9,11},flagx=0,flagy=0;
    cin >> x >> y;
    if(x==2||y==2){
        cout << "No" << endl;
        return 0;
    }else{
        for(int i=0;i<4;i++){
            if(x==g2[i]){
                flagx++;
            }
            if(y==g2[i]){
                flagy++;
            }
        }
    }
    if(flagx==flagy){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

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

#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin4(X,Y,Z,W) scanf("%d %d %d %d",&X,&Y,&Z,&W)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)

#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)

typedef long long  ll;
#define rept(x, s, n) for (int x = s; x < n; x++)

#define S_RTN(S)  s_cout(S);return 0


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

int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_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 s_asorts(const void* a, const void* b);

//昇順
int s_asorts(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
	int i;
	rept(i, 0, n) {
		l_cin2(*(a + i), *(b + i));
	}
	return 0;
}
int i_cins(int n, int* a) {
	int i;
	for (i = 0; i < n; i++) {
		i_cin(*(a + i));
	}

	return 0;
}
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);
}

long _max(long a, long b) {
	return a > b ? a : b;
}
long _min(long a, long b) {
	return a < b ? a : b;
}
int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}

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;
}

#pragma endregion


#include <stdio.h>

#include<stdio.h>

int _atoi(char *s, int len);
int _atoi(char *s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}
int main(void)
{
	int  i,j,len,min=0;
	char s[100002],flg=0x00;

	s_cin(s);
	len = strlen(s); s[len] = 'z'+1;
	qsort(s, len, sizeof(char), s_asorts);
	
	if (s[0] != 'a') { printf("%c\n", 'a'); return 0; }

	for (i = 0; i < len; i++) {
		if (s[i + 1] - s[i] <= 1) continue;

		printf("%c\n", s[i] + 0x01);
		return 0;
	}
	
	s_cout("None");
	return 0;
}



Measured memory_bytes: 380
#include<iostream>
using namespace std;
int ctoi(char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
  }
}

int main(){
  int N, A, B, sum_1 = 0;
  string num;
  cin >> N >> A >> B;
  for(int i = 1; i <= N; i++){
    num = to_string(i);
    int sum_2 = 0;
    for(char c : num) sum_2 += ctoi(c);
    if(sum_2 >= A && sum_2 <= B) sum_1 += i;
  }
  cout << sum_1 << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <stdio.h>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,D,Q,K,R,W,H,P,L,G;
ll ans;
string S,T;
ll y[101010];
ll a[101010];
ll b[101010];
ll t[101010];
ll p[101010];
ll n[101010];
ll l[101010];
ll r[101010];
string s[101010];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
struct Edge{
	ll to,cost;
	 Edge(ll to, ll cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;

struct UnionFind {
    vector<ll> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	vector<ll> size;
    UnionFind(ll N) : par(N),size(N) { //最初は全てが根であるとして初期化
        for(ll i = 0; i < N; i++) par[i] = i;
		for(ll i = 0; i < N; i++) size[i] = 1;
    }

    ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
	ll GetSize(ll x){
		return size[root(x)];
	}

    void unite(ll x, ll y) { // xとyの木を併合
        ll rx = root(x); //xの根をrx
        ll ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		size[ry]+=size[rx];

    }

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};
ll sr,sc;
int main() {
    cin>>N;
    vector<pair<string,pair<ll,ll>>> v;
    rep(i,1,N+1){
        string s;
        ll p;
        cin>>s>>p;
        v.push_back(make_pair(s,make_pair(p,i)));
    }
    sort(v.begin(),v.end());
    rep(i,0,N){
        ll j=i;
        vector<pair<ll,ll>> v2;
        v2.push_back(v[i].second);
        if(j+1==N){
            cout<<v[i].second.second<<endl;
            break;
        }
        while(v[j].first == v[j+1].first){
            v2.push_back(v[j+1].second);
            i++;
            j++;
            if(j+1==N)break;
        }
        sort(v2.begin(),v2.end());
        urep(j,v2.size()-1,0){
            cout<<v2[j].second<<endl;
        }
    }
	return 0;
}


Measured memory_bytes: 1024
fun main(args: Array<String>) {
    val S = readLine()!!
    val y = S.take(4).toInt()
    val m = S.substring(5..6).toInt()
    val d = S.takeLast(2).toInt()
    val ans = when {
        y < 2019 -> "Heisei"
        y == 2019 -> when {
            m < 4 -> "Heisei"
            m == 4 -> when {
                d <= 30 -> "Heisei"
                else -> "TBD"
            }
            else -> "TBD"
        }
        else -> "TBD"
    }
    println(ans)
}

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

bool palindromic(string str)
{
  	for(int i=0,j=str.length()-1 ; i<j ; ++i,--j)
    {
    	if(str[i]!=str[j])
        return false;
    }
	return true;
}

int main()
{
	int a,b;
  	cin>>a>>b;
  	int ans=0;
  	for(int i=a ; i<=b ; ++i)
    {
    	ans+=palindromic(to_string(i));
    }
  	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <unordered_map>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    print(s.substr(0, s.size()-8));
}


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

using namespace std;
int n,val;
multiset<int> m1,m2;
int main()
{
    cin>>n;
    for(int i=1;i<=(1<<n);i++)
    {
        cin>>val;
        m1.insert(val);
    }
    auto it=m1.end();
    it--;
    int nr=*it;
    m2.insert(nr);
    m1.erase(it);
    for(int i=1;i<=n;i++)
    {
        for(auto it=m2.begin();it!=m2.end();it++)
        {
            nr=*it;
            auto it2=m1.lower_bound(nr);
            if(it2==m1.begin())
            {
                cout<<"No";
                return 0;
            }
            it2--;
            int nr2=*it2;
            if(nr2>=nr)
            {
                cout<<"No";
                return 0;
            }
            m2.insert(nr2);
            m1.erase(it2);
        }
    }
    cout<<"Yes";
    return 0;
}


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

#define ll long long

int main()
{
	ll n,weight;
	cin>>n>>weight;

	ll w[n];
	ll v[n];

	for(ll i=0;i<n;i++)
	{
		cin>>w[i];
		cin>>v[i];
	}

	ll knap[n][weight+1];
	for(ll i=0;i<n;i++)
	{
		for(ll j=0;j<=weight;j++)
		{
			knap[i][j]=0;
		}
	}

	for(ll j=0;j<=weight;j++)
	{
		if(j>=w[0])
		{
			knap[0][j]=v[0];
		}
	}

	for(ll i=1;i<n;i++)
	{
		for(ll j=0;j<=weight;j++)
		{
			if(j<w[i])
			{
				knap[i][j]=knap[i-1][j];
				//cout<<"*** ";
			}
			else
			{
				ll vv=v[i]+knap[i-1][j-w[i]];
				knap[i][j]=(knap[i-1][j]>vv)?knap[i-1][j]:vv;
				//cout<<"--- ";
			}
		}
		cout<<endl;
	}

	// for(ll i=0;i<n;i++)
	// {
	// 	for(ll j=0;j<=weight;j++)
	// 	{
	// 		cout<<knap[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }

	cout<<knap[n-1][weight]<<endl;
	return 0;
}

Measured memory_bytes: 78336
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    ll h, n;
    cin>>h>>n;
    ll a[n+5];
    int i;
    ll ans = 0;
    FOR0(i, n)
    {
        cin>>a[i];
        ans += a[i];
    }
    if(ans >= h) cout<<"Yes\n";
    else cout<<"No\n";
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;

typedef long long int ll;
 
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 

 
const ll N = 200005;
const ll mod = 998244353;
const long long int inf = 10e17;
#define pp pair<ll,ll>

typedef long double ld;
typedef vector<pp> vpl;
#define MP make_pair
#define endl "\n"
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define repb(i,n) for(ll i=1;i<n-1;i++) 
#define trace(i,a) for(auto i=a.begin();i!=a.end();i++) 
#define mtrace(i,a) for(auto i=a.begin();i!=a.end();i++)  cout<<i->first<<" "<<i->second<<endl;   
 
const ld pi = 3.14159265359;

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}

 
void fastIO(void);
void decimal(int);
ll modmulti(ll, ll);
ll modadd(ll, ll);
ll modpower(ll, ll);
ll gcd(ll, ll );
ll modinv(ll);


int main()
{
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5]) cout<<"Yes\n";
	else cout<<"No\n";
}

	


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}
 
void decimal(int n){
   cout<<fixed;
   cout<<setprecision(n);
}
ll modmulti(ll a, ll b){
   return ((a%mod)*1ll*(b%mod))%mod;
}
ll modadd(ll a, ll b){
   ll asdfgh =  ((a%mod)+(b%mod)+mod+mod)%mod;
   asdfgh = (asdfgh+mod)%mod;
   return asdfgh;
}
ll modpower(ll a, ll n){
   if(n==0) return 1;
   if(n==1) return a%mod;
   ll b = modpower(a,n/2);
   b = modmulti(b,b);
   if(n%2==0) return b;
   return modmulti(a,b);
}
ll gcd(ll a, ll b){
   if(b==0)
      return a;
   return gcd(b,a%b);
}
ll modinv(ll a){
   return modpower(a,mod-2);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i].second;
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    vector<P> ans(n);
    rep(i,n) {
        cin>>ans[i].first;
        ans[i].second = i+1;
    }

    sort(ans.begin(), ans.end());
    print(ans);
    return 0;
}

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

int main() {

int N;
cin >> N;
vector<int> A(N-1);
vector<int> ans(N-1);

for (int i = 0;i < N-1;i++){
    cin >> A.at(i);
}

for (int i = 0;i < N-1 ;i++){
    int j = A.at(i)-1;
    ans.at(j) += 1;
}


ans.push_back(0);

for (int i = 0;i < N;i++){
    cout << ans.at(i) << endl;
}


}


Measured memory_bytes: 5544
#include <iostream>
#include <map>
#include <string>
using namespace std;
#define REP(i,n) for (int i=0; i<n; i++)

int main(void){
	map <char, int> m;
	int num[] = {1,5,10,50,100,500,1000};
	REP(i,7)
		m["IVXLCDM"[i]] = num[i];

	char c;
	string r;
	while (cin>>r){
		int tmp, tmp2= m[r[0]], s=0;
		REP(i,r.size()){
			tmp = m[r[i]];
			if (tmp2<tmp)
				s-= tmp2*2;
			s += tmp;
			tmp2 = tmp;
		}
		cout<<s<<endl;
	}
}

Measured memory_bytes: 1184
N = gets.to_i

class Count_753
  attr_reader :counter
  def initialize
    @counter = 0
  end

  def solve(value, used)
    return if value > N
    @counter += 1 if used == 0b111

    solve(value*10 + 7, used | 0b001)
    solve(value*10 + 5, used | 0b010)
    solve(value*10 + 3, used | 0b100)
  end
end

counter = Count_753.new
counter.solve(0,0)
puts counter.counter


Measured memory_bytes: 14288
import sys
import itertools

stdin = sys.stdin

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


n = ni()
d = na()
res = 0
for v in itertools.combinations(d, 2):
    res += v[0] * v[1]
print(res)




Measured memory_bytes: 3060
#include<stdio.h>
 
int min(int a,int b){
	if(a<b){
    	return a;
    }else{
    	return b;
    }
}

int max(int a,int b){
	if(a<b){
    	return b;
    }else{
    	return a;
    }
}
 
 
int main(void){
 
  int A=0,B=0,C=0,X=0,Y=0,ans=0;
  scanf("%d%d%d%d%d",&A,&B,&C,&X,&Y);
  
  int pay_a=A*X+B*Y;
  
  int pay_b=0;
  if(X>Y){
  	pay_b=Y*C*2 + A*(X-Y);
  }else{
  	pay_b=X*C*2 + B*(Y-X);
  }
  
  int pay_c=0;
  
  pay_c=C*2*max(X,Y);
  
  int pay=min(pay_a,pay_b);
  pay=min(pay,pay_c);
  
  printf("%d",pay);
  
 

 
 
return 0;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

using P = pair<ll, int>;

// Sieve of Eratosthenes
struct Sieve {
    int n;
    vector<int> f, primes;
    Sieve(int n=1):n(n), f(n+1) {
        f[0] = f[1] = -1;
        for (ll i = 2; i <= n; ++i) {
            if (f[i]) continue;
            primes.push_back(i);
            f[i] = i;
            for (ll j = i*i; j <= n; j += i) {
                if (!f[j]) f[j] = i;
            }
        }
    }
    bool isPrime(int x) { return f[x] == x;}
    vector<ll> factorList(ll x) {
        vector<ll> res;
        for (int p : primes) {
            while (x%p==0) {
                x /= p;
                res.pb((ll)(p));
            }
        }
        if (x > 1) res.pb((ll)(x));
        return res;
    }
    vector<P> factor(ll x) {
        vector<ll> fl = factorList(x);
        if (fl.size() == 0) return {};
        vector<P> res(1, P(fl[0], 0));
        for (ll p : fl) {
            if (res.back().first == p) {
                res.back().second++;
            } else {
                res.emplace_back(p, 1);
            }
        }
        return res;
    }
};

int main(){
    ll n;
    cin >> n;
    Sieve s((int)(1e6+5));
    vector<P> vp = s.factor(n);
    int ans = 0;
    for (auto p : vp) {
        int x = 1;
        while (p.second-x >= 0) {
            p.second -= x;
            ++x;
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7816
N = int(input())

S = [input() for i in range(N)]

#print(N)
#print(S)

count = [0, 0, 0, 0]

for s in S:
  if s in "AC":
    count[0] += 1
  elif s in "WA" :
    count[1] += 1
  elif s in "TLE" :
    count[2] += 1
  elif s in "RE":
    count[3] += 1
    
print("AC x " + str(count[0]))
print("WA x " + str(count[1]))
print("TLE x " + str(count[2]))
print("RE x " + str(count[3]))

Measured memory_bytes: 16328
n=int(input())
s=input()
i,j=0,len(s)-1
ans=0
while(i<=j):
	if(s[j]=='W'):
		j-=1
	elif(s[i]=='R'):
		i+=1
	else:
		ans+=1
		i+=1
		j-=1
print(ans)


Measured memory_bytes: 9480
/*#include<iostream>
int main(){
int a,b;
int x,y,z,count;
while(true){
std::cin>>a>>b;
count=0;
if(a==0&&b==0)break;
x=1;y=0;z=0;
for(int i=1;i<=a-2;i++){
for(int j=i+1;j<=a-1;j++){
for(int k=j+1;k<=a;k++){
if(i+j+k==b){
count++;
break;
}
}
}
}
std::cout<<count<<std::endl;
    }

    return 0;

}*//*
#include<iostream>
int main(){
    int a,count=0,ans=0;
    std::cin>>a;
    for(int i=1;i<=a;i+=2){
        count=0;
        for(int j=1;j<=i;j++){
            if(i%j==0)count++;
            if(count>8)break;
        }
//        std::cout<<"i:"<<i<<" count:"<<count<<std::endl;
        if(count==8)ans++;
        
    }
    std::cout<<ans<<std::endl;
    return 0;
}*/
#include<iostream>
#include<string>
int main(){
  std::string str;
  std::cin>>str;
    int count=0;
  for(int i=0;i<str.length();i++){
      int sub=0;
      for(int j=i;j<str.length();j++){
          if(str[j]=='A'||str[j]=='G'||str[j]=='C'||str[j]=='T'){
              sub++;
          }else break;
      }
      count=std::max(count,sub);
  }
    std::cout<<count<<std::endl;
    return 0;
}


Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
int main(){
        int n,m;cin>>n>>m;
        vector<int >h(n);
        for(int i=0;i<n;i++)cin>>h[i];
        vector<vector<int >  >adj(n);
        for(int i=0,a,b;i<m;i++){
                cin>>a>>b;
                a-=1;b-=1;
                adj[a].push_back(b);
                adj[b].push_back(a);
        }
        int no_of_obs = 0;
        for(int i=0;i<n;i++){
                int maxi = 0;
                for(int j=0;j<adj[i].size();j++){
                        maxi = max(maxi,h[adj[i][j]]);
                }
                if(maxi<h[i])no_of_obs+=1;
        }
        cout<<no_of_obs<<'\n';
}


Measured memory_bytes: 8732
// C++ code to find number of distinct numbers 
// in a subarray 
#include<bits/stdc++.h> 
using namespace std; 
  
const int MAX = 1000001; 
  
// structure to store queries 
struct Query 
{ 
    int l, r, idx; 
}; 
  
// cmp function to sort queries according to r 
bool cmp(Query x, Query y) 
{ 
    return x.r < y.r; 
} 
  
// updating the bit array 
void update(int idx, int val, int bit[], int n) 
{ 
    for (; idx <= n; idx += idx&-idx) 
        bit[idx] += val; 
} 
  
// querying the bit array 
int query(int idx, int bit[], int n) 
{ 
    int sum = 0; 
    for (; idx>0; idx-=idx&-idx) 
        sum += bit[idx]; 
    return sum; 
} 
  
void answeringQueries(int arr[], int n, Query queries[], int q) 
{ 
    // initialising bit array 
    int bit[n+1]; 
    memset(bit, 0, sizeof(bit)); 
  
    // holds the rightmost index of any number 
    // as numbers of a[i] are less than or equal to 10^6 
    int last_visit[MAX]; 
    memset(last_visit, -1, sizeof(last_visit)); 
  
    // answer for each query 
    int ans[q]; 
    int query_counter = 0; 
    for (int i=0; i<n; i++) 
    { 
        // If last visit is not -1 update -1 at the 
        // idx equal to last_visit[arr[i]] 
        if (last_visit[arr[i]] !=-1) 
            update (last_visit[arr[i]] + 1, -1, bit, n); 
  
        // Setting last_visit[arr[i]] as i and updating 
        // the bit array accordingly 
        last_visit[arr[i]] = i; 
        update(i + 1, 1, bit, n); 
  
        // If i is equal to r of any query  store answer 
        // for that query in ans[] 
        while (query_counter < q && queries[query_counter].r == i) 
        { 
            ans[queries[query_counter].idx] = 
                     query(queries[query_counter].r + 1, bit, n)- 
                     query(queries[query_counter].l, bit, n); 
            query_counter++; 
        } 
    } 
  
    // print answer for each query 
    for (int i=0; i<q; i++) 
        cout << ans[i] << endl; 
} 
  
// driver code 
int main() 
{ 
    std::ios::sync_with_stdio(0); 
    std::cin.tie(NULL);           
    std::cout.tie(NULL);
	int n, q;
	cin >> n >> q;
	int a[n];
	for(int i=0; i<n; i++) {
		cin >> a[i];
	}
    Query queries[q];
    for(int i=0; i<q; i++) {
    	int l , r;
    	cin >> l >>r;
    	queries[i].l = l-1;
    	queries[i].r = r-1;
    	queries[i].idx = i;
     } 
    sort(queries, queries+q, cmp); 
    answeringQueries(a, n, queries, q); 
    return 0; 
}


Measured memory_bytes: 19340
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define read >>
#define echo cout <<
#define fin << '\n'
#define _ << ' ' <<
#define in :

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};

string mp[22];
int dp[22][22][22][22];
int h, w;

bool ins ( int y, int x ) {
    return 0 <= y && y < h && 0 <= x && x < w;
}

void bfs ( int Y, int X ) {
    queue<pair<int, int>> q;
    dp[Y][X][Y][X] = 0;
    q.push(make_pair(Y, X));
    while ( !q.empty() ) {
        int y = q.front().first;
        int x = q.front().second;
        q.pop();
        for ( int i = 0; i < 4; i++ ) {
            int ny = y + dy[i];
            int nx = x + dx[i];
            if ( ins(ny, nx) && dp[Y][X][ny][nx] == -1 && mp[ny][nx] == '.' ) {
                q.push(make_pair(ny, nx));
                dp[Y][X][ny][nx] = dp[Y][X][y][x] + 1;
            }
        }
    }
}

signed main ( ) {

    cin >> h >> w;
    for ( int i = 0; i < h; i++ ) cin >> mp[i];

    memset(dp, -1, sizeof(dp));

    for ( int i = 0; i < h; i++ ) {
        for ( int j = 0; j < w; j++ ) {
            if ( mp[i][j] - '#' ) {
                bfs ( i, j );
            }
        }
    }

    int ans = 0;
#define f(i) for ( int i = 0; i < 22; i++ )
    f(i)f(j)f(k)f(l) ans = max ( ans, dp[i][j][k][l] );
#undef f
    echo ans fin;

    return 0;
}

Measured memory_bytes: 2048
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt() - 1;

        char[] c = sc.next().toCharArray();

        if (c[k] == 'A') {
            c[k] = 'a';
        } else if (c[k] == 'B') {
            c[k] = 'b';
        } else {
            c[k] = 'c';
        }

        sc.close();

        System.out.println(c);

    }
}

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

#define MAX 2000001
#define VMAX 10000

int main(){
	unsigned short *A, *B;
	int C[VMAX + 1];
	int n, i, j;
	
	scanf("%d", &n);

	A = malloc(sizeof(short) * n + 1);
	B = malloc(sizeof(short) * n + 1);

	for(i = 0;i <= VMAX; i++){
	C[i] = 0;
	}
	
	for(i = 0; i < n;i++){
		scanf("%hu", &A[i + 1]);
		C[A[i + 1]]++;
	}

	for(i = 1;i <= VMAX; i++){
	C[i] = C[i] + C[i-1];
	}
	
	for(j = 1;j <= n;j++){
		B[C[A[j]]] = A[j];
		C[A[j]]--;
	}
	
	for(i = 1;i <= n; i++){
		if(i > 1){
			printf(" ");
		}
		printf("%d",B[i]);
	}
	
	printf("\n");
	
	return 0;

}


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

int main()
{
  long long N;
  cin >> N;
  long long N3 = N * 3;
  long long a[N3];
  for (int i = 0; i < N * 3; i++)
  {
    cin >> a[i];
  }
  
  sort(a, a + N3, greater<long long>()); //vectorにするとa+N3ができない。
  long long ans = 0;
  for (int i = 0; i < N; i++)
  {
    ans += a[i * 2 + 1];
  }
  cout << ans << endl;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=100005;
int x[N],y[N],p[N],a,b,c;
ll f[N],g[N],ans,best=-4e18;
int n,X,Y,Z;

int main(){
	read(X),read(Y),read(Z);
	n=X+Y+Z;
	rep(i,1,n){
		read(a),read(b),read(c);
		ans+=c,x[i]=a-c,y[i]=b-c;
		p[i]=i;
	}
	sort(p+1,p+n+1,[&](int i,int j){
		return x[i]-y[i]>x[j]-y[j];
	});
	priority_queue<int,vi,greater<int> > Q;
	rep(i,1,n){
		f[i]=f[i-1];
		if(Q.size()<X) Q.push(x[p[i]]),f[i]+=x[p[i]];
		else if(Q.top()<x[p[i]]){
			f[i]+=x[p[i]]-Q.top(),Q.pop(),Q.push(x[p[i]]);
		}
	}
	while(!Q.empty()) Q.pop();
	per(i,n,1){
		g[i]=g[i+1];
		if(Q.size()<Y) Q.push(y[p[i]]),g[i]+=y[p[i]];
		else if(Q.top()<y[p[i]]){
			g[i]+=y[p[i]]-Q.top(),Q.pop(),Q.push(y[p[i]]);
		}
	}
	rep(i,X,n-Y) best=max(best,f[i]+g[i+1]);
	cout<<ans+best<<endl;
	return 0;
}

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

int main(){
	int N;cin>>N;
	double ans=0;
	for(int i=0;i<N;i++){
		double kane; string S;
		cin>>kane>>S;
		if(S=="JPY")ans+=kane;
		else ans+=kane*380000.0;
	}
	cout<<fixed<<setprecision(6)<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	//1251
	Scanner sc = new Scanner(System.in);
	int INF = 1 << 24;
	int [][] field;
	int [][] vx = {{0,1,0,-1,-1,-1},{0,1,0,-1,1,1}};
	int [][] vy = {{1,0,-1,0,1,-1 },{1,0,-1,0,-1,1}};
	int n,m;
	
	class C{
		int x,y, step;

		public C(int x, int y, int step) {
			this.x = x;
			this.y = y;
			this.step = step;
		}
	}

	private void doit() {
		while(true){
			m = sc.nextInt();
			if(m== 0)break;
			n = sc.nextInt();
			int s = sc.nextInt();
			field = new int[n][m];
			for(int i = 0; i < n; i++){
				Arrays.fill(field[i], INF);
			}
			for(int i = 0; i < s; i++){
				int x = sc.nextInt() - 1;
				int y = sc.nextInt() - 1;
				bfs(x,y);
			}
			int t = sc.nextInt();
			int [][] work = deepcopy(field);
			int max = 0;
			for(int i = 0; i < t; i++){
				int x = sc.nextInt() - 1;
				int y = sc.nextInt() - 1;
				field = deepcopy(work);
				int res = bfs(x,y);
				max = Math.max(max, res);
			}
			System.out.println(max);
		}
	}

	private int[][] deepcopy(int[][] field2) {
		int [][] res = new int[n][m];
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				res[i][j] = field2[i][j];
			}
		}
		return res;
	}

	private int bfs(int x, int y) {
		LinkedList<C> open = new LinkedList<Main.C>();
		open.add(new C(x, y, 0));
		field[y][x] = 0;
		int ans = 1;
		while(! open.isEmpty()){
			C now = open.poll();
			int ind = now.y % 2;
			for(int i = 0; i < vx[ind].length; i++){
				int xx = now.x + vx[ind][i];
				int yy = now.y + vy[ind][i];
				if(! isOK(xx,yy)) continue;
				if(field[yy][xx] <= now.step + 1) continue;
				open.add(new C(xx, yy, now.step + 1));
				field[yy][xx] = now.step + 1;
				ans++;
			}
		}
		return ans;
	}

	private boolean isOK(int xx, int yy) {
		if(0<= xx && xx < m && 0<= yy && yy < n){
			return true;
		}
		return false;
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}
}

Measured memory_bytes: 22032
a,b = map(int,input().split())

arr = []#素数リスト　(素数:べき)の形で出てくる

def factorization(n):
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

factorization(a)
ans = 0

for p,n in arr:
  if b%p == 0:
    ans += 1
    
if len(arr) == 1 and arr[0][0] == 1:
  print(1)
  exit()
  
print(ans+1)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
const ll MOD = 1e9 + 7;
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(c,a,b) for(ll c=a;c<b;c++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define min_heap priority_queue<pll,vector<pll>,greater<pll> >
ll dx4[]={-1,1,0,0};
ll dy4[]={0,0,-1,1};
ll dx8[]={-1,-1,-1,0,1,1,1,0};
ll dy8[]={-1,0,1,1,1,0,-1,-1};
bool isvalid(ll x,ll y,ll n,ll m)
{
	return (x>=0 and y>=0 and x<n and y<m);
}
ll isprime[1000];
vector<ll> prime;
void sievetoprime(ll n)
{
	mem(isprime,true);
	for(ll p=2;p*p<=n;p++)
	{
		if(isprime[p]==true)
		{
			for(ll i=p*p;i<=n;i+=p)
				isprime[i]=false;
		}
	}
}
ll lcm(ll a,ll b)
{
	return (a/__gcd(a,b))*b;
}
bool cmp(pair<string,ll> a,pair<string,ll> b)
{
	if(a.first<b.first)
		return 1;
	else if(a.x==b.x)
	{
		return a.y<b.y;
	}
	return 0;
}
void solve()
{
	ll n;
	cin>>n;
	ll a,b;
	vector<pll> v;
	rep(i,0,n)
	{
		cin>>a>>b;
		v.pb(mp(b,a));
	}
	sort(all(v));
	ll total_work=0;
	for(auto i:v)
	{
		total_work+=i.second;
		if(total_work>i.first)
		{
			cout<<"No\n";
			return;
		}
	}
	cout<<"Yes\n";
}	
int main()
{
	IOS
	ll t;
	t=1;
//	cin>>t;
	while(t--)
	{
		solve();
	}
}

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

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

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

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()

int main() {

    int N;
    cin >> N;

    cout << (N+1)/2 << endl;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    int n;
    cin >> n;
    if(n%2==1){
        double tmp=(double)(n+1)/(2*n);
        cout << fixed << setprecision(10) << tmp;
    }
    else {
        cout << 0.5;
    }
    cout << endl;
}


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

int main(){
  int n;
  int x[110], y[110], h[110];
  int tmpx, tmpy, tmph = 0;
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> x[i] >> y[i] >> h[i];
    if(h[i] != 0 && tmph == 0){
      tmpx = x[i];
      tmpy = y[i];
      tmph = h[i];
    }
  }

  for(int i = 0;i <= 100;i++){
    for(int j = 0;j <= 100;j++){
      int H = tmph + abs(i-tmpx) + abs(j-tmpy);
      bool flag = true;
      for(int z = 0;z < n;z++){
        if(max(H - abs(i-x[z]) - abs(j-y[z]),0) != h[z]){
          flag = false;
          break;
        }
      }
      if(flag){
        cout << i << " " << j << " " << H << endl;
        return 0;
      }
    }
  }
}



Measured memory_bytes: 256
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(a,b) memset(a,b,sizeof(a))
#define msn(a,n,b) for(int i=0;i<=n;i++)a[i]=b
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define fi first
#define se second
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const int mod=1e9+7;
const int seed=233;
const double PI=acos(-1.0);
const double eps=1e-7;
const int inf=0x3f3f3f3f;
const int max_n=10005;
ll ceil(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?(x+y-1)/y:-x/y;}
ll floor(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?x/y:-(x+y-1)/y;}
namespace {
    inline int Add(int x,int y){return (x+=y)>=mod?x-mod:x;}
    inline int Sub(int x,int y){return (x-=y)<0?x+mod:x;}
    inline int Mul(int x,int y) {return 1ll*x*y%mod;}
    inline int Pow(int x,int y=mod-2){if(y==0)return 1;int res=1;while(y){if(y&1)res=1ll*res*x%mod;x=1ll*x*x%mod;y>>=1;}return res;}
}
/**********************head************************/
int dp[max_n*2];
int h,n;
int main(){
    scanf("%d%d",&h,&n);
    for(int i=0;i<max_n*2;i++)dp[i]=inf;
    dp[0]=0;
    for(int i=1;i<=n;i++){
        int a,b;scanf("%d%d",&a,&b);
        for(int j=a;j<max_n*2;j++)dp[j]=min(dp[j],dp[j-a]+b);
    }
    int ans=inf;
    for(int i=h;i<max_n*2;i++)ans=min(ans,dp[i]);
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
using namespace std;
const long long INF = 1000000100;
int w[110], v[110];
long long dp[110][100010];
int main() {
  int n, W;
  long long res=0;
  cin >> n >> W;
  for(int i=0; i<n; ++i) {
    cin >> w[i] >> v[i];
  }
  for(int i=0; i<110; ++i) for(int j=0; j<100010; ++j) dp[i][j] = INF;
  dp[0][0]=0;
  for(int i=0; i<n; ++i) for(int j=0; j<100010; ++j) {
    if(v[i]<=j) dp[i+1][j]=dp[i][j-v[i]]+w[i];
    dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
  }
  for(int i=100010-1;i>=0;--i) if(dp[n][i]<=W) {
    res=i;
    break;
  }
  cout << res << endl;
}


Measured memory_bytes: 86144
N = int(input())
nums = list(map(int, input().split()))

cumul = 1
if 0 in nums:
    print(0)
else:
    for i in range(N):
        cumul *= nums[i]
        if cumul > 10 ** 18:
            print(-1)
            break
    if cumul <= 10 ** 18: print(cumul)


Measured memory_bytes: 21644
import java.util.Scanner;

class Main{
	public static void main(String[] main) {

		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		long[] Ryca=new long[87];

		Ryca[0]=2;
		Ryca[1]=1;

		for(int i=2; i<87; i++) {
			Ryca[i]=Ryca[i-1]+Ryca[i-2];
		}

		System.out.println(Ryca[a]);
	}
}

Measured memory_bytes: 22732
// problem: "https://atcoder.jp/contests/abc160/tasks/abc160_a"

#include<bits/stdc++.h>

using namespace std;

int main()
{
    string s;
    cin>>s;

    if(s[2] == s[3] && s[4] == s[5])
        cout<<"Yes";
    else
        cout<<"No";

    return 0;
}


Measured memory_bytes: 256
// Problem : C - Multiplication 3
// Contest : AtCoder - AtCoder Beginner Contest 169
// URL : https://atcoder.jp/contests/abc169/tasks/abc169_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<long,long> pl;
typedef pair<ll,ll> pll;
typedef vector<long> vl;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef unordered_map<ll,ll> umll;

#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define REV(i,a,b) for(long long i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define tc ll tests;cin>>tests;while(tests--)
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define coutv(v) for(auto it: (v))cout<<it<<" ";newl;
#define cout2d(v) for(auto it: (v)) {for(auto j:it) cout<<j<<" ";newl;}
#define cinv(v,n) vll (v)(n);FOR(i,0,(n)){cin>>v[i];}
#define cinvg(v,n) (v).resize(n);FOR(i,0,(n)){cin>>v[i];}
#define cin2d(v,n,m) vvll (v)(n,vll(m,0));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define cin2dg(v,n,m) (v).resize(n,vll(m));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define newl cout<<"\n"
#define mod 1000000007
#define INF LLONG_MAX/2

int main()
{
    io;
    ll a,prd;
    long double b;
    
    cin>>a>>b;
    
    prd=(a*round(b*100))/100;
    cout<<prd;
    return 0;
}


Measured memory_bytes: 3784
import sys

def resolve():
    N = int(input())
    words = {"___": 0}
    for i in range(N):
        s = input()
        if s not in words:
            words[s] = 1
        else:
            words[s] += 1
    M = int(input())
    for i in range(M):
        t = input()
        if t not in words:
            words[t] = -1
        else:
            words[t] += -1
    print(max(words.values()))
    

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 38384
import java.util.*;
 
class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	String op = sc.next();
      	int b = sc.nextInt();
      	if(op.equals("+")){
          System.out.println(a + b);
        }else{
          System.out.println(a - b);
        }
    }
  
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define all(v) (v).begin(),(v).end()
#define pb push_back
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/

signed main(){
  int n;
  cin>>n;
  map<int,int> mp;
  vi A(n);
  rep(i,n){
    int a;
    cin>>a;
    mp[a]++;
    A[i]=a;

  }
  int ans=0;
  for(auto p:mp){
    int k=p.second;

    ans+=k*(k-1)/2;


  }
  rep(i,n){
    int m=mp[A[i]];

    cout<<ans-(m-1)<<endl;
  }
  return 0;
}


Measured memory_bytes: 12584
import java.util.*;


public class Main {
    public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            Map<String,Integer> map = new TreeMap<>();
            map.put("AC",0);
            map.put("WA",0);
            map.put("TLE",0);
           map.put("RE",0) ;
            while(n-->0){
                String s = sc.next();
                if(map.containsKey(s)){
                    map.put(s,map.get(s) + 1);
                }
            }
            System.out.println("AC x "+map.get("AC"));
            System.out.println("WA x "+map.get("WA"));
            System.out.println("TLE x "+map.get("TLE"));
            System.out.println("RE x "+map.get("RE"));

    }
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int n;
void dfs(int idx, string s, int k)
{
    if (idx==n){
        cout<<s<<"\n";
        return;
    }
    rep(i,k){
        dfs(idx+1,s+char('a'+i),k);
    }
    dfs(idx+1,s+char('a'+k),k+1);
}

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n;
    dfs(1,"a",1);
    return 0;
}


Measured memory_bytes: 1536