akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
using namespace std;
#define N 100005

int n,k,ans;
string s;
int l[N],r[N];
int cnt;

int main()
{
	
	cin>>n>>k;
	cin>>s;
	for(int i=0;i<s.size();i++)
		if(s[i]=='0')
		{
			cnt++;
			l[cnt]=i;
			while(s[i]=='0') i++;
			i--;
			r[cnt]=i;
		}
	r[0]=-1;
	l[cnt+1]=n;
	if(k>cnt) k=cnt;
	
	for(int i=k;i<=cnt;i++)
		ans=max(ans,l[i+1]-r[i-k]-1);
	cout<<ans<<'\n';
	
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
using ll = long long;
ll inf = 100000000007ll; 

int main(void)
{
  int n;
  cin >> n;
  vector<ll> a(n),b(n);
  REP(i,n) cin >> a[i] >> b[i];
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  if(n%2) {
    cout << b[n/2] - a[n/2] + 1 << endl;
  } else {
    cout << b[n/2-1] + b[n/2] - a[n/2-1] - a[n/2] + 1 << endl;
  }
  return 0;
}


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

#define rep(i,n) for(int i=0;i<(n);++i)
#define loop for(;;)
#define trace(var) cout<<">>> "<<#var<<" = "<<var<<endl;
#define inf (1e9)
#define eps (1e-9)

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

template<class S, class T, class U> inline
ostream& operator<<(ostream&os, tuple<S,T,U> t) {
  return os << '('
    << get<0>(t) << ", "
    << get<1>(t) << ", "
    << get<2>(t) << ')';
}

template<class T> inline
ostream& operator<<(ostream&os, vector<T> v) {
  if (v.size() == 0) { return os << "(empty)"; }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

template<class T> inline
istream& operator>>(istream&is, vector<T>&v) {
  rep (i, v.size()) is >> v[i];
  return is;
}

typedef vector<int> vi;

int main() {
  cin.tie(0);
  cout.setf(ios::fixed);
  cout.precision(10);

  loop {
    int w, q; cin >> w >> q;
    if (not w and not q) break;

    vi wall(w, -1);

    rep (_, q) {
      // trace(wall);
      char c; cin >> c;
      if (c == 's') {
        int id, size; cin >> id >> size;
        int pos = -1;
        rep (i, w - size + 1) {
          if (count(begin(wall) + i, begin(wall) + i + size, -1) == size) {
            pos = i;
            fill(begin(wall) + i, begin(wall) + i + size, id);
            break;
          }
        }
        if (pos < 0) {
          cout << "impossible" << endl;
        } else {
          cout << pos << endl;
        }
      } else {
        int id; cin >> id;
        rep (i, w) { if (wall[i] == id) wall[i] = -1; }
      }
    }
    cout << "END" << endl;
  }

  return 0;
}

Measured memory_bytes: 1196
_[9],s,i,k;main(n){for(;~scanf("%d",_+i);)if(s|=1<<(_[i++]-1),i%5==0){for(;i--;)printf("%d\n",k?k-_[4-i]?2:1:3,k=s%5?s%3?0:s%2?1:2:3);s=i=0;}}

Measured memory_bytes: 0
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
dp = [[0]*13 for _ in range(len(S)+1)]
dp[0][0] = 1

for i in range(len(S)):
	if S[i] == '?':
		c = -1
	else:
		c = int(S[i])

	for j in range(10):
		if c != -1 and c != j:
			continue
		for k in range(13):
			dp[i+1][(k*10+j)%13] = (dp[i+1][(k*10+j)%13] + dp[i][k]) % mod

# print(dp)
print(dp[len(S)][5])


Measured memory_bytes: 85136
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    int A[4];
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        A[i]=s[i]-'0';
    }
    int sum;
    char op[3];
    for(int i=0;i<8;i++){
        sum=A[0];
        for(int j=0;j<3;j++){
            if(i&(1<<j)){
                op[j]='+';
                sum+=A[j+1];
            }
            else{
                op[j]='-';
                sum-=A[j+1];
            }
        }
        if(sum==7){
            break;
        }
    }
    for(int i=0;i<3;i++){
        cout<<A[i]<<op[i];
    }
    cout<<A[3]<<"=7"<<endl;
    
}

Measured memory_bytes: 764
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    cout << a * b << " " << 2 * (a + b) << endl;
}

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

int main() {
  int N, K; //N回目、Kをたす
  cin >> N >> K;
  
  int x = 1;
  
  for (int i = 0; i < N; i++)
  {
    int A, B;
    A = x * 2;
    B = x + K;
    
    if(A > B)
    {
      x = B; //Bの方が小さいときxにBを代入する
    }
    else
    {
      x = A;
    }
  }
  
  cout << x << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <string>
#include<stdio.h>
#include <math.h>
using namespace std;

void East(int *num)
{
	int tmp;
	tmp = num[0];
    num[0] = num[3];
	num[3] = num[5];
	num[5] = num[2];
	num[2] = tmp;
}
void West(int *num)
{
	int tmp;
	tmp = num[0];
    num[0] = num[2];
	num[2] = num[5];
	num[5] = num[3];
	num[3] = tmp;
}
void North(int *num)
{
	int tmp;
	tmp = num[0];
    num[0] = num[1];
	num[1] = num[5];
	num[5] = num[4];
	num[4] = tmp;
}
void Sourth(int *num)
{
	int tmp;
	tmp = num[0];
    num[0] = num[4];
	num[4] = num[5];
	num[5] = num[1];
	num[1] = tmp;
}

int main()
{
	int n;

	int i;
	int nums[6];
	char str[101];
	string st;

	for(i=0; i<6; i++)cin >> nums[i];
	cin >> st;

	for(i=0; i<st.size(); i++){
        switch(st.c_str()[i]){
		case 'E':
            East(nums);
			break;
		case 'W':
            West(nums);
			break;
		case 'N':
			North(nums);
			break;
		case 'S':
			Sourth(nums);
			break;
		}
	}
	printf("%d\n", nums[0]);
    return 0;
}

Measured memory_bytes: 1204
/**
* Author : zzy
* Date : 2020-04-19-19.59.01 Sunday
*/
#include <bits/stdc++.h>

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, a, b) for (int i = (int)(a); i >= (int)b; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, r, l) for (int i = (r); i >= (l); i--)
#define ms(x, y) memset(x, y, sizeof(x))
#define SZ(x) ((int)(x).size())
#define PI acos(-1)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }



int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "r", stdin);
#endif

    double r;
    scanf("%lf", &r);
    double res = 2*PI*r;
    printf("%.4f\n", res);

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N,M,L,R;
	cin >> N >> M;
	vector<int>v(N);
	for (auto &i : v)cin >> i;
	vector<int>ans(N, 1);
	for (int i = 0; i < M; i++) {
		cin >> L >> R;
		L--, R--;
		if (v[L] <= v[R])ans[L] = 0;
		if (v[L] >= v[R])ans[R] = 0;
	}
	cout << accumulate(ans.begin(), ans.end(), 0) << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

const ll MOD = 1000000007;
const ll INF = 1e18; //1*10^18

ll powll(ll a, ll n)
{ //O(log n)
  ll res = 1;
  while (n > 0)
  {
    if (n & 1) //(n & 1)=(n % 2 !=0)
    {
      res = res * a;
    }
    a = a * a;
    n >>= 1; //(n & 1)=(n % 2 !=0)
  }
  return res;
}

ll modpow(ll a, ll n, ll mod) //O(log n)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1) //(n & 1)=(n % 2 !=0)
    {
      res = res * a % mod;
    }
    a = a * a % mod;
    n >>= 1; //(n>>=1)=(n/2)
  }
  return res;
}

int ReturnDigit(ll num)
{
  string number = to_string(num);
  return number.length();
}

const ll MAX = 1e4;
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()
{
  // srand((unsigned int)time(NULL));//--> rand()
  ll i, j, l, ans = 0;
  ll a, b, k;
  cin >> a >> b >> k;

  if (a + b <= k)
  {
    cout << 0 << " " << 0 << endl;
    return 0;
  }
  else if (a <= k)
  {
    k -= a;
    cout << 0 << " " << b - k << endl;
    return 0;
  }
  else
  {
    cout << a - k << " " << b << endl;
    return 0;
  }

  // cout << ans << endl;
}


Measured memory_bytes: 256
// This  Program is made by Jan(Codezebra)
#include<bits/stdc++.h>
#define int long long
#define INF 0x3f3f3f3f3f3f3f3f
using namespace std;
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	int ans=0;
	int m=0;
	for(int i=0;i<n;i++){
		int h;
		cin>>h;
		if(h>=m){
			ans++;
			m=h;
		}
	}
	cout<<ans;
	return 0;
}



Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6) #再帰関数の上限
import math
from copy import copy, deepcopy
from operator import itemgetter

from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque 
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
#dequeを使うときはpython3を使う、pypyはダメ
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds

#mod = 10**9+7
#w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

X = int(input())
#N, K = map(int, input().split())
#L = [int(input()) for i in range(N)]
#A = list(map(int, input().split()))
#S = [list(map(int, input().split())) for i in range(N)]
ans=0
ans+=(X//500)*1000
X%=500
ans+=(X//5)*5
print(ans)

Measured memory_bytes: 38384
N, M = map(int, input().split())

Switches = [None] + [ list([0]) for _ in range(N) ]
Ss = [list(map(lambda x: Switches[int(x)], input().split()[1:])) for _ in range(M)]
for coil, S in zip(map(int, input().split()), Ss):
    S.append([coil])

cnt = 0
for L in range(pow(2, N)):

    for i, onoff in enumerate(((L & (1 << x)) != 0 for x in range(N))):
        Switches[i+1][0] = onoff

    if sum((sum((1 for si in sji for siv in si if siv)) % 2 != 0 for sji in Ss)) <= 0:
        cnt += 1

print(cnt)


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

int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    char s[a+b+5];
    scanf("%s",s);
    for (int i=0;i<(a+b+1);i++) {
        if (i==a && isdigit(s[i])) {
            printf("No\n");
            return 0;
        } else if (i!=a && isdigit(s[i])==false) {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 256
x = [list(map(int,input().split())) for i in range(3)]
m=0
for i in range(3):
    m+=sum(x[i])
if m%3 == 0 and (x[0][0]+x[1][1]+x[2][2])*3==m:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x;

        for(int i=0;i<n;i++){
            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();
            if(a>b && a>c){
                x = a;
                a = c;
                c = x;
            }else if(b>a && b>c){
                x = b;
                b = c;
                c = x;
            }
            if(a*a+b*b == c*c){System.out.println("YES");}
            else{System.out.println("NO");}
        }
        
    }
}


Measured memory_bytes: 35128
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>

using namespace std;

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

	int n;
	cin >> n;

	int a[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
	}

	
	long long ans=0;
	map<long long, int> m;
	long long rui=0;
	m[0]++;
	for(int i=0;i<n;i++){
		rui += a[i];
		ans += m[rui]++;
	}

	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 13568
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline int read()
{
	int f=1,x=0;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;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int MAXN=5005;
const int base=131;
const int base1=233;
const int mod1=1e9+9;
const int mod=998244853;
char ch[MAXN];
struct node
{
	int a,b,c;
	node(){}node(int _a,int _b,int _c){a=_a;b=_b;c=_c;}
	friend bool operator ==(node n1,node n2){return n1.a==n2.a&&n1.b==n2.b;}
};
vector<node> vec[MAXN];
bool cmp(node n1,node n2)
{
	if(n1.a!=n2.a)return n1.a<n2.a;
	if(n1.b!=n2.b)return n1.b<n2.b;
	return n1.c<n2.c;
}
int main()
{
	int len=read();
	scanf("%s",ch+1);
	for(int i=1,hs=0,hs1=0;i<=len;i++)
	{
		hs=0;hs1=0;
		for(int j=i;j<=len;j++)
		{
			hs=(1LL*hs*base%mod+ch[j]-'a'+1)%mod;
			hs1=(1LL*hs1*base1%mod1+ch[j]-'a'+1)%mod1;
			vec[j-i+1].push_back(node(hs,hs1,i));
		}
	}
	for(int i=1;i<=len;i++)sort(vec[i].begin(),vec[i].end(),cmp);
	for(int i=len;i>=1;i--)
	{
		for(int j=0,nxt;j<vec[i].size();j=nxt+1)
		{
			nxt=j;
			while(nxt+1<vec[i].size()&&vec[i][nxt+1]==vec[i][nxt])++nxt;
			if(vec[i][nxt].c-vec[i][j].c>=i)return pr2(i),0;
		}
	}return pr2(0),0;
}


Measured memory_bytes: 191488
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)
#define REPIT(i,x) for(auto i{(x).begin()}; i != (x).end(); i++) 

#define PB push_back
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef double dbl;
typedef vector<bool> Vb;
typedef vector<char> Vc;
typedef vector<double> Vd;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<string> Vs;
typedef vector<vector<int>> VVi;
typedef vector<vector<ll>> VVl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }
inline void YES() { cout << "YES" << endl; } inline void Yes() { cout << "Yes" << endl; }
inline void NO() { cout << "NO" << endl; } inline void No() { cout << "No" << endl; }

const int inf = 1 << 30;
const ll linf = 1LL << 60;
const int MOD = 1000000007;

#include <set>

vector<vector<int>> g;
vector<set<int>> s;
Vb visiting, done;
int n, m;

void init()
{
	cin >> n >> m;
	g.resize(n);

	s.resize(n);
	visiting.resize(n, false);
	done.resize(n, false);

	REP(i, m)
	{
		int a, b; cin >> a >> b; --a; --b;
		g[a].push_back(b);
		s[a].insert(b);
	}
}

bool check(int v, const Vi& path)
{
	set<int> vertices(ALL(path));

	for (int v_inPath : path)
	{
		int cnt = 0;
		for (int u : g[v_inPath])
			if (vertices.count(u))
				++cnt;

		if (cnt > 1)
			return false;
	}
	return true;
}

vector<int> dfs(int v, Vi& path)
{
	Vi ret;

	if (g[v].empty())
		return ret;

	if (visiting[v])
	{
		auto it = path.begin();
		while (*it != v)
			++it;

		Vi loopPath(it, path.end());

		if (check(v, loopPath))
			return loopPath;
		else
			return ret;
	}

	path.PB(v);
	visiting[v] = true;

	for (int adj : g[v])
	{
		ret = dfs(adj, path);
		if (!ret.empty())
			return ret;
	}

	path.pop_back();
	visiting[v] = false;
	done[v] = true;
	return ret;
}


int main()
{
	init();
	Vi v;

	REP(i, n)
	{
		if (done[i])
			continue;

		v.clear();
		Vi res = dfs(i, v);
		if (!res.empty())
		{
			cout << res.size() << endl;
			REP(j, SZ(res))
				cout << res[j] + 1 << endl;
			return 0;
		}
	}

	cout << -1 << endl;
}


Measured memory_bytes: 512
#include<stdio.h>

int main(void){
    int x[5];

    scanf("%d %d %d %d %d",&x[0],&x[1],&x[2],&x[3],&x[4]);

    for(int i = 0; i <= 4;i++){
        if(x[i] == 0){
            printf("%d",i+1);
            break;

        }
    }
}

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

int main() {
  vector<int> n(3);
  for (int i = 0; i < 3; i++) {
    cin >> n.at(i);
  }
  sort(n.begin(), n.end());
  cout << n[0] << " " << n[1] << " " << n[2] << endl;
}



Measured memory_bytes: 3136
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;

int digits(int x) {
  int d = 0;
  while (x > 0) {
    x = x / 10;
    d++;
  }
  return d;
}

int main() {
  //
  int n;
  cin >> n;
  int ans = 0;
  REP(i, 1, n + 1) {
    int d = digits(i);
    if (d & 1) ans++;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int main() {
  int N;
  cin >> N;
  
  vector<int> Ls(N);
  for (int n = 0; n < N; ++n) cin >> Ls[n];
  std::sort(Ls.begin(), Ls.end());
  
  long res = 0;
  for (int i = 0; i < N - 1; ++i) {
    for (int j = i + 1; j < N; ++j) {
      int a = Ls[i];
      int b = Ls[j];
      int small = max(a-b, b-a);
      int large = a+b;
      auto low = lower_bound(Ls.begin() + j + 1, Ls.end(), small);
      auto high = lower_bound(Ls.begin() + j + 1, Ls.end(), large);
      if (high - low > 0) {
        res += (high - low);
      }
    }
  }
  cout << res << endl;
  
  return 0;
}


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

using namespace std;

long long m, d;

int main(int argc, char const *argv[])
{
  long long d1, d2;
  long long cnt;
  cin >> m >> d;

  cnt = 0;
  for (long long i = 22; i <= d; i++) {
    d1 = i % 10;
    d2 = i / 10;
    if (d1 >= 2 && d2 >= 2  && d1 * d2 <= m) {
      cnt++;
    }
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <set>
#include <algorithm>
#include <vector>
using namespace std;

int main () {
  string h;
  int n;
  cin >> h >> n;
  set<int> D;
  for (int i = 0; i < n; i++) {
    int sub;
    cin >> sub;
    D.insert(sub);    
  }  
  int ok = -1;
  int hhh = stoi(h);
  if (ok != -1) {
  }
  else {
    for (int j = hhh; j < 100000; j++) {
      string hh = to_string(j);
      for (int i = 0; i < hh.size(); i++) {
        if (D.count(hh[i] - 48) == 1) {
          break;  
        }    
        if (i == hh.size() - 1) {
          cout << hh << endl;  
          return 0;
        }
      }    
    }      
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fin ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define w(t) while(t--)
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
#define what_is(x) cerr << #x << " is " << x << endl;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int main(){
    //freopen("in","r",stdin);
    //freopen("out","w",stdout);
    fin;
    int n, m, x;
    cin >> n >> m >> x;
    int v[200];
    cls(v, 0);
    fore(i, 0, m){
        int y;
        cin >> y;
        v[y] = 1;
    }
    int ans = 0;
    int tmp = 0;
    int i = x - 1;
    while(i >= 0)
        if(v[i--])
            ans++;
    i = x + 1;
    while(i <= n)
        if(v[i++])
            tmp++;
    cout << min(tmp, ans) << "\n";
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    return 0;
}   

Measured memory_bytes: 256
n = int(input())
ab =  [int(input()) for _ in range(n)]
abb = sorted(ab)

abc = sum(abb)

if abc %10 !=0:
    print(abc)

else:
    for i in range(n):
        if abb[i] % 10 !=0:
            print(abc-abb[i])
            exit()
    print(0)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
	string S;
	cin >> S;
	int N;
	cin >> N;
	REP(i, N)
	{
		string s;
		int a, b;
		cin >> s >> a >> b;
		if (s == "replace")
		{
			string c;
			cin >> c;
			FOR(i, b + 1, a)
			{
				S[i] = c[i - a];
			}
		}
		else if (s == "reverse")
		{
			std::reverse(S.begin() + a, S.begin() + b + 1);
		}
		else
		{
			FOR(i, b + 1, a)
			{
				cout << S[i];
			}
			cout << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3220
///AJoy Sarker ,CSE JAHANGIRNAGAR UNIVERSITY 48 Batch

#include<bits/stdc++.h>

using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define inf INT_MAX/3
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 3.141592653589793
#define in scanf
#define out printf
#define ll long long
#define ull unsigned long long
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}
int ara[50001];

int main()
{

    ios_base::sync_with_stdio(0);

      string s;bool ok=0;
      cin>>s;
      if(s[2]==s[3]&&s[4]==s[5]) ok=1;
      cout << (ok? "Yes" : "No" )<<"\n";

    return 0;
}





Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll fac(ll a) { return a > 1 ? fac(a - 1) * a : 1; }
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  ll n,a,b;
  cin >> n >> a >> b;
  ll A,B,C,D;
  if(abs(b - a) % 2 == 0){ 
    A = (b - a) / 2;
    cout << A << endl;
  }
  else{
    A = max(abs(n - b),abs(n - a));
    B = max(abs(1 - b),abs(1 - a));
    ll aa = a;
    ll bb = b;
    C += abs(1 - a);
    bb -= C;
    C++;
    bb--;
    if(bb != 1)C += abs(1 - bb) / 2;
    
    D += abs(n - b);
    aa += D;
    D++;
    a++;
    if(aa != n)D += abs(n - aa) / 2;
    cout << min({A,B,C,D}) << endl;
  }
  return 0;
}

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

int main(){
	int a[5],ans=0;
	int x,y;
	for(int i=0;i<3;i++){
		cin>>x>>y;
		a[x]++;
		a[y]++;
	}
	for(int i=1;i<=4;i++){
		if(a[i]==0){
			cout<<"NO\n";
			return 0;
		}
		if(a[i]%2==1) ans++;
	}
	if(ans<=2) cout<<"YES\n";
	else cout<<"NO\n";
	return 0;
}


Measured memory_bytes: 256
import numpy as np
N = int(input())
A = np.array(input().split(), dtype=np.int32)
B = np.array(input().split(), dtype=np.int32)
	
bit = 1 << 28
mask = 2 * bit - 1

answer = 0
while bit:
  A &= mask
  B &= mask
  A.sort()
  B.sort()

  x1,x2,x3 = (np.searchsorted(B, v-A).sum() for v in [bit, 2*bit, 3*bit])
  zero_cnt = x1 + (x3-x2)
  if (N-zero_cnt)%2:
    answer += bit
  bit >>= 1
  mask >>= 1

print(answer)

Measured memory_bytes: 35928
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int k;
int loop(int a){
  if(a<k)
    return 0;
  if(a%k==0)
    return a/k;
  int tmp=a/k*k, tmp1=a%k, tmp2=a/k;
  tmp1%=tmp2+1;
  if(tmp1==0)
    return tmp2;
  return loop(tmp-tmp2+tmp1-1);
}

int main(){
  int n, a;
  while(cin>>n){
    ll tmp=0;
    for(int i=0; i<n; ++i){
      cin>>a>>k;
      tmp^=loop(a);
    }
    if(tmp==0)
      cout<<"Aoki"<<endl;
    else
      cout<<"Takahashi"<<endl;
  }
  return 0;
}




Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
int main(){
    int n;
    cin>>n;
    int a[n];
    rep(i,0,n){
        cin>>a[i];
        a[i]-=i;//あらかじめiを引いておきましょう
    }
    sort(a,a+n);
    int median;
    median=a[(n-1)/2];//ソートして中央値を取ります
/*要素数が奇数の場合
左の(n-1)/2個が中央値より小さい
右の(n-1)/2個が中央値より大きい
中央の1個が中央値と等しい
ので1増やしても1減らしても1悲しくなる

要素数が偶数の場合
左と中央のn/2個が中央値より小さい
右のn/2個が中央値より大きい
ので1増やしても1減らしても変わらない

よって中央値を取れば良い
*/
    ll cnt=0; //10^5*10^9なのでintは足りません
    rep(i,0,n)cnt+=abs(a[i]-median);//絶対値abs
    cout<<cnt;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main()
{
  int a,b;

  cin >> a >> b;

  if(a%3 == 0 || b%3 == 0 || (a+b)%3 == 0) cout << "Possible" << endl;
  else cout << "Impossible" << endl;

  return 0;
}

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

int main(void){
  int x[12][12],N,D,i,j,d,k,count;
  char str[100],*p;
  
  fgets(str,sizeof(str),stdin);
  p=strtok(str," \n");
  N=atoi(p);
  p=strtok(NULL," \n");
  D=atoi(p);
  
  for(i=0;i<N;i++){
    fgets(str,sizeof(str),stdin);
  	p=strtok(str," \n");
    x[i][0]=atoi(p);
    for(j=1;j<D;j++){
      p=strtok(NULL," \n");
      x[i][j]=atoi(p);
    }
  }
  
  count=0;
  
  for(i=0;i<N-1;i++){
    for(j=i+1;j<N;j++){
      for(k=0,d=0;k<D;k++){
        d+=(x[j][k]-x[i][k])*(x[j][k]-x[i][k]);
      }
      for(k=1;k*k<=d;k++){
        if(d%k==0 && d/k==k){
          count++;
          break;
        }
      }
    }
  }
  
  printf("%d\n",count);
  
  return 0;
}

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

int main()
{

  ll n, a=0, b=0, c=0, d=0;
	string s;
	cin>>n;
	while(n--){
		cin>>s;
		if(s=="AC")
		a++;
		else if(s=="WA")
		b++;
		else if(s=="TLE")
		c++;
		else
		d++;
	}
	cout<<"AC x "<<a<<"\n";
	cout<<"WA x "<<b<<"\n";
	cout<<"TLE x "<<c<<"\n";
	cout<<"RE x "<<d;
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
ll mod = 1e9 + 7;

using namespace std;



int main()

{
	int x,y;

	cin >> x >> y;
	if (x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12)
	{
		x = 31;
	}
	else if(x == 4 || x == 6 || x == 9 || x == 11)
	{
		x = 30;
	}
	else
	{
		x = 28;
	}

	if (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12)
	{
		y = 31;
	}
	else if (y == 4 || y == 6 || y == 9 || y == 11)
	{
		y = 30;
	}
	else
	{
		y = 28;
	}

	if (x == y)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
	
}


Measured memory_bytes: 256
S = input()
N = len(S)-1
ans = 0
for x in range(2 ** N):
  pvj = 0
  for j in range(N):
    if (x >> j) & 1:
      ans += int(S[pvj:j+1])
      pvj = j+1
  ans += int(S[pvj:N+1])
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  int ans = 0;
  for (int i = 1; i * i <= M; i++){
    if (M % i == 0){
      if (M / i >= N){
        ans = max(ans, i);
      }
      if (i >= N){
        ans = max(ans, M / i);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
a, b = map(int, input().split())
s = list(input())

flag1 = False
if s[a] == '-':
    flag1 = True

flag2 = False
if not '-' in s[:a - 1] and not '-' in s[a + 1:]:
    flag2 = True

if flag1 and flag2:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
class Factorial():
    def __init__(self, mod=10**9 + 7):
        self.mod = mod
        self._factorial = [1]
        self._size = 1
        self._factorial_inv = [1]
        self._size_inv = 1

    def __call__(self, n):
        return self.fact(n)

    def fact(self, n):
        ''' n! % mod '''
        if n >= self.mod:
            return 0
        self._make(n)
        return self._factorial[n]
    
    def _make(self, n):
        if n >= self.mod:
            n = self.mod
        if self._size < n+1:
            for i in range(self._size, n+1):
                self._factorial.append(self._factorial[i-1]*i % self.mod)
            self._size = n+1

    def fact_inv(self, n):
        ''' n!^-1 % mod '''
        if n >= self.mod:
            raise ValueError('Modinv is not exist! arg={}'.format(n))
        self._make(n)
        if self._size_inv < n+1:
            self._factorial_inv += [-1] * (n+1-self._size_inv)
            self._size_inv = n+1
        if self._factorial_inv[n] == -1:
            self._factorial_inv[n] = self.modinv(self._factorial[n])
        return self._factorial_inv[n]
    
    @staticmethod
    def xgcd(a, b):
        '''
        Return (gcd(a, b), x, y) such that a*x + b*y = gcd(a, b)
        '''
        x0, x1, y0, y1 = 0, 1, 1, 0
        while a != 0:
            (q, a), b = divmod(b, a), a
            y0, y1 = y1, y0 - q * y1
            x0, x1 = x1, x0 - q * x1
        return b, x0, y0

    def modinv(self, n):
        g, x, _ = self.xgcd(n, self.mod)
        if g != 1:
            raise ValueError('Modinv is not exist! arg={}'.format(n))
        return x % self.mod

    def comb(self, n, r):
        ''' nCr % mod '''
        if r > n:
            return 0
        t = self(n)*self.fact_inv(n-r) % self.mod
        return t*self.fact_inv(r) % self.mod

    def comb_with_repetition(self, n, r):
        ''' nHr % mod '''
        t = self(n+r-1)*self.fact_inv(n-1) % self.mod
        return t*self.fact_inv(r) % self.mod

    def perm(self, n, r):
        ''' nPr % mod '''
        if r > n:
            return 0
        return self(n)*self.fact_inv(n-r) % self.mod

n, m, k = map(int, input().split())
mod = 998244353
comb = Factorial(mod).comb
s = 0
for i in range(k+1, n):
    t = comb(n-1, i)*m % mod
    t = t*pow(m-1, n-1-i, mod) % mod
    s = (s+t) % mod
ans = (pow(m, n, mod)-s) % mod
print(ans)


Measured memory_bytes: 24604
#include <bits/stdc++.h>
#define int long long
#define N 100010
#define rank Asdfiasofsad
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}


class UF{
public:
  int V;
  vector<int> par,rank,num;
  UF(){}
  UF(int V):V(V),par(V),rank(V,0),num(V,1){for(int i=0;i<V;i++)par[i]=i;}
  
  int find(int x){
    assert(x < V);
    if(par[x]==x)return x;
    return par[x]=find(par[x]);
  }
  
  void unite(int x,int y){
    x=find(x), y=find(y);
    if(x==y)return;
    if(rank[x]<rank[y]) par[x] = y, num[y] += num[x], num[x] = 0;
    else{
      par[y]=x, num[x] += num[y], num[y] = 0;
      if(rank[x]==rank[y]) rank[x]++;
    }
  }

  bool same(int x,int y){return find(x)==find(y);}
};

int mod_pow(int x,int y){
  int res = 1;
  for(int i=0;i<y;i++) res = res * x % mod;
  return res;
}

signed main(){
  while(1){
    int n,m;
    cin>>n>>m;
    if(!n && !m) break;
    UF U(n);
    for(int i=0;i<m;i++){
      int a,b;
      cin>>a>>b; a--,b--;
      U.unite(a,b);
    }
  
    set<int> grp;
    for(int i=0;i<n;i++) grp.insert(U.find(i));
    int ans = (mod_pow(2,grp.size()) + ((int)grp.size() != n)) % mod;
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 9952
import itertools
N=int(input())
S=list(str(input()) for i in range(N))
m,a,r,c,h=[0]*5
ans=0
for i in range(len(S)):
  if S[i][0]=="M":m+=1
  if S[i][0]=="A":a+=1
  if S[i][0]=="R":r+=1
  if S[i][0]=="C":c+=1
  if S[i][0]=="H":h+=1

x=[m,a,r,c,h]
for i in itertools.combinations(x,3):
  ans+=i[0]*i[1]*i[2]
print(ans)

Measured memory_bytes: 9784
package main

import "fmt"

func main() {
	var n int

	fmt.Scanf("%d", &n)

	hon_list := []int{2,4,5,7,9}

	pon_list := []int{0,1,6,8}

	if contains(hon_list, n % 10)  {
		fmt.Printf("hon")
	} else if contains(pon_list, n % 10) {
		fmt.Printf("pon")
	} else {
		fmt.Printf("bon")
	}
}

func contains(arr []int, i int) bool {
	for _, a := range arr {
		if a == i {
			return true
		}
	}
	return false
}

Measured memory_bytes: 1816
n, y = map(int, input().split())
for a in range(n+1):
    for b in range(n+1):
        c = n - (a+b)
        if a*10000 + b*5000 + c*1000 == y and a+b+c == n and c >= 0:
            print(a, b, c)
            exit()
print('-1 -1 -1')

Measured memory_bytes: 9148
#include <algorithm>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#define Re register
#define LL long long
#define U unsigned
#define FOR(i,a,b) for(Re int i = a;i <= b;++i)
#define ROF(i,a,b) for(Re int i = a;i >= b;--i)
#define SFOR(i,a,b,c) for(Re int i = a;i <= b;i+=c)
#define SROF(i,a,b,c) for(Re int i = a;i >= b;i-=c)
#define CLR(i,a) memset(i,a,sizeof(i))
#define BR printf("--------------------\n")
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
namespace fastIO{
    #define BUF_SIZE 100000
    #define OUT_SIZE 100000
    #define ll long long
    bool IOerror=0;
    inline char nc(){
        static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;
        if (p1==pend){
            p1=buf; pend=buf+fread(buf,1,BUF_SIZE,stdin);
            if (pend==p1){IOerror=1;return -1;}
        }
        return *p1++;
    }
    inline bool blank(char ch){return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';}
    inline void read(int &x){
        bool sign=0; char ch=nc(); x=0;
        for (;blank(ch);ch=nc());
        if (IOerror)return;
        if (ch=='-')sign=1,ch=nc();
        for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';
        if (sign)x=-x;
    }
    inline void read(ll &x){
        bool sign=0; char ch=nc(); x=0;
        for (;blank(ch);ch=nc());
        if (IOerror)return;
        if (ch=='-')sign=1,ch=nc();
        for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';
        if (sign)x=-x;
    }
    #undef ll
    #undef OUT_SIZE
    #undef BUF_SIZE
};
using namespace fastIO;
const int MAXN = 100000+5; 
#define int LL
int a[MAXN],N;
long double b[MAXN];
int T,A; 
long double min;int num;
signed main(){
	read(N);
	read(T);read(A);
	FOR(i,1,N) read(a[i]);
	FOR(i,1,N) b[i] = (long double)T-(long double)0.006*(long double)a[i];
	min = std::fabs(b[1]-(long double)A);num = 1;
	FOR(i,2,N){
		if(min > std::fabs(b[i]-(long double)A)){
			min = std::fabs(b[i]-(long double)A);
			num = i;
		}
	}
	printf("%lld\n",num);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <utility>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <deque>
#include <cstdlib>
#include <set>
#include <chrono>
#include <climits>
#include <unordered_map>
#include <iomanip> 

#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define repf(i,st,end,inc) for(int i = st; i < end; i += inc)
#define repb(i,st,end,dec) for(int i = st; i >= end; i -= dec) 

#define MOD 1000000007

#define trace1(a) cout << a << endl;
#define trace2(a,b) cout << a << " | " << b << endl;
#define trace3(a,b,c) cout << a << " | " << b << " | " << c << endl;
#define trace4(a,b,c,d) cout << a << " | " << b << " | " << c << " | "<< d << endl;

using namespace std;
using namespace std::chrono;


int main(){
	fast;
	#ifdef LOCAL_PROJECT
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif

	auto start = high_resolution_clock::now(); 

	string s, t;
	cin >> s >> t;

	int n = s.size();
	int m = t.size();

	vector<vector<int>> dp(n+1, vector<int>(m+1, 0));
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			if(s[i-1] == t[j-1])
				dp[i][j] = 1 + dp[i-1][j-1];
			else
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
		}
	}

	string ans = "";

	int i = n-1;
	int j = m-1;
	while(i >= 0 && j >= 0){
		if (s[i] == t[j]){
			ans = s[i] + ans;
			i--;
			j--;
		}
		else{
			if (dp[i][j+1] > dp[i+1][j])
				i--;
			else
				j--;
		}
	}

	cout << ans << "\n";

	auto stop = high_resolution_clock::now(); 
	auto duration = duration_cast<microseconds>(stop - start);	
	// cout << endl;
	// cout << fixed << setprecision(9) << double(duration.count()) / 1000000 << endl; 

	return 0;
}


Measured memory_bytes: 35584
#include <iostream>
#include <unordered_set>
#include <utility>
using namespace std;
using ll = long long;

struct phash {
	inline size_t operator()(const pair<int, int> &p) const {
		const auto h1 = hash<int>()(p.first);
		const auto h2 = hash<int>()(p.second);
		return h1 ^ (h2 << 1);
	}
};

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

	int H, W, M;
	cin >> H >> W >> M;
	unordered_set<pair<int, int>, phash> tg;
	int *sumr, *sumc;
	sumr = new int[H]();
	sumc = new int[W]();
	for (int i = 0; i < M; i++) {
		int h, w;
		cin >> h >> w;
		h--, w--;
		tg.insert(make_pair(h, w));
		sumr[h]++;
		sumc[w]++;
	}

	unordered_set<int> maxi, maxj;
	int maxsumr = 0, maxsumc = 0;
	for (int i = 0; i < H; i++) {
		if (sumr[i] > maxsumr) {
			maxi.clear();
			maxsumr = sumr[i];
			maxi.insert(i);
		} else if (sumr[i] == maxsumr) {
			maxi.insert(i);
		}
	}
	for (int j = 0; j < W; j++) {
		if (sumc[j] > maxsumc) {
			maxj.clear();
			maxsumc = sumc[j];
			maxj.insert(j);
		} else if (sumc[j] == maxsumc) {
			maxj.insert(j);
		}
	}
	ll n = maxi.size() * maxj.size();
	for (auto p : tg) {
		if (maxi.count(p.first) && maxj.count(p.second)) {
			n--;
		}
		if (n == 0) {
			break;
		}
	}
	cout << maxsumr + maxsumc - (n == 0) << "\n";
	return 0;
}


Measured memory_bytes: 46416
import java.util.*;


public class Main{
	public static boolean is_able_triangle(Integer a, Integer b, Integer c){
		int a_int = a.intValue();
		int b_int = b.intValue();
		int c_int = c.intValue();
		if(a_int == Math.max(a_int, Math.max(b_int, c_int)))
			return (a_int < c_int + b_int);
		if(b_int == Math.max(a_int, Math.max(b_int, c_int)))
			return (b_int < a_int + c_int);
		if(c_int == Math.max(a_int, Math.max(b_int, c_int)))
			return (c_int < a_int + b_int);
      	return false;
	};

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		long result = 0;

		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();

		String inputArray[] = sc.nextLine().split(" ");
		for(int i = 0; i < n; i++){
			int key =  Integer.parseInt(inputArray[i]);
			if(map.get(key) == null){
				map.put(key, 1);
			}
			else{
				map.put(key, map.get(key) + 1);
			}
		}

		Collection<Integer> keysToArray = map.keySet();
		Integer[] length_array = keysToArray.toArray(new Integer[keysToArray.size()]);

		for(int f = 0; f < map.size() - 2; f++){
			for(int s = f+1; s < map.size() - 1; s++){
				for(int t = s+1; t < map.size(); t++){
					if (is_able_triangle(length_array[f], length_array[s], length_array[t])){
						// System.out.println("this is triangle");
						result += map.get(length_array[f]) * map.get(length_array[s]) * map.get(length_array[t]);
						// System.out.println( map.get(length_array[f]) * map.get(length_array[s]) * map.get(length_array[t]));
					}
				}
			}
		}


		// map.keySet().forEach( key->{
		// 		System.out.println(key + " " + map.get(key));
		// 	}
		// );
		System.out.println(result);
	}
}


Measured memory_bytes: 38080
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  ll N,K;
  cin>>N>>K;
  vector <ll> a(N);
  for(ll i = 0;i<N;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  ll ans = 0;
  for(ll i = 0;i<N;i++){
    if(K>0){
      K--;
    }
    else{
      ans += a[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
n = int(input())
a = list(map(int,input().split()))
b1 = []
b2 = []
for i in range(n):
    if i%2==0:b1.append(a[i])
    else:b2.append(a[i])

if n%2==0:
    b2.reverse()
    print(*b2+b1)
else:
    b1.reverse()
    print(*b1+b2)

Measured memory_bytes: 106836
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PI 3.14159265358979
#define EPS 1e-8
#define mod 1000000007
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define endl "\n"
	 
const ll INF=(ll)2e18;
		
		
		
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
				
	ll n;
	cin>>n;
	
	vector<ll> v(3*n+1);
	for(ll i=1;i<=(3*n);i++)
	{
		cin>>v[i];
	}
	
	multiset<ll> s;
	
	vector<ll> dp(3*n+1);
	
	ll sum=0;
	for(ll i=3*n;i>2*n;i--)
	{
		s.insert(v[i]);
		sum+=v[i];
	}
	dp[2*n+1]=sum;
	
	for(ll i=2*n;i>n;i--)
	{
		
		if((*s.rbegin())>v[i])
		{
			sum-=*s.rbegin();
			s.erase(--s.end());
			s.insert(v[i]);
			sum+=v[i];
			dp[i]=sum;
		
		}
		else
		{
			dp[i]=sum;
		}
		//cout<<i<<" "<<dp[i]<<endl;
	}
	s.clear();
	sum=0;
	for(ll i=1;i<=n;i++)
	{
		sum+=v[i];
		s.insert(v[i]);
	}
	ll ans=sum-dp[n+1];
	//cout<<1<<" "<<sum<<" "<<dp[n+1]<<endl;
	for(ll i=n+1;i<=2*n;i++)
	{
		if(*s.begin()<v[i])
		{
			sum-=*s.begin();
			s.erase(s.begin());
			s.insert(v[i]);
			sum+=v[i];
			
			
		}
		//cout<<i<<" "<<sum<<" "<<dp[i+1]<<endl;
		ans=max(ans,sum-dp[i+1]);
	}
	cout<<ans;
}


Measured memory_bytes: 9600
/*2020/03/22 ABC 159*/

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;  
const long long INF = 1LL << 60;


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

    int ni, mi;
    ni = n * (n - 1) / 2;
    mi = m * (m - 1) / 2;
    
    cout << ni + mi << endl;
    
    return 0;
}


Measured memory_bytes: 256
S=input()
flag1=int(S[:2])<=12 and 0<int(S[:2])
flag2=int(S[2:])<=12 and 0<int(S[2:])
if flag1:
    if flag2:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif flag2:
    print('YYMM')
else:
    print('NA')

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

int main() {
  int N, Y;
  cin >> N >> Y;
  int a = 10000;
  int b = 5000;
  int c = 1000;
  int x, y, z;

  bool breakFlg = false;
  for (int i=0; i<=N; i++){
    for (int j=0; j<=(N-i); j++){
      for (int k=0; k<=(N-(i+j)); k++){
        if (i+j+k != N) continue;
        if ((a * i + b * j + c * k) == Y) {
          cout << i << ' ' << j << ' ' << k << endl;
          breakFlg = true;
          break;
        }
      }
      if (breakFlg) break;
    }
    if (breakFlg) break;
  }
  
  if (!breakFlg) cout << "-1 -1 -1" << endl;
  
}

Measured memory_bytes: 256