akhauriyash/Code-Regression huggingface dataset:
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: u32,
        t: i32,
        a: i32,
        h: [i32; n],
    };
    println!(
        "{}",
        h.iter()
            .map(|x| (1000 * a - (1000 * t - 6 * x)).abs())
            .enumerate()
            .min_by_key(|&(_, v)| v)
            .unwrap()
            .0
            + 1
    );
}


Measured memory_bytes: 4352
#include <bits/stdc++.h> 
using namespace std; 
typedef long long int lli;
typedef vector<vector<lli> > vlli;
lli N, K;
int dfs(int i, int N, vector<vector<int> > & A, int choosen, vector<vector<int> > &M){
	if(i==N) return 0;
	if(i>N) return INT_MIN;
	if(M[i][choosen]!=-1) return M[i][choosen];
	if(choosen==0)
		return M[i][choosen]=max(A[i][1]+dfs(i+1, N, A, 1, M), A[i][2]+dfs(i+1, N, A, 2, M));
	if(choosen==1)
		return M[i][choosen]=max(A[i][0]+dfs(i+1, N, A, 0, M), A[i][2]+dfs(i+1, N, A, 2, M));
	if(choosen==2)
		return M[i][choosen]=max(A[i][0]+dfs(i+1, N, A, 0, M), A[i][1]+dfs(i+1, N, A, 1, M));
}
int main() 
{ 
    cin>>N;
    vector<vector<int> > A(N, vector<int>(3));
    vector<vector<int> > M(N+1, vector<int>(3, -1));
    for (int i = 0; i < N; ++i)
    {
    	for (int j = 0; j < 3; ++j)
    	{
    		cin>>A[i][j];
    	}
    }
    lli a = A[0][0]+dfs(1, N, A, 0, M);
    lli b = A[0][1]+dfs(1, N, A, 1, M);
    lli c = A[0][2]+dfs(1, N, A, 2, M);
    cout<<max(a,max(b,c));
    return 0; 
}

Measured memory_bytes: 18944
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
static string[] input = Console.ReadLine().Split(' ');
static long r = long.Parse(input[0]);//行数
static long c = long.Parse(input[1]);//列数
static long[] startPosition = new long[2];//スタート座標
static long[] goalPosition = new long[2];//ゴール座標
static long[,] distances = new long[r,c];//最短距離
static Queue<long[]> que = new Queue<long[]>();//幅優先探索用のキュー
static long[,] wallPositions = new long[r+2,c+2];//壁は1
static long[] VectorArrow = new long[8]{0,1,0,-1,1,0,-1,0};//上下左右に進む為のベクトル
static long wallCount = 0;

	static void Main()
	{  
    startPosition[0] = 0;//1-index
    startPosition[1] = 0;
    goalPosition[0] = r-1;
    goalPosition[1] = c-1;
  
		for(long i = 0; i < r; i++)
    {
      string inputc = Console.ReadLine();
      for(long j = 0; j < c; j++)
      {
        if(inputc[(int)j] == '#')
        {
          wallPositions[i+1,j+1] = 1;//壁の取得
          wallCount++;
        }
      }
    }

    for(long i = 0; i < r+2; i++)//周囲を壁で埋める
    {
      wallPositions[i,0] = 1;
      wallPositions[i,c+1] = 1;
    }
    for(long j = 0; j < c+2; j++)
    {
      wallPositions[0,j] = 1;
      wallPositions[r+1,j] = 1;
    }
    
		BFS(startPosition);//幅優先探索
	}

  static void BFS(long[] startPosition)//幅優先探索。引数はスタートの座標。
  {
    que.Enqueue(startPosition);
    for(long i = 0; i < r; i++)
    {
      for(long j = 0; j < c; j++)
      {
        distances[i,j] = long.MaxValue;//距離を無限と仮定
      }
    }
    
    distances[startPosition[0], startPosition[1]] = 0;//スタート地点までの距離は0
    long poppedMemoX = 0;
    long poppedMemoY = 0;
    while(que.Count > 0)
    {
      poppedMemoX = que.Peek()[0];
      poppedMemoY = que.Peek()[1];
      que.Dequeue();
    
      for(long partnerNum = 0; partnerNum < 4; partnerNum++)//上下左右に進みたい
      {
        long aimX = poppedMemoX+VectorArrow[2*partnerNum];
        long aimY = poppedMemoY+VectorArrow[2*partnerNum+1];
        if(wallPositions[aimX+1, aimY+1] == 1) continue;//壁なら無視
        if(distances[aimX, aimY] != long.MaxValue) continue;//距離が確定済みなら無視
        distances[aimX, aimY] = distances[poppedMemoX, poppedMemoY] + 1;//距離の加算
        que.Enqueue(new long[2]{aimX, aimY});
      }
    }
      /*
      for(long i = 0; i < r; i++)//各点までの距離の表示
      {
        string answer = "";
        for(long j = 0; j < c; j++)
        {
          if(wallPositions[i+1,j+1] == 1) answer += "#";
          else answer += distances[i,j].ToString();
        }
        Console.WriteLine(answer);
      }
      */

      long answer = distances[goalPosition[0], goalPosition[1]];
      if(answer == long.MaxValue)
      {
        Console.WriteLine(-1);
      }else
      {
        answer = r*c-answer-wallCount-1;
        Console.WriteLine(answer);
      }
  }
}

Measured memory_bytes: 13396
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <climits>
#include <bitset>
#include <cmath>

#define MOD 1000000007

using namespace std;

typedef long long ll;

typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<vl> vvl;
typedef vector<vi> vvi;

typedef pair<ll, ll> pll;
typedef pair<int, int> pi;

typedef vector<pll> vpl;
typedef vector<pi> vpi;

typedef queue<ll> ql;
typedef queue<int> qi;

template <class T>
void printv(vector<T> vc)
{
    for (auto e : vc)
        cout << e << " ";
    cout << endl;
}

template <class T>
void printvv(vector<T> vvc)
{
    for (auto vc : vvc)
    {
        for (auto e : vc)
            cout << e << " ";
        cout << endl;
    }
}

template <class T>
void printvp(vector<pair<T, T>> vp)
{
    for (auto pT : vp)
        cout << pT.first << " " << pT.second << endl;
}

int main()
{
    int a, b;
    cin >> a >> b;
    auto ans = a*b % 2 == 1 ? "Odd" : "Even";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	int product=0;
	product=a*b;
	if(product%2==0)
		cout<<"Even"<<endl;
	else
		cout<<"Odd"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

struct D{
	int cost;
	vector<int> e;
	D():cost(INT_MAX), e(26, -1) {}
};

void addtr(vector<D>& tr, int tri[50][20], int si, string s, int c, bool rev){
	int cur=0;
	rep(j, s.size()){
		int sj= rev?(s.size()-1-j):j;
		int ci=s[sj]-'a';
		int nxt=tr[cur].e[ci];
		if(nxt== -1){
			tr.push_back(D());
			nxt=tr[cur].e[ci]=tr.size()-1;
		}
		tri[si][sj]=nxt;
		cur=nxt;
	}
	tr[cur].cost= min(tr[cur].cost, c);
}

ll mm[1000][1000];
vector<int> ssame[1000][1000];

int main(){
	int n;
	cin>>n;
	vector<string> s(n);
	vector<int> c(n);
	rep(i, n) cin>>s[i]>>c[i];

	vector<D> tr(1), rtr(1);
	int tri[50][20], rtri[50][20];
	rep(i, n) addtr(tr, tri, i, s[i], c[i], 0);
	rep(i, n) addtr(rtr, rtri, i, s[i], c[i], 1);

	rep(i, n) rep(j, s[i].size()){
		int ti=tri[i][j], rti=rtri[i][j];
		ssame[ti][rti].push_back(i);
	}

	rep(i, 1000) rep(j, 1000) mm[i][j]=LLONG_MAX;
	#define PP pair<long long, pair<int, int>>
	priority_queue<PP, vector<PP>, greater<PP>> pq;
	pq.push(make_pair(LLONG_MAX, make_pair(0, 0)));
	bool first=true;
	ll mn=LLONG_MAX;
	while(!pq.empty()){
		auto p=pq.top(); pq.pop();
		ll cc=p.first;
		int a=p.second.first, b=p.second.second;
		if(cc>mm[a][b]) continue;

		if(!first){
			for(int si : ssame[a][b])
				mn=min(mn, mm[a][b]+c[si]);
			rep(k, 26){
				int na=tr[a].e[k];
				if(na!= -1) for(int si : ssame[na][b])
					mn=min(mn, mm[a][b]+c[si]);
			}
			if(tr[a].cost!=INT_MAX && rtr[b].cost!=INT_MAX)
				mn=min(mn, mm[a][b]+tr[a].cost+rtr[b].cost);
		}

		rep(l, 4){
			int ca=a, cb=b;
			ll cm=mm[a][b];
			if(l%2==1){
				if(tr[a].cost==INT_MAX) continue;
				ca=0;
				cm+=tr[a].cost;
			}
			if(l/2==1){
				if(rtr[b].cost==INT_MAX) continue;
				cb=0;
				cm+=rtr[b].cost;
			}
			if(first){
				first=false;
				cm=0;
			}
			rep(k, 26){
				int na=tr[ca].e[k], nb=rtr[cb].e[k];
				if(na!= -1 && nb!= -1) if(cm<mm[na][nb]){
					mm[na][nb]=cm;
					pq.push(make_pair(cm, make_pair(na, nb)));
				}
			}
		}
	}

	if(mn==LLONG_MAX) cout<< (-1)<<endl;
	else cout<<mn<<endl;
	return 0;
}


Measured memory_bytes: 35132
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (c <= a + b) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b;
    if(a==3&&b==1||a==1&&b==3){
        cout<<2;
    }
    else if(a==1&&b==2||a==2&&b==1){
        cout<<3;
    }
    else if(a==3&&b==2 ||a==2&&b==3){
        cout<<1;
    }


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef string str;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

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

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define pb(x) pop_back(x)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define sum(x) accumulate(all(x),0)
#define pc(x) __builtin_popcount(x)
#define gll greater<ll>()

void solve(){
  ll x,k,d;
  cin >> x >> k >> d;
  
  ll n=abs(x)/d;
  if(x>=0) x-=min(k,n)*d;
  else x+=min(k,n)*d;
  k-=min(k,n);
  k%=2;
  if(k==1) cout << min(abs(x+d),abs(x-d)) << endl;
  else cout << abs(x) << endl; 
  
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}

Measured memory_bytes: 3608
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
from bisect import bisect_left
from itertools import product
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def LF(): return list(map(float, input().split()))
def LC(): return [c for c in input().split()]
def LLI(n): return [LI() for _ in range(n)]
def NSTR(n): return [input() for _ in range(n)]

def array2d(N, M, initial=0):
    return [[initial]*M for _ in range(N)]

def copy2d(orig, N, M):
    ret = array2d(N, M)
    for i in range(N):
        for j in range(M):
            ret[i][j] = orig[i][j]
    return ret


INF = float("inf")
MOD = 10**9 + 7


def main():
    N = INT()
    L = LI()
    L.sort()
    count = 0
    for i in range(N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if L[i] == L[j] or L[j] == L[k]:
                    continue
                if L[i]+L[j] > L[k]:
                    count += 1
    print(count)

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9256
#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;
template<typename... T>
void see(T&... args) { ((cin >> args), ...);}
template<typename... T>
void put(T&&... args) { ((cout << args << " "), ...);}
template<typename... T>
void putl(T&&... args) { ((cout << args << " "), ...); cout<<'\n';}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << "=" << a << ", "; err(++it, args...);}
#define int long long
#define pb push_back
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int,int>
#define tiii tuple<int,int,int>
#define vi vector<int>
#define vii vector<pii>
#define vc vector
#define L cout<<'\n';
#define E cerr<<'\n';
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for (int i=a; i<b; ++i)
#define rev(i,a,b) for (int i=a; i>b; --i)
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define setpr(x) cout<<setprecision(x)<<fixed
#define sz size()
#define seea(a,x,y) for(int i=x;i<y;i++){cin>>a[i];}
#define seev(v,n) for(int i=0;i<n;i++){int x; cin>>x; v.push_back(x);}
#define sees(s,n) for(int i=0;i<n;i++){int x; cin>>x; s.insert(x);}
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
 
const ll inf = 1LL<<62;
const ld ep = 0.0000001;
const ld pi = acos(-1.0);
const ll md = 1000000007;
 
const int mxN = 5e5+5;
int a[mxN];
map<int,int> mp;
bool comp(tiii x, tiii y){
    return get<1>(x) > get<1>(y);
}
int T[mxN];
int n;
void U(int k, int x) {
    for (; k <= n; k += k&-k) T[k] += x;
}
int Q(int k) {
    int s = 0;
    for (; k > 0; k -= k&-k) s += T[k];
    return s;
}
int vis[mxN];
int qry[mxN];
void solve(){
    int q; see(n,q);
    seea(a,0,n);
    int id = 1;
    rep(i,0,n) {
        if (mp.find(a[i]) == mp.end()) mp[a[i]] = id++;
        a[i] = mp[a[i]];
    }
    vc<tiii> v;
    rep(i,0,q) {
        int x,y; see(x,y);
        v.pb({x,y,i});
    }
    sort(all(v), comp);
    memset(vis, -1, sizeof vis);
    rep(i,0,n) {
        if (vis[a[i]] != -1) U(vis[a[i]] + 1, -1);
        vis[a[i]] = i;
        U(i+1, 1);
        while (v.sz && get<1>(v.back()) == i+1) {
            auto [l,r,x] = v.back();
            v.pop_back();
            qry[x] = Q(r) - Q(l-1);
        }
    }
    rep(i,0,q) putl(qry[i]);
}    
signed main(){
    IOS;
    #ifdef LOCAL
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    //cin>>t;
    rep(i,1,t+1){
        solve();
        cout<<'\n';
    }
    #ifdef LOCAL
    clock_t tStart = clock();
    cerr<<fixed<<setprecision(10)<<"\nTime Taken: "<<(double)(clock()- tStart)/CLOCKS_PER_SEC<<endl;
    #endif
}

Measured memory_bytes: 63080
// No.2

#include<iostream>
#include<string>
#include<map>

using namespace std;

typedef pair<int,int> P;

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

char data[101][101];

void fi(P now){
	if(data[now.first][now.second]=='.')return;
	else{
		char temp=data[now.first][now.second];
		data[now.first][now.second]='.';
		for(int i=0;i<4;i++){
			int nx=now.second+dx[i],ny=now.first+dy[i];
			if(nx>=0 && nx<W && ny>=0 && ny<H && data[ny][nx]==temp){
				fi(P(ny,nx));
			}
		}
		
	}
	
return ;
}


int main(){

	while(cin>>H>>W && H!=0 && W!=0){	
		for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
		cin>>data[i][j];
		}
		}
		int ans=0;
		
		for(int i=0;i<H;i++)for(int j=0;j<W;j++){
			if(data[i][j]!='.'){
				ans++;
				fi(P(i,j));
			}
			
		}
		cout<<ans<<endl;
		
	}
	
}

Measured memory_bytes: 1636
#include <stdio.h>

int main() {
	
	int N=0;
	scanf("%d",&N);
	
	int A = 0, B = 0;
	
	if( N == 1 )
	{
		printf("Hello World \n");
	}
	if( N == 2 )
	{
		scanf("%d",&A);
		scanf("%d",&B);
		printf("%d",A+B);
	}
	
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> x(n);
  for(int i = 0; i < n; i++) cin >> x.at(i);
  int s = 0, t = 0;
  for(int X : x) {
    s += X;
    t += X * X;
  }
  int p = s / n;
  int m1 = (n * p * p) - (2 * p * s);
  p++;
  int m2 = (n * p * p) - (2 * p * s);
  int m = min(m1, m2);
  cout << m + t << endl;
}

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

long long int N, M, X[111], Y[111];

int main(){
    scanf("%lld%lld%lld%lld", &N, &M, X, Y);
    for(int i = 1; i <= N; ++i){
        scanf("%lld", X + i);
    }
    for(int i = 1; i <= M; ++i){
        scanf("%lld", Y + i);
    }
    sort(X, X + N + 1);
    sort(Y, Y + M + 1);
    puts(X[N] < Y[0] ? "No War" : "War");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s={};
  char op;
  while(scanf("%c",&op)!=EOF)
  {
      if(op=='0')
        s=s+"0";
      if(op=='1')
        s=s+"1";
      if(op=='B')
      {
          if(s.size()!=0)
         s.erase(s.size()-1,1);
      }
  }
  cout<<s<<endl;
    return 0;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x, y) CPP_CAT_I(x, y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x, y) x##y

#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;
// }}}

constexpr i64 INF = 1'010'000'000'000'000'017LL;

constexpr i64 MOD = 1'000'000'007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

#define M5 100007
#define M9 1000000000

// util {{{
#define FOR(i, start, end) for (i64 i = (start), CPP_CAT(i, xxxx_end) = (end); i < CPP_CAT(i, xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f, c, ...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ##__VA_ARGS__); })(c))
#define ll long long int
#define VI vector<int>
template <typename C>
i64 SIZE(const C &c)
{
    return static_cast<i64>(c.size());
}

template <typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }

template <typename T, typename U, typename Comp = less<>>
bool chmax(T &xmax, const U &x, Comp comp = {})
{
    if (comp(xmax, x))
    {
        xmax = x;
        return true;
    }
    return false;
}

template <typename T, typename U, typename Comp = less<>>
bool chmin(T &xmin, const U &x, Comp comp = {})
{
    if (comp(x, xmin))
    {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit
{
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit()
    {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if (AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

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

bool isOK(int mid, double key)
{
}

int binary_search(double key)
{
    int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int right = 2000000000;
    /* どんな二分探索でもここの書き方を変えずにできる！ */
    while (right - left > 1)
    {
        int mid = left + (right - left) / 2;

        if (isOK(mid, key))
            right = mid;
        else
            left = mid;
    }

    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    return right;
}

bool isKaibun(string st)
{
    bool ans = true;
    int n = st.length();
    REP(i, n / 2)
    {
        if (st[i] != st[n - i - 1])
        {
            return false;
        }
    }
    return true;
}

int toInt(char a)
{
    return a - '0';
}

int gcd(int a, int b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

int lcm(int a, int b)
{
    return a * b / gcd(a, b);
}

void solve()
{
    string S;
    cin >> S;
    if (S == "ABC")
    {
        cout << "ARC";
    }
    else
    {
        cout << "ABC";
    }
}

signed main()
{

    solve();

    return 0;
}


Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class MainClass
    {
        public static void Main(string[] args)
        {

            //問題162

            long n = long.Parse(Console.ReadLine());


            long ans = 0;
            for (int i = 1; i < n + 1; i++)
            {
                if (i % 3 != 0 && i % 5 != 0)
                {
                    ans += i;
                }
            }

            Console.WriteLine(ans);
        }


    }
}


Measured memory_bytes: 27416
#include <iostream>
#include <algorithm>
#include <string>

int main() {
    std::string str;
    int m;
    std::cin >> str >> m;

    for (int i = 0; i < m; i++) {
        std::string o;
        int a, b;
        std::cin >> o >> a >> b;
        if (o == "print")
            std::cout << str.substr(a, b - a + 1) << std::endl;
        else if (o == "replace") {
            std::string p;
            std::cin >> p;
            str.replace(str.begin() + a,  str.begin() + b + 1, p);
        } else if (o == "reverse")
            std::reverse(str.begin() + a, str.begin() + b + 1);
    }
    return 0;
}

Measured memory_bytes: 3172
use std::io;

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut n = String::new();
    io::stdin().read_line(&mut n).unwrap();
    n.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
fn main() {
    let n: Vec<i32> = read_vec();
    println!(
        "{}",
        if n[0] < n[1] && n[1] < n[2] {
            "Yes"
        } else {
            "No"
        }
    );
}



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

result = 0
for i in range(a, b + 1):
    i_str = str(i)
    border = len(i_str) // 2

    first_half = i_str[:border]
    if len(i_str) % 2 != 0:
        border += 1
    second_half = i_str[border:]

    compared = second_half[::-1]
    if first_half == compared:
        result += 1

print(result)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  for(Int x=1;x<=n;x++){
    Int y=(x*108)/100;
    if(y==n) drop(x);
  }
  cout<<":("<<endl;
  return 0;
}


Measured memory_bytes: 256
N=int(input())
t,x,y=0,0,0
for i in range(N):
    T,X,Y=map(int,input().split())
    r=abs(X-x)+abs(Y-y)
    t=T-t
    if r%2!=t%2 or t<r:
        print('No')
        exit()
    t=T;x=X;y=Y
print('Yes')

Measured memory_bytes: 9104
#include<stdio.h>
#include<string.h>
int main(void)
{
	int flag = 0, q, i, n, t,len,count=0;
	char koma[100000];
	scanf("%s",koma);
	len = strlen(koma);

	for (i = len; i >= 0; i--)
	{
		
		if (koma[i] != koma[i - 1])
		{
			flag = 0;
			count++;
		}
		
		if (koma[i] == koma[i - 1])//一つまえと違うか比較
		{
			flag++;
		}
		

	}
	printf("%d", count-2);
return 0;
}


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


int main(){
    int n,k; cin >> n >> k;
    ll res = 0;
    for(int i=k+1;i<=n;i++){
        res += max(0, (n%i)-k+1);
        res += (n/i)*(i-k);
    }
    if(k==0) res -= n;
    cout << res << endl;
}

Measured memory_bytes: 3580
import math
s = str(input())

def split(word): 
    return [char for char in word]  

splice = split(s)

isrightcont = 0
isleftcont = 0

length = len(splice)

moke = list()
poke = list()
rightatsumaru = list()
leftatsumaru = list()

for i in range (0, length):
	if i == length-1:
		if isleftcont == 0:
			rightatsumaru.append(int(i))
			leftatsumaru.append(int(i)+1)
			poke.append(isleftcont+1)
			moke.append(isrightcont)
		else:
			poke.append(isleftcont+1)
			moke.append(isrightcont)		
	elif splice[i] == 'R':
		if isleftcont > 0:
			poke.append(isleftcont)
			moke.append(isrightcont)
			isleftcont = 0
			isrightcont = 1
		else:
			isrightcont+=1
	else:
		if isleftcont == 0:
			rightatsumaru.append(int(i))
			leftatsumaru.append(int(i)+1)
			isleftcont+=1
		else:
			isleftcont+=1

tsumaranai = len(rightatsumaru)

gideon = [0]*length
for i in range (0, tsumaranai):
	gideon[rightatsumaru[i]-1]=math.ceil(moke[i]/2)+math.floor(poke[i]/2)
	gideon[rightatsumaru[i]]=math.ceil(poke[i]/2)+math.floor(moke[i]/2)
    
print(*gideon)

Measured memory_bytes: 11904
def check(arr):
  for j in range(len(arr) // 2):
    if(num[j] != num[len(arr) - 1 - j]):
      return False
  return True

a,b = map(int, input().split())

cnt = 0
for i in range(a, b+1):
  num = list(map(int, list(str(i))))
  if(check(num)):
    cnt += 1
print(cnt)


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

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

    char p = 'a';
    while(1){
        if(p == 'a' && !a.size()) {
            cout << 'A' << endl;
            return 0;
        } else if(p == 'b' && !b.size()) {
            cout << 'B' << endl;
            return 0;
        } else if(p == 'c' && !c.size()) {
            cout << 'C' << endl;
            return 0;
        }

        if(p == 'a') {
            p = a[0];
            a.erase(0, 1);
        } else if(p == 'b') {
            p = b[0];
            b.erase(0, 1);
        } else if(p == 'c') {
            p = c[0];
            c.erase(0, 1);
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-10)
#define INF INT_MAX
#define INFLL LLONG_MAX
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


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

	cout << count(ALL(s), '1') << endl;

	return 0;
}

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

struct Card{char suit, value;};

void bubble(struct Card A[], int N){
    for(int i=0;i<N;i++){
        for(int j=N-1;j>=i;j--){
            if(A[j].value < A[j-1].value){
                Card t=A[j];A[j]=A[j-1];A[j-1]=t;
            }
        }
    }
}

void selection(struct Card A[], int N){
    for(int i=0;i<N;i++){
        int min_j=i;
        for(int j=i;j<N;j++){
            if(A[j].value<A[min_j].value) min_j=j;
        }
        Card t=A[i];A[i]=A[min_j];A[min_j]=t;
    }
}

void exp(struct Card A[], int N){
    for(int i=0;i<N;i++){
        if(i > 0)cout << " ";
        cout << A[i].suit << A[i].value;
    }
    cout << endl;
}

bool isStable(struct Card C1[], struct Card C2[], int N){
    for(int i=0;i<N;i++){
        if(C1[i].suit != C2[i].suit) return false;
    }
    return true;
}

int main(){
    Card C1[100], C2[100];
    int N;
    char ch;

    cin >> N;
    for(int i=0;i<N;i++){
        cin >> C1[i].suit >> C1[i].value;
    }
    for(int i=0;i<N;i++)C2[i]=C1[i];
    bubble(C1, N);
    selection(C2, N);
    exp(C1, N);
    cout << "Stable" << endl;
    exp(C2, N);
    if(isStable(C1, C2, N)){
        cout << "Stable" << endl;
    }else{
        cout << "Not stable" << endl;
    }
    return 0;
}

Measured memory_bytes: 1156
#include<stdio.h>


float a;
void check(float b){
	if(b<=48)printf("light fly\n");
	else if(b<=51)printf("fly\n");
	else if(b<=54)printf("bantam\n");
	else if(b<=57)printf("feather\n");
	else if(b<=60)printf("light\n");
	else if(b<=64)printf("light welter\n");
	else if(b<=69)printf("welter\n");
	else if(b<=75)printf("light middle\n");
	else if(b<=81)printf("middle\n");
	else if(b<=91)printf("light heavy\n");
	else printf("heavy\n"); 
	
}
int main(){   
	while(~scanf("%f",&a)){
		check(a);
	}
	return 0;
}

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

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

struct Edge {
    int to, weight;
    Edge(int t, int w) : to(t), weight(w) {}
};

vector<vector<Edge>> g;
vi color;
void dfs(int v, int c = 0) {
    color[v] = c;
    for (auto t : g[v]) {
        if (color[t.to] != -1) continue;
        int nc = (t.weight%2==0 ? c : 1-c);
        dfs(t.to, nc);
    }
}

int main(){
    int n;
    cin >> n;
    g = vector<vector<Edge>>(n);
    rep(i, n-1) {
        int u, v, w;
        cin >> u >> v >> w;
        --u; --v;
        g[u].emplace_back(v, w);
        g[v].emplace_back(u, w);
    }
    color = vi(n, -1);
    dfs(0);
    rep(i, n) cout << color[i] << endl;
    return 0;
}


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

#include <utility>
#include <algorithm>
#include <array>
#include <vector>
#include <deque>
#include <unordered_map>
#include <unordered_set>

int main () {

  std::string line;
  std::getline(std::cin, line);

  char * p;

  p = &line[0];
  int N = std::strtol(p, &p, 0);
  std::vector<int> L(2 * N);

  std::getline(std::cin, line);
  p = &line[0];
  for (int i = 0; i < 2 * N; ++i) {
    L[i] = std::strtol(p, &p, 0);
  }
  std::sort(L.begin(), L.end());

  int X = 0;
  for (int i = 0; i < N; ++i) {
    X += L[2 * i];
  }
  std::cout << X << std::endl;
}


Measured memory_bytes: 256
a=int(input())
x=input().split()
x=list(map(int,x))
x=sorted(x)
l=[]
for i in range(x[0]-1,x[-1]+1):
    d = 0
    for j in x:
        c=(j-i)**2
        d=d+c
    l.append(d)
print(sorted(l)[0])

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


int main() {
  int a, b;
  string s, t, u;
  cin >> s >> t >> a >> b >> u;
  if(s == u) {
    a -= 1;
  }else {
    b -= 1;
  }
  cout << a << " " << b << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>

int main()
{
	std::vector<int> high(10);
	int h;

	for(int i=0;i<10;++i)
	{
		std::cin >> h;
		high[i] = h;
	}

	std::sort(high.begin(),high.end());

	for(size_t i=high.size()-1;i>6;--i)
	{
		std::cout << high[i] << '\n';
	}


}

Measured memory_bytes: 1200
n=int(input())
p=list(map(int,input().split()))

flag=0

for i in range(1,n-1):
    if (p[i]-p[i-1])>=0 and (p[i+1]-p[i])>=0:
      flag+=1
    elif (p[i]-p[i-1])<=0 and (p[i+1]-p[i])<=0:
      flag+=1

print(flag)

Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <functional>
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int MAXN=1e5+10;
const int MAX=1e4+10;
const double eps=1e-6;

int op[10][4]={{},{1,1,1},{1,1,-1},{1,-1,1},{1,-1,-1},{-1,1,1},{-1,1,-1},{-1,-1,1},{-1,-1,-1}};

int main(){
    #ifdef ONLINE_JUDGE
    #else
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    #endif

    string s;
    cin>>s;
    int num[10];
    for(int i=0;i<4;i++)	num[i]=s[i]-'0';
    for(int i=1;i<=8;i++){
    	int temp=num[0]+num[1]*op[i][0]+num[2]*op[i][1]+num[3]*op[i][2];
    	//cout<<temp<<endl;
    	if(temp==7){
    		cout<<num[0];
    		for(int j=1;j<4;j++){
    			if(op[i][j-1]==-1)	cout<<'-';
    			else	cout<<'+';
    			cout<<num[j];
    		}
    		cout<<'='<<7<<endl;
    		return 0;
    	}
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  string ans = "Three";
  
  for(int i; i<N; i++){
    char s;
  	cin >> s;
    if (s=='Y'){
      ans = "Four";
      break;
    }
  }
  cout << ans << endl;
}

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

int main(){
    string s,t;
    int a,b;
    string u;
    cin>>s>>t>>a>>b>>u;
    if(u==s){
        cout << a-1 << " " << b << endl;
    }else{
        cout << a << " " << b-1 << endl;
    }
    
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#define MOD 2017
#define LL long long
#define INF 0x3f3f3f3f
#define maxn 100009
#define Pair pair<int, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define _  ios_base::sync_with_stdio(0),cin.tie(0)
//freopen("1.txt", "r", stdin);
using namespace std;

bool operator<(const Pair &a, const Pair &b)
{
    return a.first > b.first;
}

int arr[1000];
int a,b,c;

int main()
{
    memset(arr,0,sizeof(arr));

    cin >> a >> b >> c;
    arr[a]++;
    arr[b]++;
    arr[c]++;

    if(arr[5] == 2 && arr[7] == 1) {
        cout << "YES" << endl;cout << endl;
//        printf("Using three phrases of length %d, %d and %d, it is possible to construct a Haiku.\n",a,b,c);

    } else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <regex>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ARRAY_LEN(ARR) (sizeof(ARR) / sizeof((ARR)[0]))
using namespace std;
int main(void){
  string s;
  cin >> s;
  int k;
  cin >> k;
  vector<string> ans;
  int len = s.length();
  REP(i,len){
    REP(j,k+1){
      ans.push_back(s.substr(i,j));
    }
  }

  std::sort(ans.begin(), ans.end());
  ans.erase(std::unique(ans.begin(), ans.end()), ans.end());

  cout << ans[k] << endl;

}

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


int main(){
    int a,b,h,m;
    
    cin >> a >> b >> h >> m;
    
    double c = a*a + b*b;
    
    double t = 2*M_PI*(m/60.0 - (60*h+m)/720.0 );
    
    c -= 2*a*b*cos(t);
    
    printf("%.10lf\n", sqrt(c));
    
    return 0;
}



Measured memory_bytes: 4196
N,M = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(N)]

AB.sort(key = lambda x:x[0])
A = []
B = []
for i in range(N):
    A.append(AB[i][0])
    B.append(AB[i][1])

ans = 0
for i in range(N):
    if M - B[i]>0:
        ans += A[i] * B[i]
        M -= B[i]
    else:
        while M > 0:
            ans += A[i]
            M -= 1

print(ans)

Measured memory_bytes: 29284
#include<bits/stdc++.h>
using namespace std;
const int N=1e6;
int i,j,k,m,n,len;
int d[N],a[N];
bool cmp(int x,int y){return x>y;}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	d[1]=a[1];
	len=1;
	for(int i=2;i<=n;i++)
	{
		if(a[i]<=d[len]) d[++len]=a[i];
		else
		{
			int p=upper_bound(d+1,d+len+1,a[i],cmp)-d;
			d[p]=a[i];
		}
	}
	printf("%d\n",len);
}

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

int main() {
    int S, h, m, s;
    scanf("%d", &S);
    h = S / 3600;
    m = (S % 3600) / 60;
    s = S % 60;
    printf("%d:%d:%d\n", h, m, s);
}


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n, k; std::cin >> n >> k;
  ll ans = 0;
  srep(b, k+1, n+1) {
    ll cnt = n / b, base = b - k;
    if (cnt == 0) continue;
    ans += cnt * base;
    if (k == 0) base--;
    if (cnt * b != n)
      ans += max(0ll, n - ((cnt + 1) * b - base) + 1);
  }
  std::cout << ans << "\n";
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<string>
#include<cmath>
#define eps 1e-9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<ll,ll> LLP;
const int MAXN=2e3+10;
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3f;
const int MOD=1e9+7;
const int LOGN=20;
signed main()
{
    int n;
    scanf("%d",&n);
    int ou=n/2;
    int ji=n-ou;
    printf("%.7f\n",(double)ji/(double)n);
    return 0;
}


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


map<int,int>mp;

int myfunc(int t,int num)
{
	int m1,i,m2;
	for(i=t;;i--)
	{
		if(mp[i]==0)
		{
			m1=i;
			break;
		}
	}
	
	for(i=t;;i++)
	{
		if(mp[i]==0)
		{
			m2=i;
			break;
		}
	}
	
	if(abs(m1-num)==abs(m2-num))
	{
		if(m1<m2)
			return m1;
		else
			return m2;
	}
	else if(abs(m1-num)<abs(m2-num))
	{
		return m1;
	}
	else
		return m2;
	
}

int main()
{
	int max,k,val,v,f,i,a,b;
	cin>>a>>b;
	for(i=0;i<b;i++)
	{
		cin>>k;
		mp[k]++;
	}
	if(b==0)
		cout<<a;
	else if(mp[a]==0)
		cout<<a;
	else
	{
		cout<<myfunc(a,a);
	}
	return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
map<ll,ll> mp;
string s;
ll a[200001],tmp=1,ans;
int main(void){
    cin>>s;
    reverse(s.begin(),s.end());
    for(int i=0;i<s.size();i++){
        a[i+1]=(s[i]-'0')*tmp;
        a[i+1]%=2019;
        tmp*=10;
        tmp%=2019;
    }
    for(int i=0;i<s.size();i++){
        a[i+1]+=a[i];
        a[i+1]%=2019;
        //cout<<a[i+1]<<endl;
        mp[a[i+1]]++;
    }
    mp[0]++;
    for(auto x:mp){
        ans+=x.second*(x.second-1)/2;
    }
    cout<<ans<<endl;
}


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

int main() {
	int N;
	string S;
	bool p = 0, w = 0, g = 0, y = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> S;
		if (S == "P") {
			p = 1;
		}
		else if (S == "W") {
			w = 1;
		}
		else if (S == "G") {
			g = 1;
		}
		else if (S == "Y") {
			y = 1;
		}
	}
	if ((p + w + g + y) == 3) {
		cout << "Three" << endl;
	}
	else if ((p + w + g + y) == 4) {
		cout << "Four" << endl;
	}
}

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

using namespace std;

int main (){

	int n,a[100];
	cin >> n;
	for(int i = 1;i <= n;i++){
		cin >> a[i - 1];
	}
	reverse(a,a+n);
	for(int b = 1;b <= n;b++){
		cout << a[b - 1];
		if(b != n) cout << " " ;
	}
	cout << endl;



	return 0;
}

Measured memory_bytes: 3064
num_of_votes = int(input())

poll = {}

for i in range(num_of_votes):
    entry = input()
    
    if (poll.get(entry) == None):
        poll[entry] = 0
    
    poll[entry] += 1

max_votes = 0
most_voted_entries = []

for key in poll:
    num_of_votes = poll[key]

    if num_of_votes > max_votes:
        most_voted_entries = [ key ]
        max_votes = num_of_votes
    elif num_of_votes == max_votes:
        most_voted_entries.append(key)

for entry in sorted(most_voted_entries):
    print(entry)

Measured memory_bytes: 35720
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    static int[] h = new int[100010];
    static int[] dp = new int[100010];

    static int chmin(int a, int b) {
        if (a > b) {
            a = b;
            return b;
        }
        return a;
    }

    static int chmax(int a, int b) {
        if (a < b) {
            a = b;
            return b;
        }
        return a;
    }

    static int rec(int i) {
        if (dp[i] < Integer.MAX_VALUE)
            return dp[i];
        if (i == 0)
            return 0;
        int res = Integer.MAX_VALUE;
        res = chmin(res, rec(i - 1) + Math.abs(h[i] - h[i - 1]));
        if (i > 1)
            res = chmin(res, rec(i - 2) + Math.abs(h[i] - h[i - 2]));

        return dp[i] = res;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Arrays.fill(dp, Integer.MAX_VALUE);
        dp[0] = 0;
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }

        System.out.println(rec(n - 1));
    }
}


Measured memory_bytes: 61580
#include <iostream>

int main() {
    std::string N;
    std::cin >> N;

    if (N[0] == N[1] && N[1] == N[2]) {
        std::cout << "Yes" << std::endl;
    } else if (N[1] == N[2] && N[2] == N[3]) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        if(a % 1000 == 0) System.out.println(0);
        else System.out.println(1000 - (a % 1000));
    }
}


Measured memory_bytes: 35580
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#include <set>
//#define LOCAL
#define maxv 205
#define maxn 105
#define EPS 1e-10
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
struct Point{
	double x,y;
	Point(double x = 0.0,double y = 0.0): x(x),y(y) {}
	Point operator + (Point p){
		return Point(x + p.x,y + p.y);
	}
	Point operator - (Point p){
		return Point(x - p.x,y - p.y);
	}
	Point operator * (double lambda){
		return Point(x * lambda,y * lambda);
	}
	Point operator / (double lambda){
		return Point(x / lambda,y / lambda);
	}
	double norm(){
		return x * x + y * y;
	}
	double abs_(){
		return sqrt(norm());
	}
	double pol(){
		return atan2(y,x);
	}
	bool operator == (const Point &p)const
	{
		return abs(x - p.x) < EPS && abs(y - p.y) < EPS;
	}
	bool operator < (const Point &p)const
	{
		if(abs(x - p.x) < EPS) return y < p.y;
		else return x < p.x;
	}
};
typedef Point Vector;
struct Segment{
	Point p1,p2;
	Segment(Point p1 = Point(),Point p2 = Point()): p1(p1),p2(p2) {}
};
Point front(Segment s){
	Vector a = s.p2 - s.p1;
	a = a / a.abs_() * 5e-4;
	return s.p2 + a;
}
Point back(Segment s){
	Vector a = s.p2 - s.p1;
	a = a / a.abs_() * 5e-4;
	return s.p1 - a;
}
typedef Segment Line;
typedef vector<Point> Polygon;
double dot(Vector a,Vector b){ return a.x * b.x + a.y * b.y; }
double det(Vector a,Vector b){ return a.x * b.y - a.y * b.x; }
vector <int> adj[maxv];
Point p[maxv]; int pk;
Segment s[maxn]; int n;
int ccw(Point p,Segment l){
	if(det(l.p2 - l.p1,p - l.p1) > EPS) return 1;
	if(det(l.p2 - l.p1,p - l.p1) < -EPS) return -1;
	if(dot(l.p2 - l.p1,p - l.p1) < -EPS) return 2;
	if((l.p2 - l.p1).norm() < (p - l.p1).norm()) return -2;
	return 0;
}
bool cross(Segment s1,Segment s2){
	return ccw(s1.p1,s2) * ccw(s1.p2,s2) <= 0 && ccw(s2.p1,s1) * ccw(s2.p2,s1) <= 0;
}
bool check(Point p1,Point p2){
	for(int i=1;i<=n;i++){
		if(cross(Segment(p1,p2),s[i])) return false;
	}
	return true;
}
bool vis[maxv];
void dfs(int u){
	vis[u] = true;
	for(int i=0;i<(int)adj[u].size();i++){
		int v = adj[u][i];
		if(!vis[v]) dfs(v);
	}
}
int main(){
	#ifdef LOCAL
	freopen("sample.in","r",stdin);
	freopen("sample.out","w",stdout);
	#endif
	while(~scanf("%d",&n) && n){
		for(int i=1;i<=n;i++) scanf("%lf%lf%lf%lf",&s[i].p1.x,&s[i].p1.y,&s[i].p2.x,&s[i].p2.y);
		pk = 0;
		p[++pk] = Point(0,0);
		p[++pk] = Point(100,100);
		for(int i=1;i<=n;i++){
			p[++pk] = front(s[i]);
			p[++pk] = back(s[i]);
		}
		for(int i=1;i<=pk;i++) adj[i].clear();
		for(int i=1;i<=pk;i++){
			for(int j=i+1;j<=pk;j++){
				if(check(p[i],p[j])){
					adj[i].push_back(j);
					adj[j].push_back(i);
				}
			}
		}
		memset(vis,0,sizeof(vis));
		dfs(1);
		if(vis[2]) puts("no");
		else puts("yes");
	}
	return 0;
}



Measured memory_bytes: 3388
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
int INF=1e9;
int MOD=1000000007;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
double EPS = 1e-10;
const int mod=1e9+7;
int dp[20001];
int sum[20001];
int N,M;
int C[500],E[500];
vector<int>P;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>M>>N;
	P.resize(M);
	REP(i,M)cin>>P[i];
	sort(ALL(P),greater<int>());
	REP(i,M)sum[i+1]=sum[i]+P[i];
	REP(i,N)cin>>C[i]>>E[i];
	REP(i,20001)dp[i]=1e9;
	dp[0]=0;
	REP(i,N){
		for(int j=M;j>=0;j--){
			dp[j+C[i]]=min(dp[j+C[i]],dp[j]+E[i]);
		}
	}
	for(int i=20000;i>0;i--){
		dp[i-1]=min(dp[i],dp[i-1]);
	}
	int ans=0;
	REP(i,M+1)ans=max(ans,sum[i]-dp[i]);
	cout<<ans<<endl;
}

Measured memory_bytes: 1384