akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<double, double> P;
//typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

const ll mod = 1000000007;
const ll INF = 100000000000010000;

ll bit[1000010];
//ll kai[1000010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }

/*ll sum(ll i)
{
	i += 1;
	ll t = 0;
	while (i > 0)
	{
		(t += bit[i]) %= mod;
		i -= i & -i;
	}
	return t;
}

void add(ll i, ll x)
{
	i += 1;
	while (i <= 1000005)
	{
		(bit[i] += x) %= mod;
		i += i & -i;
	}
}*/

void test() {
	cout << "888888888888888888888888" << endl;
}

ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll y) {
	if (y == 0) return 1;
	if (y % 2 == 1) {
		return x * pow_mod(x, y - 1) % mod;
	}
	else {
		ll half = pow_mod(x, y / 2);
		return half * half % mod;
	}
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

/*ll com(ll x, ll y) {
	return kai[x] * div_mod(kai[y] * kai[x - y] % mod) % mod;
	//毎回オーダーlog(n)かかる
}

void kaijo() {
	kai[0] = 1;
	for (ll i = 1; i <= 1000005; i++) {
		kai[i] = kai[i - 1] * i % mod;
	}
}*/

ll N;
double value[301][301][301];
bool flg[301][301][301];
ll a[301];
ll num[4];

double saiki(ll one, ll two, ll three) {
	if (one == 0 && two == 0 && three == 0) {
		return 0;
	}
	if (flg[one][two][three]) {
		return value[one][two][three];
	}

	flg[one][two][three] = true;
	double nu = 0, move;
	move = 1.0 * N / (one + two + three);
	if (one > 0) {
		nu += (saiki(one - 1, two, three) + move) * one / (one + two + three);
	}
	if (two > 0) {
		nu += (saiki(one + 1, two - 1, three) + move) * two / (one + two + three);
	}
	if (three > 0) {
		nu += (saiki(one, two + 1, three - 1) + move) * three / (one + two + three);
	}
	value[one][two][three] = nu;
	return nu;
}

void solve() {
	cin >> N;
	rep(i, N) {
		cin >> a[i];
		num[a[i]]++;
	}
	printf("%.10lf\n", saiki(num[1], num[2], num[3]));
}

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

Measured memory_bytes: 241920
unittest
{
//	assert( [ "2 3", "1 2 3", "0 1 1" ].solve == "3\n2 2 2 3\n1 1 1 2\n1 3 1 2" );
	assert( [ "2 3", "1 2 3", "0 1 1" ].solve == "3\n1 1 1 2\n1 2 1 3\n2 3 2 2" );		// 別解
	assert( [ "3 2", "1 0", "2 1", "1 0" ].solve == "3\n1 1 1 2\n1 2 2 2\n3 1 3 2" );
	assert( [ "1 5", "9 9 9 9 9" ].solve == "2\n1 1 1 2\n1 3 1 4" );
}



import std.algorithm;
import std.conv;
import std.format;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto h = 0L;
	auto w = 0L;
	input.front.formattedRead!"%s %s"( h, w );
	auto ass = new long[][]( h, w );
	foreach( ref as; ass )
	{
		input.popFront;
		as = input.front.split.to!( long[] );
	}
	
	long[ 4 ][] anss;
	foreach( y; 0L .. ass.length.signed )
	{
		auto x = 0L;
		if( y % 2 )
		{
			// 右から左に移動
			for( x = ass[ y ].length.signed - 1; 0L < x; x-- )
			{
				if( ass[ y ][ x ] % 2 )
				{
					ass[ y ][ x ]--;
					ass[ y ][ x - 1 ]++;
					anss ~= [ 1 + y, 1 + x, 1 + y, 1 + x - 1 ];
				}
			}
		}
		else
		{
			// 左から右に移動
			for( x = 0L; x < ass[ y ].length.signed - 1; x++ )
			{
				if( ass[ y ][ x ] % 2 )
				{
					ass[ y ][ x ]--;
					ass[ y ][ x + 1 ]++;
					anss ~= [ 1 + y, 1 + x, 1 + y, 1 + x + 1 ];
				}
			}
		}
		
		// 下に移動
		if( y + 1 < ass.length && ass[ y ][ x ] % 2 )
		{
			ass[ y ][ x ]--;
			ass[ y + 1 ][ x ]++;
			anss ~= [ 1 + y, 1 + x, 1 + y + 1, 1 + x ];
		}
	}
	return format( "%s\n%s", anss.length, anss.map!( ( ans ) => ans.to!( string[] ).join( " " ) ).join( "\n" ) );
}


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

multiset<int> m;

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int t;
    cin >> t;
    auto it = m.lower_bound(t);
    if (it != m.begin()) {
      it--;
      m.erase(it);
    }
    m.insert(t);
  }
  cout << m.size() << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <set>
#include <cstdlib>
#include <queue>
#include <map>

using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint>> que;
//priority_queue<llint> q;

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

void solve(){
  int n,q;
  cin >> n >> q;
  string s;
  cin >> s;
  s="@"+s;
  int a[n];
  for(int i=0;i<n;i++){
    a[i]=a[i-1];
    if(s[i]=='A' && s[i+1]=='C')a[i]++;
  }
  int x,y;
  for(int i=0;i<q;i++){
    cin >> x >> y;
    cout << a[y-1]-a[x-1] << endl;
  }
}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


Measured memory_bytes: 1404
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<cmath>
#include<cstdio>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
using ll =long long;
using P = pair<int,int>;
int main(){
    long double a,b,c;
    cin >> a >> b >> c;
    long double eps = 1.0E-14;
    if(sqrt(a)+sqrt(b)+eps<sqrt(c))
        cout << "Yes" << endl;
    else 
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
def bin_search(arr, x):
    n = len(arr)
    left = 0
    right = n
    while left < right:
        m = (left + right) / 2
        key = arr[m]
        if key == x:
            return True

        if x < key:
            right = m
        elif x > key:
            left = m + 1

    return False


def solve():
    num_s = int(raw_input())
    s = map(int, raw_input().split(" "))
    num_t = int(raw_input())
    t = map(int, raw_input().split(" "))

    count = 0
    for x in t:
        if bin_search(s, x):
            count += 1

    print count


if __name__ == "__main__":
    solve()

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define INF 1000000000000000
#define MAX (int)(1e6)+1
#define MOD 1000000007

using namespace std;

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,int> pwi;
typedef pair<lli,lli> plli;
typedef vector<int> vi;
typedef vector<lli> vlli;
typedef vector< vector<pair<int,lli > > > wGraph;
typedef vector<vector<int> > graph;
//typedef vector<vector<int> > matrix;

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<std::fixed;
    cout<<std::setprecision(2);

    int n,me;
    cin>>n>>me;

    map<lli,int> m;
    set<int> s;
    priority_queue<pair<lli,int>> pq;
    rep(i,n){
        lli v;
        cin>>v;
        s.insert(v);
        if(m.find(v)!=m.end()){
            m[v]++;
        }else{
            m[v] = 1;
        }
    }

    rep(i,me){
        int qtd,v;
        cin>>qtd>>v;
        pq.push(mp(v,qtd));
    }

    while(!pq.empty()){

        lli v = pq.top().f;
        int qtd = pq.top().s;
        pq.pop();

        vi exclu;
        bool flag = false;
        for(auto k:s){
            if(flag) break;
            while(v>k && m[k]>0){
                qtd--;
                m[k]--;
                if(m.find(v)!=m.end()){
                    m[v]++;
                }else{
                    m[v] = 1;
                    s.insert(v);
                }
                if(m[k] == 0) exclu.pb(k);
                if(qtd == 0){
                    flag = true;
                    break;
                }
            }
            if(v<=k) break;
        }
        rep(i,exclu.size()){
            s.erase(exclu[i]);
        }
    }

    lli res = 0;
    for(auto k:m){
        res+=k.f*k.s;
    }

    cout<<res<<endl;

    return 0;

}


Measured memory_bytes: 16372
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
typedef long long ll;
typedef vector<ll> vl;
#define rp(i, f, t) for (long long int i = f; i < t; i++)
#define pr(i, f, t) for (long long int i = t - 1; i >= f; i--)
#define ca(n, a) rp(ca_i, 0, n) cout << a[ca_i] << ((ca_i == n - 1) ? "\n" : " ")
#define ia(n, a) rp(ia_i, 0, n) cin >> a[ia_i]
#define za(n, a) rp(za_i, 0, n) a[za_i] = 0
#define be(a) a.begin(), a.end()
#define ce(a) cout << (a) << endl
int main()
{
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    if (t * (v - w) >= llabs(a - b))
    {
        ce("YES");
    }
    else
    {
        ce("NO");
    }
}

Measured memory_bytes: 3636
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define fi first
#define se second

#define INF 2147483600

int main(){
  vector<int> cnt(26,0);
  string s;
  cin>>s;
  for(char c : s){
    cnt[c-'a']++;
  }

  rep(i,26) if(cnt[i]%2==1){
    cout<<"No"<<endl;
    return 0;
  }

  cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int w,h,x,y,r;
    scanf("%d%d%d%d%d",&w,&h,&x,&y,&r);
    
    
    if(x+r<=w && y+r<=h){
        if(x>=0 && y>=0){
            if(x+r>=0 && y+r>=0){
                printf("Yes\n");
            }else{
            printf("No\n");
            }
        }else{
            printf("No\n");
        }
    }else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 2112
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long originalMoney = 100;
    long goalMoney = sc.nextLong();

    int count = 0;
    boolean flg = true;

    while(flg) {
      originalMoney *= 1.01;
      count++;
      if(originalMoney >= goalMoney) {
        flg = false;
        System.out.println(count);
      }
    }
    sc.close();
  }
}

Measured memory_bytes: 35744
#include<iostream>
using namespace std;
int main() {
	int n, b, f, r, v, build[4][3][10] = { {{}} };
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> b >> f >> r >> v;
		build[b - 1][f - 1][r - 1] += v;
	}

	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 10; k++) {
				cout << " ";
				cout << build[i][j][k];
			}
			cout << endl;
		}
		if(i<3)cout << "####################" << endl;
	}
}


Measured memory_bytes: 3096
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    n = i_input()
    s = s_input()

    al=[chr(ord('a') + i) for i in range(26)]

    max_kind = 0
    for i in range(1,n):
        before_s = s[:i]
        after_s = s[i:]
        tmp_count = 0
        for check_s in al:
            if check_s in before_s and check_s in after_s:
                tmp_count += 1
        max_kind = max(max_kind, tmp_count)

    print(max_kind)

if __name__ == '__main__':
    main()


Measured memory_bytes: 68760
#include <cstdio>
#include <cstring>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

namespace my
{
	//-----------------------------------------------------------------------------
	inline char cn()
	{
		static char buf[1000010],*p1=buf,*p2=buf;
		return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
	}
	#define cn getchar
	template<class TY>void read(TY &x)
	{
		x=0;int f1=1;char ch=cn();
		while(ch<'0'||ch>'9'){if(ch=='-')f1=-1;ch=cn();}
		while(ch>='0'&&ch<='9')x=x*10+(ch-'0'),ch=cn(); x*=f1;
	}
	char Output[1000100],Zk[100];int op_top=0,Zk_top;
	void fcheck(int Type=0){if(Type||op_top>=1000000)fwrite(Output,1,op_top,stdout),op_top=0;}
	template<class TY>inline void write(TY x)
	{
		if(x==0){Output[op_top++]='0';fcheck();return;}
		if(x<0)Output[op_top++]='-',x=-x;
		Zk_top=0;while(x)Zk[++Zk_top]=x%10+'0',x/=10;
		while(Zk_top)Output[op_top++]=Zk[Zk_top--];fcheck();
	}
	#define K_G Output[op_top++]=' '
	#define H_C Output[op_top++]='\n'
	//--------------------------------------------------------------------------------------------
	
	//--------------------------------------------------------------------------------------------
	#define ll long long
	#define uint unsigned int
	#define ull unsigned long long
	#define INV(x) ksm(x,mod-2)
	#define inf 999999999
	#define mod 998244353
	
	template<class TY>void add(TY &x,TY y){x=(x+y>=mod?x+y-mod:x+y);}
	template<class TY>void dec(TY &x,TY y){x=(x-y<0?x-y+mod:x-y);}
	template<class TY>TY add(TY x){return x>=mod?x-mod:x;}
	template<class TY>TY dec(TY x){return x<0?x+mod:0;}
	//
	int ksm(int x,int y){int re=1;for(;(y&1?re=1ll*re*x%mod:0),y;y>>=1,x=1ll*x*x%mod);return re;}
	int *fac,*inv_fac,*inv;
	void work_math(const int N)
	{
		fac=new int[N+5];inv_fac=new int[N+5];inv=new int[N+5];
		inv[1]=1;for(int i=2;i<=N;i++)inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
		fac[0]=inv_fac[0]=1;for(int i=1;i<=N;i++)fac[i]=1ll*fac[i-1]*i%mod;
		inv_fac[N]=INV(fac[N]);
		for(int i=N-1;i>=1;i--)inv_fac[i]=1ll*inv_fac[i+1]*(i+1)%mod;
	}
	int C(int x,int y){return 1ll*fac[x]*inv_fac[y]%mod*inv_fac[x-y]%mod;}
	//
	template<class TY>TY gcd(TY x,TY y){return !y?x:gcd(y,x%y);}
	template<class TY>TY exgcd(TY a,TY b,TY &x,TY &y){
		if(!b)return x=1,y=0,a;
		TY re=exgcd(b,a%b,y,x);
		return y-=a/b*x,re;
	}
	//
	template<class TY>void discretization(TY *arr,int St,int Ed){
		vector<TY>Arr;Arr.clear();
		for(int i=St;i<=Ed;i++)Arr.push_back(arr[i]);
		sort(Arr.begin(),Arr.end());
		for(int i=St;i<=Ed;i++)arr[i]=lower_bound(Arr.begin(),Arr.end(),arr[i])-Arr.begin()+1;
	}
	//-----------------------------------------------------------------------------------------------
	
	//----------------------------------------------------------------------------------------------- 
	ll x,k,d;
	
	void main()
	{
		read(x);read(k);read(d);
		if(x<0)x=-x;
		ll p=x/d;
		if(k<=p)write(x-k*d);
		else{
			k-=p;x-=p*d;
			if(k%2)write(abs(x-d));
			else write(x);
		}
		fcheck(1);return;
	}
}

int main(){my::main();return 0;}

Measured memory_bytes: 3040
import math

n = int(raw_input())

class Point:
    def __init__(self):
        self.x = 0
        self.y = 0

th = math.pi/3.0

def koch(n, p1, p2):
    if n == 0:
        return
    s = Point()
    t = Point()
    u = Point()

    s.x = (2*p1.x + 1*p2.x) / 3.0
    s.y = (2*p1.y + 1*p2.y) / 3.0
    t.x = (1*p1.x + 2*p2.x) / 3.0
    t.y = (1*p1.y + 2*p2.y) / 3.0
    u.x = (t.x - s.x) * math.cos(th) - (t.y - s.y) * math.sin(th) + s.x
    u.y = (t.x - s.x) * math.sin(th) + (t.y - s.y) * math.cos(th) + s.y

    koch(n-1,p1,s)
    print s.x, s.y
    koch(n-1,s,u)
    print u.x, u.y
    koch(n-1,u,t)
    print t.x,t.y
    koch(n-1,t,p2)
    
def main():
    p1 = Point()
    p2 = Point()

    p1.x = 0.0
    p1.y = 0.0
    p2.x = 100.0
    p2.y = 0.0

    print p1.x, p1.y
    koch(n,p1,p2)
    print p2.x, p2.y

    return 0

main()

Measured memory_bytes: 6644
#include <stdio.h>

int main() {
	int N;
	scanf("%d", &N);
	char S[N+1];
	scanf("%s", S);
	int flag = 0;
	if (N % 2 == 1) printf("No\n");
	else {
		for (int i = 0; i < (N / 2); i++) {
			if (S[i] != S[(N / 2) + i]) {
				flag = 1;
				break;
			}
		}
		if (flag == 1) printf("No\n");
		else printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 128
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(_,v.size())cout<<" "<<v[_];cout<<endl;
#define show2d(v) rep(_,v.size()){rep(__,v[_].size())cout<<" "<<v[_][__];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU
ll n;
vi q;
class BIT{
	public:
	//[1,i]
	int n;
	vi bit;
//	int bit[MAZ_N+1];
	BIT(int size){
		n=size;
		bit=vi(n+1);
	}
	Def query(int i){//sum
		Def s=0;
		while(i>0){
			s+=bit[i];
			i-=i&-i;
		}
		return s;
	}
	void add(int i,Def x){
		while(i<=n){
			bit[i]+=x;
			i+=i&-i;
		}
	}
};
ll f(int a){
	vp in(n+1);
	rep(i,n+1)in[i].second=i;
	rep(i,n)if(q[i]>=a)in[i+1].first=1;
	else in[i+1].first=-1;
	
	rep(i,n)in[i+1].first+=in[i].first;
	sort(all(in));
	ll co=0;
	BIT bit(n+1);
	rep(i,n+1){
		co+=bit.query(in[i].second+1);
		bit.add(in[i].second+1,1);
	}
	// cout<<a<<" "<<co<<endl;
	// rep(i,n+1)cout<<in[i].first<<" "<<in[i].second<<endl;
	return co;
}
int main(){
	cin>>n;
	q=vi(n);
	rep(i,n)cin>>q[i];
	if(n==1){
		cout<<q[0]<<endl;
		return 0;
	}
	
	int l=0,r=1000000010;
	while(r-l>1){
		int h=(l+r)/2;
//		cout<<h<<" "<<f(h)<<endl;
		if(f(h)>=n*(n+1)/2/2)l=h;
		else r=h;
	}

	cout<<l<<endl;
	
}






Measured memory_bytes: 3420
#include <iostream>
#include <algorithm>
#include <string>
#include <functional> 
#include <vector>
#include <numeric>
#include <stack>
#include <queue>
#include <utility>
//#include <cmath>
#include <cstdlib>

using namespace std;

int main(){

    int n,m;
    cin >> n >> m;

    vector<int> from1(200002,0);
    vector<int> toN(200002,0);

    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        if(a == 1 ) from1[b] = 1;
        if(b == n) toN[a] = 1;
    }

    for(int i=1;i<=n;i++){
        if(from1[i]*toN[i] == 1){
            cout << "POSSIBLE";
            return 0;
        }
    }
    cout << "IMPOSSIBLE" ;


    
    return 0;
}

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

int main()
{
    int n, k;
    cin >> n >> k;
    vector<long long> x(n);
    for(int i=0; i<n; ++i)
        cin >> x[i];

    long long ans = LLONG_MAX;
    for(int i=0; i<=n-k; ++i){
        int j = i + k - 1;
        if(x[j] < 0){
            ans = min(ans, -x[i]);
        }
        else if(0 < x[i]){
            ans = min(ans, x[j]);
        }
        else{
            ans = min(ans, x[j] - x[i] * 2);
            ans = min(ans, x[j] * 2 - x[i]);
        }
    }
    cout << ans << endl;

    return 0;
}


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

#define int long long int
#define pb push_back
#define M 1000000007
#define ff first
#define ss second
#define deb(x) cout< #x< " "< x< endl;
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<=n;i++)
#define FORR(a,b,c) for(int a= b;a>=c;a--)
#define fa(arrr) for(auto x:arrr)
#define iPair pair<int, pair<int,int>>
#define sz size()
// #define mp make_pair
#define mxm3(a,b,c) max(a, max(b,c))
#define mi3(a,b,c) min(a, min(b,c))
#define mxn 500005
#define PII pair<int,int>
#define aint(v) v.begin(), v.end()
#define endl "\n"
// #define N 1000
#define C 4
#define nfs ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
// Ordered Set Tree
// typedef tree<PII, null_type, less<PII>,
//         rb_tree_tag,
//         tree_order_statistics_node_update>
//         oset;
#define db(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

int fact[1005];

int power(int x, int y) {
	int res = 1;
	while (y) {
		if (y & 1) res = res * x % M;
		x = (x * x) % M;
		y = y / 2;
	}
	return res;
}


int modInv(int n) {
	return power(n, M - 2);
}
void facto() {
	fact[0] = 1;
	fact[1] = 1;
	for (int i = 2; i <= 1000; i++)
		fact[i] = (i * fact[i - 1]) % M;
}

int fermat(int n, int r) {
	return (fact[n] * modInv(fact[r]) % M * modInv(fact[n - r]) % M) % M;
}

int N;
int dx[] = { -1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
int vis[1000][1000];

bool isVaild(int x, int y) {
	if (x < 1 || x > N || y < 1 || y > N) return false;
	if (!vis[x][y]) return true;
	return false;
}



void solve() {
	int n, k;
	cin >> n >> k;
	vector<int>arr(n + 1), dp(n + 1, INT_MAX);
	for (int i = 1; i <= n; i++)
		cin >> arr[i];
	dp[1] = 0;
	for(int i = 2;i<=n;i++){
		for(int j = 1;j<=k;j++){
			if(i-j>=0)dp[i] = min(dp[i], dp[i-j] + abs(arr[i]-arr[i-j]));
		}
	}
	cout << dp[n] << endl;
}


int32_t main()
{


	nfs;
	int t;
	// facto();
	// cin >> t;
	t = 1;
	while (t--) {
		solve();
	}

	return 0;
}

Measured memory_bytes: 1792
import sys
import math
import string
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
from bisect import bisect, bisect_left, bisect_right

MOD = 10 ** 9 + 7
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 8)


def Nc2(n):
    return n * (n - 1) // 2


N = int(input())
A = list(map(int, input().split()))
AA = sorted(A)
num = [0] * (N + 10)
num2 = [0] * (N + 10)
val = 0
for i in range(N - 1):
    if AA[i] == AA[i + 1]:
        val += 1
    else:
        val += 1
        num[AA[i]] = Nc2(val)
        num2[AA[i]] = val
        val = 0
    if i == N - 2:
        val += 1
        num[AA[i + 1]] = Nc2(val)
        num2[AA[i + 1]] = val
summ = sum(num)
for i in range(N):
    print(summ - num[A[i]] + Nc2(num2[A[i]] - 1))


Measured memory_bytes: 28736
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F0(i,n) for (int i = 0; i < n; i++)
#define F1(i,n) for (int i = 1; i <= n; i++)
#define CL(a,x) memset(x, a, sizeof(x));
#define SZ(x) ((int)x.size())
const double eps = 1e-10;
const int inf = 1000000009;
int i, j, k, m, n, l;
int ans;
int cnt[100001], can[100001];

int main() {
	//freopen("x.in", "r", stdin);

	cin >> n >> m;
	F1(i, n) {
		cnt[i] = 1;
	}
	can[1] = 1;
	while (m--) {
		cin >> i >> j;
		if (can[i]) can[j] = 1;
		if (cnt[i] == 1) can[i] = 0;
		cnt[i]--;
		cnt[j]++;
	}
	ans = 0;
	F1(i, n) if (can[i]) ans++;
	cout << ans << endl;

	return 0;
}


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

int main(){
  int K,A,B;cin >> K >> A >> B;
  for(int i=A;i<=B;i++){
    if(i%K==0){
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
}

Measured memory_bytes: 3616
#include<stdio.h>

#define MAX 101
#define WHITE 0
#define BLACK 1
#define INF 2001
#define NIL -1

int G[MAX][MAX],a,b[MAX],p[MAX],c[MAX];

void prim(int);

int main()
{
  int i,j,sum=0;
  
  scanf("%d",&a);
  
  for(i=1;i<=a;i++){
    for(j=1;j<=a;j++){
      scanf("%d",&G[i][j]);
    }
  }
  
  prim(1);
  
  for(i=1;i<=a;i++){
    //printf("%d %d %d\n",G[i][p[i]],b[i],p[i]);
    
    sum+=b[i];
  }
  
  printf("%d\n",sum);
  
  return 0;
}


void prim(int s)
{
  int i;
  
  for(i=1;i<=a;i++){
    b[i]=INF;
    p[i]=NIL;
  }
  
  b[s]=0;
  
  while(1){
    int r,mincost=INF;
    
    for(i=1;i<=a;i++){
      if(c[i]!=BLACK && b[i]<mincost){
	mincost = b[i];
	r = i;
      }
    }

    if(mincost==INF)break;
    
    //printf("min:%d\n",mincost);
    
    c[r]=BLACK;    

    for(i=1;i<=a;i++){
      if(c[i]!=BLACK && G[r][i]<b[i] && G[r][i]!=-1){
	p[i] = r;
	b[i] = G[r][i];
      }
    }
  }
}



Measured memory_bytes: 2112
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static class Query{
		private int left;
		private int right;
		private int ans;

		public Query(int left, int right) {
			this.left = left;
			this.right = right;
			this.ans = 0;
		}

		public void execute(int num) {
			if(left <= num && right >= num) {
				ans++;
			}
		}

		public int getLeft() {
			return this.left;
		}

		public int getRight() {
			return this.right;
		}

		public int getAns() {
			return this.ans;
		}
	}


	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		Scanner in = new Scanner(System.in);

		int Q = in.nextInt();
		int min = 100000;
		int max = 0;

		ArrayList<Query> array = new ArrayList<Query>(Q);

		for(int i=0; i<Q; ++i) {
			int left = in.nextInt();
			int right = in.nextInt();
			array.add(new Query(left, right));
			if(min > left) {
				min = left;
			}
			if(max < right) {
				max = right;
			}
		}

		for(int i=min; i <= max; ++i) {
			if(checkLike2017(i)) {
				// System.out.println("numA: " + i + " numB: " + (i + 1) / 2);
				for(Query q : array) {
					q.execute(i);
				}
			}
		}


		for(Query q : array) {
			System.out.println(q.getAns());
		}
	}

	public static boolean checkLike2017(int numA) {
		if(numA < 3) {
			return false;
		}

		int numB = (numA + 1) / 2;
		if(checkPrimeNum(numB)) {
			return checkPrimeNum(numA);
		}else {
			return false;
		}
	}

	public static boolean checkPrimeNum(int num) {
		if(num == 2 || num == 3) {
			return true;
		}else if(num % 2 == 0 || num % 3 == 0) {
			return false;
		}

		int root = (int) Math.sqrt(num);
		for(int i=4; i<= root; ++i) {
			if(num % i == 0) {
				return false;
			}
		}

		return true;
	}

}


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

using ll = long long int;
using P = std::pair<int, int>;
using T = std::pair<int, P>;

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

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

int n;

P conv(int m)
{
    return (m % n == 0) ? P(m / n - 1, n - 1) : P(m / n, m % n - 1);
}

int main()
{

    std::cin >> n;

    std::vector<std::vector<int>> dists(n, std::vector<int>(n));

    rep(x, n)
    {
        rep(y, n)
        {
            dists[x][y] = std::min({x, y, n - x - 1, n - y - 1});
        }
    }

    std::vector<std::vector<bool>> emp(n, std::vector<bool>(n, 1));

    int ans = 0;

    rep(i, n * n)
    {
        int in;
        std::cin >> in;
        P out = conv(in);

        ans += dists[out.first][out.second];

        emp[out.first][out.second] = 0;

        std::priority_queue<T> que;

        que.emplace(dists[out.first][out.second], out);

        while (!que.empty())
        {
            int cost, x, y;
            P in;
            std::tie(cost, in) = que.top();
            std::tie(x, y) = in;
            que.pop();

            if (dists[x][y] < cost)
                continue;

            rep(j, 4)
            {
                int nx = x + dx[j], ny = y + dy[j];

                if (nx < 0 || nx >= n || ny < 0 || ny >= n)
                    continue;

                if (dists[nx][ny] > cost + emp[x][y])
                {
                    dists[nx][ny] = cost + emp[x][y];

                    que.emplace(dists[nx][ny], P(nx, ny));
                }
            }
        }
    }

    std::cout << ans << std::endl;

    return 0;
}

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

int main() {
    int n,q,typ, l , r ,idx,cnt;
    vector<map<int,int> > vchi(26);
    std::map<int,int>::iterator itlow,itup;
    char ch;
    string s;
    cin>>n>>s>>q;
    for(int i=0;i<n;i++)
    {
        vchi[s[i]-'a'][i]=1;
    }
    for(int i=0;i<q;i++)
    {
        cin>>typ;
        if(typ==1)
        {
            //replace
            cin>>idx>>ch;
            idx--;
            if(s[idx]!=ch)
            {
                vchi[s[idx]-'a'].erase(idx);
                vchi[ch-'a'][idx]=1;
                s[idx]=ch;
            }
        }
        else
        {
            //query
            cin>>l>>r;
            l--;
            r--;
            cnt=0;
            for(int j=0;j<26;j++)
            {
                itlow=vchi[j].lower_bound(l);
                itup =vchi[j].upper_bound(r);
                if(distance(itlow,itup))
                {
                    cnt++;
                }
            }
            
            cout<<cnt<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 24196
#include<bits/stdc++.h>
using namespace std;
const int MAX = 1000000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
  COMinit();

  long long X,Y;cin>>X>>Y;
  if((X+Y)%3==0){
    long long a=(X+Y)/3;
    if(a<=X && a<=Y){
      cout<<COM(a,X-a)%MOD<<endl;
      return 0;
    }
  }
  cout<<0<<endl;
}

Measured memory_bytes: 23680
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9


int main(){
	int a,b;
	cin>>a>>b;
	int n;
	cin>>n;
	bool f = false;
	for(int i=0;i<n;i++){
		int s,t;
		cin>>s>>t;
		if(s<=a&&a<t|| s<b&&b<=t|| a<=s&&t<=b ) f = true; 
	}
	if(f){
		cout<<1<<endl;
	}else{
		cout<<0<<endl;
	}
	

	return 0;
}



Measured memory_bytes: 3108
import io
import sys
MOD = 10 ** 9 + 7

def IN_S():
  return input()


def IN_I():
  return int(input())


def IN_L_I():
  return list(map(int, input().split()))


def IN_L_S():
  return list(map(str, input().split()))


def STR_SPLIT(s, n):
  for l in range(0, len(s), n):
    yield s[0 + l:n + l]


def T_IN():
  global test_str
  sys.stdin = io.StringIO(test_str[1:-1])


test_str = '''
3
200 200 200
'''


def MAIN():
  # T_IN()
  A()


def A():
  n = IN_I()
  nums = IN_L_I()
  t = 0
  for num in nums:
    t += 1 / num
  
  print (1 / t)
  return None


def B():
  return None


def C():
  return None


MAIN()


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

int main(){
	long long a, b, c, jShu = 0x3f3f3f3f3f3f3f3f;
	cin >> a >> b >> c;
	if(a%2 && b*c < jShu) jShu = b*c;
	if(!(a%2)) jShu = 0;
	
	if(b%2 && a*c < jShu) jShu = a*c;
	if(!(b%2)) jShu = 0;
	
	if(c%2 && a*b < jShu) jShu = a*b;
	if(!(c%2)) jShu = 0;
	
	cout << jShu << endl;
}

Measured memory_bytes: 256
from collections import OrderedDict

number = int(input())
character_number = OrderedDict()

for i in range(number):
    name, number = input().split()
    if name in character_number:
        tmp_dict = character_number[name]
        tmp_dict[int(number)] = i + 1
        character_number[name] = tmp_dict
    else:
        number_dict = OrderedDict()
        number_dict[int(number)] = i + 1
        character_number[name] = number_dict

sort_character_number = OrderedDict(sorted(character_number.items(), key = lambda x:x[0]))

resort_dict = {}
for k, v in sort_character_number.items():
    resort_dict[k] = OrderedDict(sorted(v.items(), key = lambda x:x[0], reverse=True))

sort_character_number = OrderedDict(sorted(resort_dict.items(), key = lambda x:x[0]))

for k, v in sort_character_number.items():
    for k_2, v_2 in v.items():
        print(v_2)

Measured memory_bytes: 38384
#include <cstdio>
#include <algorithm>
#include <vector>
#include <iostream>
#include <set>
#define REP(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

int vs[200000+10];
bool isNotOK[1000000+10];

int main(void) {
  int n;
  scanf("%d", &n);
  REP(i, n) {
    scanf("%d", &vs[i]);
  }
  sort(vs, vs + n);
  REP(i, n) {
    if(i > 0 && vs[i] == vs[i-1]) {
      isNotOK[vs[i]] = true;
      continue;
    }
    for(int j = vs[i]*2; j <= 1000000; j += vs[i]) {
      isNotOK[j] = true;
    }
  }
  int res = 0;
  REP(i, n) {
    if(!isNotOK[vs[i]]) {
      ++res;
    }
  }
  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 4948
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
typedef long long ll;
ll H;
unordered_map <ll, ll> mp;
ll hits(ll health){
    if (health == 1LL) return mp[1] = 1;
    if (mp.find(health) != mp.end()) return mp[health];
    return mp[health] = 2*hits(health/2)+1LL;
}

int main() {
    cin >> H;
    cout << hits(H) << endl;
    return 0;
}


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



int main() {

    int n,a,b; cin >> n >> a >> b;
    int ans = 0;

    for(int i = 1; i <= n; i++) {
        int tmp = i,sum = 0;

        while(tmp > 0) {
            sum += tmp%10;
            tmp /= 10;
        }

        if(sum >= a && sum <= b) ans+= i;
    }

    cout << ans << endl;

    return 0;
}





Measured memory_bytes: 3608
#include <iostream>
using namespace std;
typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main()
{
	char w[100]; cin >> w;
	ll b[26] = {};
	ll i = 0;
	while (w[i]) {
		b[w[i] - 'a']++;
		i++;
	}
	rep(i, 0, 26) {
		if (b[i] % 2 == 1) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void) {
    int n, ys = 0;
    double a, bs = 0.0, sum = 0.0;
    char s[4];

    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        scanf("%lf %s", &a, s);

        if (strcmp(s, "JPY") == 0) {
            ys = ys + a;
        } else {
            bs = bs + a;
        }
    }

    bs = bs * 380000;

    sum = ys + bs;

    printf("%f\n", sum);

    return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int n,a[200010],b[200010],c[200010],d[200010],z[600010];
vector <int> s;

void calcZ()
{
	int lb=0,ub=0;
	repn(i,s.size()-1)
	{
		if(s[i]!=s[0]) continue;
		if(i>ub)
		{
			int p=i;
			while(p<s.size()&&s[p]==s[p-i]) p++;
			lb=i;
			ub=p-1;
			z[i]=p-i;
		}
		else
		{
			int j=i-lb;
			if(j+z[j]-1<ub-lb) z[i]=z[j];
			else
			{
				int p=ub+1;
				while(p<s.size()&&s[p]==s[p-i]) p++;
				z[i]=p-i;
				lb=i;
				ub=p-1;
			}
		}
	}
}

int main()
{
	cin>>n;
	rep(i,n) scanf("%d",&a[i]);
	rep(i,n) scanf("%d",&b[i]);
	rep(i,n-1)
	{
		c[i]=a[i]^a[i+1];
		d[i]=b[i]^b[i+1];
	}
	c[n-1]=a[0]^a[n-1];
	d[n-1]=b[0]^b[n-1];
	rep(i,n) s.pb(d[i]);
	s.pb(-1e9);
	rep(i,2) rep(j,n-i) s.pb(c[j]);
	calcZ();
	for(int i=n+1;i<s.size();i++)
	{
		if(z[i]<n) continue;
		cout<<i-n-1<<' '<<(a[i-n-1]^b[0])<<endl;
	}
	return 0;
}

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

int main() {
    
    int N;
    cin >> N ;
    int P[N];
    int Q[N];

    rep(i,N){
        cin >> P[i];
    }

    rep(i,N){
        cin >> Q[i];
    }

    vector<int> one_case_p;
    for (int i = 0; i < N; i++) { // one_case = {0,1,2,3,...n-1} とする
        one_case_p.emplace_back(P[i]);
    }

    vector<int> one_case_q;
    for (int i = 0; i < N; i++) { // one_case = {0,1,2,3,...n-1} とする
        one_case_q.emplace_back(Q[i]);
    }


    int rep_p = 0;
    do {
        rep_p += 1;
    } while (next_permutation(one_case_p.begin(), one_case_p.end()));

    int rep_q = 0;
    do {
        rep_q += 1;
    } while (next_permutation(one_case_q.begin(), one_case_q.end()));

    int ans = abs(rep_p - rep_q);

    cout << ans << endl;

}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define V vector
#define pb push_back
#define mp make_pair
#define endl "\n"
#define db(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define MOD 1000000007  //1e9+7

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void solve()
{
	string s; cin>>s;
	if(s.length()<5){
		cout<<"No"<<endl;
		return;
	}
	if(s[2]==s[3] && s[4]==s[5]) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}
	
int32_t main()
{
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    //int t; cin>>t;
    //while(t--)
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    string str;
    while(cin>>str){
        if(str=="ABC")cout<<"ARC"<<endl;
        else cout<<"ABC"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <random>
#include <chrono>
#include <algorithm>
#define rep(i, x) for(ll i = 0; i < x; i++)
using namespace std;
typedef long long ll;
const ll MOD = (ll)1e9+7;
const ll N = 5e5+5, inf = 1e9+5000;
ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; }
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; }
ll mult(ll x, ll y) { return (x * y) % MOD; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

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

  string s; cin >> s;
  s.push_back('S');
  int cnt = 0;
  int ans = 0;
  for (char c : s) {
    if (c == 'R') cnt++;
    else {
      ans = max(ans, cnt);
      cnt = 0;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
    string s;
    cin >> s;
    int n = s.length();
    bool flag = false;
    for (int i = 0; i <= 7; ++i)
    {
        if (s.substr(0, i) + s.substr(n - (7 - i)) == string("keyence"))
            flag = true;
    }
    cout << (flag ? "YES" : "NO") << endl;
    return 0;
}

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

using namespace std;

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

    int ans;
    ans = b / a; //聞ける回数
    if(ans >= c){
        cout << c << endl;
    }
    else{
        cout << ans << endl;

    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;

signed main(){
    fastio
    int n;cin>>n;
    int a[n];
    for(int i=0;i<n;i++)    cin>>a[i];
    int i;
    for(i=0;i<n;i++){
        if(a[i]%2==0){
            if(a[i]%3==0 || a[i]%5==0){
            }else   break;
        }
    }
    if(i==n)    cout<<"APPROVED";
    else        cout<<"DENIED";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define SZ 666666
int n,t[SZ],qs[SZ];
ll qz[SZ],hz[SZ],su[SZ];
#define y_(p) f[p]+su[p]-p+(ll)p*p
#define y(p) (y_((p)))
#define ck(a,b) ((y(a)-y(b))/ld((a)-(b)))
void dp(ll* f)
{
	for(int i=1;i<=n;++i) su[i]=su[i-1]+t[i];
	int h=0,t=0;
	for(int i=0;i<=n;++i)
	{
		if(i)
		{
			while(t-h>=2&&ck(qs[t-2],qs[t-1])<i+i) --t;
			int j=qs[t-1]; f[i]=f[j]+(i-j)*(ll)(i-j+1)-su[i]+su[j];
			f[i]=max(f[i],f[i-1]);
		}
		while(t-h>=2&&ck(qs[t-2],qs[t-1])<ck(qs[t-1],i)) --t;
		qs[t++]=i;
	}
}
ll bx[SZ],tmp[SZ],*f;
void fz(int l,int r)
{
	if(l==r) return;
	int m=(l+r)>>1; fz(l,m); fz(m+1,r);
	int h=0,t=0;
	for(int i=l-1;i<=m-1;++i)
	{
		while(t-h>=2&&ck(qs[t-2],qs[t-1])<ck(qs[t-1],i)) --t;
		qs[t++]=i;
	}
	for(int i=m+1;i<=r;++i)
	{
		while(t-h>=2&&ck(qs[t-2],qs[t-1])<i+i) --t; int j=qs[t-1];
		tmp[i]=f[j]+(i-j)*(ll)(i-j+1)-su[i]+su[j]+hz[i+1];
	}
	for(int i=r-1;i>=m+1;--i) tmp[i]=max(tmp[i],tmp[i+1]);
	for(int i=m+1;i<=r;++i) bx[i]=max(bx[i],tmp[i]);
}
void fzr(int l,int r)
{
	if(l==r) return;
	int m=n-((n-l+n-r)>>1); fzr(l,m-1); fzr(m,r);
	int h=0,t=0;
	for(int i=l-1;i<=m-2;++i)
	{
		while(t-h>=2&&ck(qs[t-2],qs[t-1])<ck(qs[t-1],i)) --t;
		qs[t++]=i;
	}
	for(int i=m;i<=r;++i)
	{
		while(t-h>=2&&ck(qs[t-2],qs[t-1])<i+i) --t; int j=qs[t-1];
		tmp[i]=f[j]+(i-j)*(ll)(i-j+1)-su[i]+su[j]+qz[i+1];
	}
	for(int i=r-1;i>=m;--i) tmp[i]=max(tmp[i],tmp[i+1]);
	for(int i=m;i<=r;++i) bx[i]=max(bx[i],tmp[i]);
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
		scanf("%d",t+i),t[i]*=2;
	dp(qz);
	reverse(t+1,t+1+n);
	reverse(qz+1,qz+1+n);
	dp(hz); f=hz;
	for(int i=1;i<=n;++i) bx[i]=2-t[i]+hz[i-1]+qz[i+1];
	fzr(1,n);
	reverse(t+1,t+1+n);
	reverse(qz+1,qz+1+n);
	reverse(hz+1,hz+1+n);
	reverse(bx+1,bx+1+n);
	for(int i=1;i<=n;++i) su[i]=su[i-1]+t[i];
	f=qz; fz(1,n);
	int m; scanf("%d",&m);
	while(m--)
	{
		int l,r;
		scanf("%d%d",&l,&r);
		ll ans=max(qz[l-1]+hz[l+1],bx[l]+t[l]-r*2);
		printf("%lld\n",ans/2);
	}
}


Measured memory_bytes: 29184
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<algorithm>
#include<unordered_map>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>*/
//#include<ext/rope>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;
const double PI=acos(-1.0);
const double eps=1e-6;
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
signed main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
int k=read();
while(k--) printf("ACL");
    return 0;
}


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

int main(){
    int n,m;
    int matrix[100][100];
    int rows[100];
    int result = 0;
    cin >> n >> m;
    
    for (int x = 0; x < n;x++) {
        for (int y = 0; y < m; y++){
            matrix[x][y] = 0;       
        }
    }
    
    for (int x = 0; x < m; x++) {
        rows[x] = 0;
    }
    
    for (int x = 0; x < n;x++) {
        for (int y = 0; y < m; y++){
            cin >> matrix[x][y];
        }
    }
    
    for (int x = 0; x < m; x++) {
        cin >> rows[x];
    }
    
    for (int x = 0; x < n;x++) {
        for (int y = 0; y < m; y++){
            result += matrix[x][y] * rows[y];
        }
        cout << result << endl;
        result = 0;
    }
    
    
    
   
    return 0;
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(int argc, char const *argv[]) {
  ll n;
  cin>>n;
  ll b[n-1];
  ll ans=0;
  ll sum=0;
  for (size_t i = 0; i < n-1; i++) {
    /* code */
    cin>>b[i];
  }
  ans+=b[0];
  for (size_t i = 0; i < n-2; i++) {
    /* code */
    ll xx=(min(b[i],b[i+1]));
    ans+=xx;
  }
  ans+=b[n-2];
  cout<<ans<<"\n";
  return 0;
}


Measured memory_bytes: 256