akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

//Main
var sc = bufio.NewScanner(os.Stdin)
var a, b int

func main() {
	sc.Split(bufio.ScanWords)
	a, b = nextInt(), nextInt()
	if a*b%2 == 0 {
		fmt.Println("Even")
	} else {
		fmt.Println("Odd")
	}

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,m,n) for (int i = m; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
inline int popcount(const int x) { return __builtin_popcount(x);}
template<class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b;}
template<class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b;}
template<class T> void drop(const T &x) { std::cout<<x<<endl; exit(0);}
void debug_out() { std::cout << "\n";}
template<class T, class... Args> void debug_out(const T &x, const Args &... args) { std::cout<<x<< " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

struct InitIO{
  InitIO() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
  }
}init_io;

int main() {
  int r, g, b, k;
  cin >> r >> g >> b >> k;
  rep(i, k) {
    if (b > g and g > r) break;
    if (g <= r) g *= 2;
    else if (b <= g) b *= 2;
  }
  if (b > g and g > r) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}

Measured memory_bytes: 3652
#include <stdio.h> 

int main(void) {
	int a[6], b[6], c[6], ans[3];
	int i, j, k;
	
	for(i = 0; i < 6; i++ ) {
		scanf("%d",&a[i]);
	}
	for(i = 0; i < 6; i++ ) {
		scanf("%d",&b[i]);
	}
	for(i = 0; i < 6; i++ ) {
		scanf("%d",&c[i]);
	}


	for(i = 0; i < 3; i++ ) {
		ans[i] = a[i+3] - a[i];
	}
	for(i = 2; i > 0; i-- ) {
		if(ans[i] < 0 ) {
			ans[i-1]--;
			ans[i] += 60;
		}
	}
	for(i = 0; i < 3; i++ ) {
		printf("%d",ans[i]);
		if(i == 0|| i == 1) {
			printf(" ");
		}
	}
	puts("");

	for(i = 0; i < 3; i++ ) {
		ans[i] = b[i+3] - b[i];
	}
	for(i = 2; i > 0; i-- ) {
		if(ans[i] < 0 ) {
			ans[i-1]--;
			ans[i] += 60;
		}
	}
	for(i = 0; i < 3; i++ ) {
		printf("%d",ans[i]);
		if(i == 0|| i == 1) {
			printf(" ");
		}
	}
	puts("");

	for(i = 0; i < 3; i++ ) {
		ans[i] = c[i+3] - c[i];
	}
	for(i = 2; i > 0; i-- ) {
		if(ans[i] < 0 ) {
			ans[i-1]--;
			ans[i] += 60;
		}
	}
	for(i = 0; i < 3; i++ ) {
		printf("%d",ans[i]);
		if(i == 0|| i == 1) {
			printf(" ");
		}
	}
	puts("");

	return 0;
}

Measured memory_bytes: 616
#include<iostream>
using namespace std;
int main()
{
  string n;
  cin >> n;
  
  for(int i = 0;i < 3; i++){
    if(n[i] == '1'){
      n[i] = '9';
    }else if(n[i] == '9'){
      n[i] = '1';
    }
    cout << n[i];
  }
}
  

Measured memory_bytes: 256
main(){
    int a[3],tmp;
    scanf("%d%d%d",&a[0],&a[1],&a[2]);
    for(int i=0;i<2;i++){
        for(int j=0;j<2;j++){
            if(a[j]>a[j+1]){
                tmp=a[j];
                a[j]=a[j+1];
                a[j+1]=tmp;
            }
        }
    }
    printf("%d %d %d\n",a[0],a[1],a[2]);
}


Measured memory_bytes: 2080
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
bool b[1000];
int main()
{
    FASTINOUT;
    int x,k,d,y,ans=0;
    cin>>x>>k;
    for (int i=0;i<k;i++){
        cin>>d;
        for(int j=0;j<d;j++){
            cin>>y;
            b[y]=1;
        }
    }
    for (int i=1;i<=x;i++){
        if (!b[i])
            ans++;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3640
N, M = map(int, input().split())
L = list(map(int, input().split()))

if N not in L:
  print(N)
else:
  for i in range(N,10000000000):
    i +=1
    if i not in L:
      box = i
      break
  for j in reversed(range(-10000000000, N+1)):
    j -=1
    if j not in L:
      boxm = j
      break
  if abs(N - abs(box)) >= abs(N - abs(boxm)):
    print(boxm)
  else:
    print(box)

Measured memory_bytes: 9076
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N,T,A; cin>>N>>T>>A;
    vector<int> H(N);
    rep(n,0,N) cin>>H.at(n);

    int ans;
    double minD=DBL_MAX;
    rep(n,0,N){
        double t=T-H.at(n)*0.006;
        if(minD>abs(t-A)){
            ans=n+1;
            minD=abs(t-A);
        }
    }

    cout<<ans<<endl;
}

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

template<typename T>
istream& operator>> (istream& is, vector<T> &vec){
    for(T& x: vec) is >> x;
    return is;
}

int main(){
    ll n, k; cin >> n >> k;
    vector<ll> z, kk;
    for(ll i = 1; i <= n; ++i){
        if(i%k == 0) z.push_back(i);
        if(i%k*2 == k) kk.push_back(i);
    }
    ll ans = pow(z.size(), 3) + pow(kk.size(), 3);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5164
#include<bits/stdc++.h>
using namespace std;
int main(){
  int d;cin >> d;
  if(d==25) cout << "Christmas" << endl;
  if(d==24) cout << "Christmas Eve" << endl;
  if(d==23) cout << "Christmas Eve Eve" << endl;
  if(d==22) cout << "Christmas Eve Eve Eve" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
    int N,X;
    scanf("%d %d",&N,&X);
    int m[N],i,min;
    for(i=0;i<N;i++){
        scanf("%d",&m[i]);
        if(i==0){
            min = m[i];
        }
        else{
            if(min>m[i]){
                min = m[i];
            }
        }
        X -= m[i];
    }
    
    printf("%d",N + (X / min));
    
}


Measured memory_bytes: 128
n, m = map(int, input().split())
pref = [[] for _ in range(n)]
p_list = [[] for _ in range(m)]
y_to_num = dict()
for i in range(m):
	p, y = map(int, input().split())
	pref[p-1].append([y, i])
	p_list[i] = [p, y]
for i in range(n):
	pref[i] = sorted(pref[i])
#ans = [[] for _ in range(m)]

for i in range(n):
	for j in range(len(pref[i])):
		y_to_num[pref[i][j][0]] = j+1

for i in range(m):
	print(str(10 ** 12 + (10 ** 6) * p_list[i][0] + y_to_num[p_list[i][1]])[1:])

Measured memory_bytes: 53252
#!/usr/bin/env python3
ans=0
n=int(input())
p=list(map(int,input().split()))
b=[0]*(n+1)
for i in range(n):
    b[p[i]]=i+1
LL=[0]+[i for i in range(n+1)]
RR=[i for i in range(1,n+2)]+[n+1]
for i in range(1,n+1):
    l1=LL[b[i]]
    l0=LL[l1]
    r0=RR[b[i]]
    r1=RR[r0]
    ans+=((l1-l0)*(r0-b[i])+(r1-r0)*(b[i]-l1))*i
    LL[r0]=l1
    RR[l1]=r0

print(ans)


Measured memory_bytes: 20196
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
	ll flag=0;
	char s[20];
	scanf(" %s",s);
	ll n=strlen(s);
	if(n%2!=0)
	{
		flag=1;
	}
	else
	{
		for(ll i=0;i<n;i++)
		{
			if(i%2==0)
			{
				if(s[i]!='h')
				{
					flag=1;
				}
			}
			else
			{
				if(s[i]!='i')
				{
					flag=1;
				}
			}
		}
	}
	if(flag)
	{
		printf("No\n");
	}
	else
	{
		printf("Yes\n");
	}
}

Measured memory_bytes: 256
#include<queue>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
inline void read(int &x)
{
	x=0;
	int p=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')p=-1;c=getchar();}
	while(isdigit(c)) {x=(x<<1)+(x<<3)+(c^'0');c=getchar();}
	x*=p;
}
char s[201000];
char a[201000];
int main()
{
	scanf("%s",s+1);
	int len=strlen(s+1);
	int cnt=0;
	for(int i=1;i<=len;i++)
		if(s[i]!='x')a[++cnt]=s[i];
	int pd=0;
	for(int i=1;i<=cnt/2;i++)
		if(a[i]!=a[cnt-i+1]){pd=1;break;}
	if(pd)
	{
		puts("-1");
		return 0;
	}
	if(cnt==len)
	{
		puts("0");
		return 0;
	}
	int ans=0;
	int cntt=0;
	for(int i=1;i<=(len-cntt)/2;i++)
	{
		if(s[i]!=s[len-i+1-cntt])
		{
			if(s[i]=='x')ans++,len++;
			else if(s[len-i+1-cntt]=='x')ans++,i--,cntt++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define SFOR(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define INF INT_MAX
#define endl '\n'
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
int main(){
   cin.tie(0);
   ios::sync_with_stdio(false);
   int a,p;
   cin>>a>>p;
   p+=a*3;
   cout<<p/2<<endl;
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;
struct node
{
	int u,v,w;
};

node a[70];
int cnt=0;
void add(int u,int v,int w)
{
	cnt++;
	a[cnt].u=u;a[cnt].v=v;a[cnt].w=w;
}
int main()
{

	int L;
	scanf("%d",&L);
	int tmp=L;
	int n=0;
	while(tmp){
		n++;
		tmp>>=1;
	}
	for(int i=1;i<n;i++){
		add(i,i+1,1<<(i-1));
		add(i,i+1,0);
	}
	int w=1<<(n-1),k=1;;
	while(L!=1){
		if(L&1) {
			add(k,n,w);
			w|=1<<(k-1);
		}
		k++;
		L>>=1;
	}
	printf("%d %d\n",n,cnt);
	for(int i=1;i<=cnt;i++){
		printf("%d %d %d\n",a[i].u,a[i].v,a[i].w);
	}


	return 0;
}


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

int main (void) {
    int n;
    scanf("%d", &n);
    long long sum=0;
    int a[n+2];
    a[0] = a[n+1] = 0;
    for ( int i=1; i<=n; i++ )
        scanf("%d", &a[i]);

    for ( int i=1; i<=n+1; i++ )
        sum += abs(a[i] - a[i-1]);

    int minus, plus;
    for ( int i=1; i<=n; i++ ) {
        minus = abs(a[i] - a[i-1]) + abs(a[i+1] - a[i]);
        plus  = abs(a[i+1] - a[i-1]);
        printf("%lld\n", sum - minus + plus);
    }

    return EXIT_SUCCESS;
}


Measured memory_bytes: 1536
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_C
{
    class C079
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int[] g = s.Select(x => x - '0').ToArray();


            for (int i = 0; i < 8; i++)
            {
                int[] h = (int[])g.Clone();
                int k = i;
                for (int j = 0; j < 3; j++)
                {
                    if (k % 2 == 1)
                    {
                        h[j + 1] *= -1;
                    }
                    k /= 2;

                }

                if (h.Sum() == 7)
                {

                    string r = g[0].ToString();
                    for(int j = 0; j < 3; j++)
                    {
                        if (h[j+1] >= 0) r += "+" + h[j+1];
                        else r += h[j+1];
                    }
                    r += "=7";
                    Console.WriteLine(r);
                    break;
                }
            }
        }

    }
}


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

int main(void) {
	long long n;
	std::cin >> n;
	std::vector<long long> a(n);
	for (int i = 0; i < n; i++) {
		std::cin >> a[i];
		a[i] -= (i + 1);
	}
	std::sort(a.begin(), a.end());

	int m = n / 2;
	long long b[4] = { a[m], a[m + 1], a[m - 1] };

	long long ans = 1e18;
	for (int i = 0; i <= 2; i++) {
		long long tb = b[i];
		long long res = 0;
		for (int j = 0; j < n; j++) {
			res += abs(a[j] - tb);
		}
		ans = ans > res ? res : ans;
	}
	std::cout << ans << std::endl;
	return 0;
}

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

const int MAX_M = 50 + 5;
const int MAX_N = 50 + 5;

int n, m;
int a[MAX_M], b[MAX_M];

vector<vector<int>> graph(MAX_N, vector<int>(0));
bool vis[MAX_N];

bool conn(int es, int et) {
  stack<int> s;
  s.push(1);

  fill(vis, vis + MAX_N, false);
  while (!s.empty()) {
    int cur = s.top(); s.pop();
    vis[cur] = true;

    for (int i = 0; i < graph[cur].size(); ++i) {
      int tar = graph[cur][i];
      if (!(cur == es && tar == et) && !(cur == et && tar == es) && !vis[tar]) s.push(tar);
    }
  }
  bool ans = true;
  for (int i = 1; i <= n; ++i) {ans &= vis[i];}
  return ans;
}


int main(void){
  // Here your code !
  scanf("%d %d", &n, &m);

  for (int i = 0; i < m; ++i) {
    scanf("%d %d", &a[i], &b[i]);
    graph[a[i]].push_back(b[i]);
    graph[b[i]].push_back(a[i]);

  }

  int last = 0;
  for (int i = 0; i < m; ++i) {
    if (!conn(a[i], b[i])) last++;
  }

  printf("%d\n", last);

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    int N; cin >> N; int H[N],x=0; int ans=0;
    rep(i,N) {cin >> H[i]; x=max(x,H[i]);}
    rep(i,x){
        int pos=0; bool can = false;
        for(int j=1;j<N;j++){
            if(H[j]<=0 && H[j-1]>0) can = true;
            if(H[j]>0 && H[j-1]<=0 && can){
                pos++; can = false;
            } 
        }
        ans += pos+1;
        rep(j,N) H[j]--;
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main(void) {
    long n, k;
    cin >> n >> k;

    long a = 0, b = 0;
    for(long i=1; i<=n; i++)
        a += i%k==0, b += i%k == k/2;

    long r = 0;
    r += a*a*a;
    if(~k&1)
        r += b*b*b;
    cout << r << endl;
}


Measured memory_bytes: 384
from sys import stdin
input = stdin.readline
N = int(input())
A = list(map(int, input().split()))

AA=[0]*N
AA[0]=A[0]
c=0
for i in range(1,N):
  if A[i]>=AA[i-1]:AA[i]=A[i]
  else:AA[i]=AA[i-1]
  c=c+AA[i]-A[i]
print(c)

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

int main() {
  int N, i, m;
  cin >> N;
  m = N % 2;
  int sum = 0;
  vector<int> card(N);
  for(i = 0; i < card.size() ; i++){
    cin >> card.at(i);
  }
  sort(card.begin(), card.end());
  reverse(card.begin(), card.end());
  if(m == 0){
    for(i = 0; i < card.size() ; i += 2 ){
      sum += card.at(i) - card.at(i + 1);
    }
  }
  else{
    for(i = 0; i < card.size() - 2 ; i += 2 ){
      sum += card.at(i) - card.at(i + 1);
    }
	sum += card.at(N - 1);    
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int vis[200007],a[200007],c[200007],n;
long long k;
int main()
{
    scanf("%d%lld",&n,&k);

    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    int x=1,cnt=0;
    while(k)
    {
        if(vis[x]){
            long long y=cnt-vis[x]+1;
            k%=y;
            if(k==0) break;
        }
        else{
            vis[x]=++cnt;
            c[cnt]=x;
        }
        x=a[x];
        k--;
    }

    printf("%d\n",x);

    return 0;
}


Measured memory_bytes: 5876
#include <bits/stdc++.h>
using namespace std;
#ifdef _IS_LOCAL //
#define dout cout
#define debug() if (true)
#define dvout(v) vout(v)
#else
#define dout   \
	if (false) \
	cout
#define debug() if (false)
#define dvout if(false) cout
#endif //
#define next asdnext
#define prev asdprev
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define vrep(i, v) for (auto &i : v)
#define all(x) (x).begin(), (x).end()
#define vout(v)           \
	for (auto &i : v)     \
	{                     \
		cout << i << " "; \
	}                     \
	cout << "\n"; //配列出力
#define vin(v)        \
	for (auto &i : v) \
		cin >> i; //配列入力
#define vecin(v,n)	\
	vec(v,n);		\
	vin(v);
#define vec(v, n) vector<int> v(n, 0);
#define mod (int)(1e9+7)
typedef long long ll;
typedef unsigned long long ull;
void Main()
{
	int a;
	string S;
	cin>>a>>S;
	if(a<3200){
		cout<<"red"<<"\n";
	}
	else{
		cout<<S<<endl;
	}
}
 
int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << std::fixed << std::setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))

sub = [0 for i in range(N)]

for i in range(N):
    sub[i] = abs(A-(T - 0.006*H[i]))
    
print(sub.index(min(sub))+1)

Measured memory_bytes: 3060
n = int(input())
a = list(map(int,input().split()))

c = [0 for _ in range(9)]
for ai in a:
  for i in range(8):
    if ai <= i*400+399:
      c[i] += 1
      break
  if ai >= 3200:
    c[8] += 1
mn = 0
for i in range(8):
  if c[i] > 0:
    mn += 1
mx = mn+c[8]
if mn == 0:
  mn = 1
print(mn,mx)


Measured memory_bytes: 38256
// Marcin Knapik
#include<bits/stdc++.h>
// #pragma GCC optimize("O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
using namespace std;

// #include <ext/pb_ds/assoc_container.hpp> // order_of_key
// #include <ext/pb_ds/tree_policy.hpp> // find by order
// using namespace __gnu_pbds; 
// #define ordered_set tree< int , null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>  

// const ll MAX_LL = 0xFFFFFFFFFFFFFFFF;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// #define losuj(a, b) uniform_int_distribution<ull>(a, b)(rng)

typedef long double             ld;
typedef long long               ll;
typedef unsigned long long      ull;
typedef pair<ll, ll>            pll;
typedef pair<int, int>          ii;
typedef vector<int>             vi;
typedef vector<ii>              vii;
typedef vector<vi>              vvi;
typedef vector<vector<ii>>      vvii;
typedef vector< ll >            vll;
typedef vector< pll >           vpll;

#define boost                   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(a)                   (int)(a).size()
#define pb                      push_back
#define all(c)                  (c).begin(), (c).end()
#define rall(c)                 (c).rbegin(), (c).rend()
#define REP(i, a, b)            for (int i = (a); i <= (b); i++)
#define FOR(i, a)               for (int i = 0; i < (a); i++)
#define TRAV(i, n)              for(auto&i:n)
#define beg(x)                  (*(x.begin()))
#define re(x)                   int x; cin >>x;   
#define f                       first
#define s                       second

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

template<class T> inline T fast(T a,T b,T mod) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}
template<class T> inline T russian(T a, T b, T mod) {ll res = 0; while(b){if(b&1) res = (res + a)%mod; a = (a+a)%mod; b>>=1;}return res;}
template <class T> istream &operator>>(istream &os, vector<T> &container){for (auto &u : container)os >> u;return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &container){for (auto &u : container)os << u << " ";return os;}
template<typename T> inline T gcd(T a, T b) { while (b)swap(a %= b, b); return a; }

const ll INF = 1e9 + 7;
const ll mod = 998244353;
const ll BIG_INF = 1000000000000000000;
const ll N = 1e6+7;
const ll T = 1<<20;

ll n, m, k, q;

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

	ll a, b, c;
	cin >> a >> b >> c;
	if(a + b > c){
		cout << "No";
		exit(0);
	}

	cout << (4ll*a*b < (c - a - b) * (c - a - b) ? "Yes" : "No") << '\n';
}

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

#define Bye return 0
#define ll long long
const ll MAX = 1e2;

void solve(){
    int n, m; cin>>n>>m;
    ll a[n+1], b[n+1], c[m+1], d[m+1];

    for (int i=1; i<=n; i++) cin>>a[i]>>b[i];
    for (int i=1; i<=m; i++) cin>>c[i]>>d[i];

    for (int i=1; i<=n; i++){
        ll mini = LONG_MAX;
        ll point = 1;
        for (int j=1; j<=m; j++){
            ll x = abs(a[i]-c[j]) + abs(b[i]-d[j]);
            if(x<mini){ mini = x; point = j;}
        }
        cout<<point<<endl;
    }
}

int main(){
    solve();
    Bye;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int K; cin >> K;
    queue<ll> q;
    rep1(i, 9){
        q.push(i);
    }
    ll ans=0;
    rep(i, K){
        ans = q.front(); q.pop();
        int k = ans%10;
        if(k != 0) q.push(ans*10+k-1);
        q.push(ans*10+k);
        if(k != 9) q.push(ans*10+k+1);
    }
    
    cout << ans << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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


int dp[101][4][2];


int main() {
  string N; cin >> N;
  int K; cin >> K;
  int n = N.size();

  dp[0][0][0] = 1;

  rep(i, n) {
    int Ni = N[i] - '0'; // N の上から i 桁目の数
    rep(j, K+1) rep(k, 2) rep(x, 10) {
      int j2 = j, k2 = k; // 遷移後の状態を表す変数 j2, k2 を，遷移前の状態で初期化

      if (x != 0) ++j2;     // X の上から i 桁目の数 x が非ゼロなら j2 を更新
      if (j2 > K) continue; // 非ゼロの桁が K より多いならば無視

      if (!k && (x > Ni)) continue; // N より大きい数であることが確定したら無視
      if (x < Ni) k2 = 1;           // N より小さい数であることが確定したら k2 を更新

      dp[i+1][j2][k2] += dp[i][j][k]; // 遷移式
    }
  }

  int ans = dp[n][K][0] + dp[n][K][1];
  cout << ans << '\n';
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int T, n, m;

int main(int argc, char *argv[]){
	ios::sync_with_stdio(false);
	cin >> n >> m;
	vi a[2];
	REP(i, m) {
		int x; cin >> x;
		a[x % 2].eb(x);
	}
	if (a[1].size() > 2) {
		cout << "Impossible" << endl;
		return 0;
	}
	vi ansa;
	vi ans;
	int lastf = 0;
	if (a[1].empty()) {
		ans.eb(1);
	} else {
		ansa.push_back(a[1][0]);
		ans.eb(a[1][0] + 1);
	}
	for (int u : a[0]) {
		ansa.push_back(u);
		ans.emplace_back(u);
	}
	if (a[1].size() < 2) {
		if (a[0].empty() && a[1][0] != 1) {
			ans.back() -= 2;
			ans.pb(1);
		}else ans.back() --;
	} else {
		ansa.push_back(a[1].back());
		ans.eb(a[1].back() - 1);
	}
	if (ans.back() == 0) ans.pop_back();
	REP(i, ansa.size()) cout << ansa[i] << " \n"[i+1 == ansa.size()];
	cout << ans.size() << endl;
	REP(i, ans.size()) cout << ans[i] << " \n"[i + 1 == ans.size()];
	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String ring=br.readLine();
        String key=br.readLine();
        for(int i=0;i<ring.length();i++){
            if(ring.charAt(i)==key.charAt(0)){
                int root=i;
                int j=0;
                while(j<key.length()&&ring.charAt(root%ring.length())==key.charAt(j)){
                    j++;
                    root++;
                }if(j==key.length()){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }System.out.println("No");
    }
}

Measured memory_bytes: 24376
import java.util.Scanner;

public class Main {

	public static int A[];
	public static int run = 0;

	public static void main(String[] args) {
		//Input
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());

		A = new int[N];
		for(int i = 0 ; i < N ; i++ ) {
			A[i] = Integer.parseInt(sc.next());
		}

		sc.close();

		//Logic
		long[][] dp = new long[N][2];
		dp[0][0] = A[0];
		dp[0][1] = -1*A[0];

		for(int i = 1 ; i < N ; i++) {
			dp[i][0] = Math.max(dp[i-1][0] + A[i], dp[i-1][1] - A[i]);
			dp[i][1] = Math.max(dp[i-1][0] - A[i], dp[i-1][1] + A[i]);
		}

		long answer = dp[N-1][0];

		//Output
		System.out.println(answer);

	}

}


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

int main() {
  string s,t;
  cin >> s >> t;
  int n = s.length();
  int m = t.length();
  sort(s.begin(),s.end());
  sort(t.rbegin(),t.rend());
  if(s<t){
     cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  // bool ok = false;
  // rep(i,min(n,m)) {
  //   if(s[i] < t[i]) {
  //     ok = true;
  //     break;
  //   } else if(s[i] > t[i]) {
  //     break;
  //   }
  //   if (i == min(n, m)-1 && n < m) {
  //     ok = true;
  //     break;
  //   }
  // }

  // if(ok) cout << "Yes" << endl;
  // else cout << "No" << endl;
  return 0;
}

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

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

    int ans = 0;
    for (int i = 0; i < n - 2; ++i)
    {
        if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
            ++ans;
    }
    cout << ans << endl;
}

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


int main(){
    ll N,M;
    cin >> N >> M;
    ll ans = 1;
    for(ll i = M / N; i > 1; i--){
        if((M - i * N) % i == 0){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}





Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	int H, W, K;
	cin >> H >> W >> K;
	vector<string> s(H);
	vector<bool> flag(H);
	for (auto i = 0; i < H; ++i)
	{
		cin >> s[i];
		if (s[i].find('#') != string::npos)
		{
			flag[i] = true;
		}
	}

	auto p = 1;
	auto first = true;
	vector<vector<int>> ans(H, vector<int>(W));
	for (auto i = 0; i < H; ++i)
	{
		if (!flag[i])
		{
			if (!first)
			{
				ans[i] = ans[i - 1];
			}
			continue;
		}

		auto num = 0;
		for (auto j = 0; j < W; ++j)
		{
			if (s[i][j] == '#')
			{
				if (num > 0)
				{
					++p;
				}
				++num;
			}

			ans[i][j] = p;
		}
		++p;

		if (first)
		{
			for (auto j = i - 1; j >= 0; --j)
			{
				ans[j] = ans[i];
			}
			first = false;
		}
	}

	for (auto i = 0; i < H; ++i)
	{
		for (auto j = 0; j < W; ++j)
		{
			cout << ans[i][j];
			if (j < W - 1)
			{
				cout << " ";
			}
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
typedef pair<int,int> P;
int n,k,S,cnt,l,r,ans;
P p[111111];
set<int>st;
multiset<int>ml;
signed main(){
	cin>>n>>k;
	rep(i,n){
		cin>>p[i].second>>p[i].first;
		st.insert(p[i].second);
	}
	sort(p,p+n,greater<P>());
	S=st.size();
	st.erase(st.begin(),st.end());
	rep(i,k){
		cnt+=p[i].first;
		ml.insert(p[i].second);
		st.insert(p[i].second);
	}
	l=k-1,r=k;
	ans=st.size()*st.size()+cnt;
	for(int i=st.size();i<min(k,S);i++){//i:種類数
		while(ml.count(p[l].second)==1)l--;
		while(1){
			if(ml.find(p[r].second)==ml.end()){
				cnt+=p[r].first-p[l].first;
				ml.erase(ml.find(p[l].second));
				l--;
				ml.insert(p[r].second);
				break;
			}
			r++;
		}
		ans=max(ans,(i+1)*(i+1)+cnt);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
typedef unsigned long long int ULL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//Works for forward as well as backward iteration

#define gu getchar
#define pu putchar
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
//# define M_PI           3.14159265358979323846264338327950288

#define DRT() int t; si(t); while(t--)

#define PlUSWRAP(index,n) index = (index+1)%n		//index++; if(index>=n) index=0
#define MINUSWRAP(index,n) index = (index + n -1)%n 	//index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)	//Round off d to nearest integer

#define FLUSHN while(gu()!='\n')
#define FLUSHS while(gu()!=' ')

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.

int main() {
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	srand(chrono::steady_clock::now().time_since_epoch().count());
	off;
	LL x,y;
	cin>>x>>y;
	LL a = x + y/2;
	cout<<a;

  	return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int count = sc.nextInt();
            if (count == 0) {
                break;
            }
            double[] s = new double[count];
            double sum = 0;
            for (int i = 0; i < count; i++) {
                s[i] = sc.nextDouble();
                sum += s[i];
            }
            double average = sum / count;
            double res = 0;
            for (int i = 0; i < count; i++) {
                res += Math.pow(s[i] - average, 2) / count;
            }
            System.out.println(Math.sqrt(res));
        }
    }
}

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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var N = input[0];
            var M = input[1];
            var cnt = new int[M + 1];
            for (int i = 0; i < N; i++)
            {
                input = ReadArrayInt();
                for (int j = 0; j < input[0]; j++)
                {
                    cnt[input[j + 1]]++;
                }
            }
            var ans = 0;
            for (int i = 1; i <= M; i++)
            {
                if (cnt[i] == N) ans++;
            }

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 13396
import java.util.Scanner;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int f_num,s_num;
		while(sc.hasNextInt()){
			f_num = sc.nextInt();
			s_num =sc.nextInt();
			System.out.println(String.valueOf(f_num + s_num).length());
		}
		sc.close();
	}
}

Measured memory_bytes: 26312
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main() {
    int n, q; cin >> n >> q;
    vector<tuple<int, int, int>> a;
    for (int i = 0; i < n; i++) {
        int s, t, x; cin >> s >> t >> x;
        a.push_back(make_tuple(s - x, 1, x));
        a.push_back(make_tuple(t - x, -1, x));
    }
    sort(a.begin(), a.end());
    set<int> st;
    int t = 0;
    for (int i = 0; i < q; i++) {
        int d; cin >> d;
        while (t < a.size() && get<0>(a[t]) <= d) {
            if (get<1>(a[t]) == 1) {
                st.insert(get<2>(a[t]));
            }
            else {
                st.erase(get<2>(a[t]));
            }
            t++;
        }
        if (st.empty()) {
            cout << -1 << endl;
        }
        else {
            cout << (*st.begin()) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 15340
#include<bits/stdc++.h>
int main(){
    std::string s="RYGB";
    int h,w,d;std::cin>>h>>w>>d;
    if(d&1){
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                std::cout<<s[(i+j)%2];
            }
            std::cout<<'\n';
        }
    }else{
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                int x=(i+j)/2,y=(i+w-1-j)/2;
                std::cout<<s.at(1*((x%d)/(d/2))+2*((y%d)/(d/2)));
            }
            std::cout<<'\n';
        }
    }
}


Measured memory_bytes: 512
N, K = map(int, input().split())
A_list = list(map(int, input().split()))
n = len(A_list)
if N <= K:
    print(0)
elif K == 0:
    ans = sum(A_list)
    print(ans)
else:
    A_list.sort()
    del A_list[-K:]
    ans = sum(A_list)
    print(ans)


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

int main() {
    int n, x;
    while (1) {
        cin >> n >> x;
        if (!n && !x) return 0;
    
        int count = 0;
        for (int i = 1; i <= (n - 2); i++) {
            for (int j = i + 1; j <= (n - 1); j++) {
                int num = x - i - j;
                for (int k = j + 1; k <= n; k++) {
                    if (num == k) count++;
                }
            }
        }
    
    cout << count << endl;
    }
}


Measured memory_bytes: 3096
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//ここまでテンプレ
int main(){
	//最初の質問
	cout<<"? "<<1000000000<<endl;
	//最初の入力
	string F;
	cin>>F;
	//10のべき
	if(F=="Y"){
		int Q=2;
		for(int i=0;i<10;i++){
			cout<<"? "<<Q<<endl;
			string A;
			cin>>A;
			if(A=="Y"){
				cout<<"! "<<Q/2<<endl;
				return 0;
			}
			Q*=10;
		}
	}
	//10のべきでない
	//桁数を決める
	else{
		int d=0;
		int Q=100000000;
		for(int i=0;i<10;i++){
			cout<<"? "<<Q<<endl;
			string A;
			cin>>A;
			if(A=="Y"){
				d=8-i;
				break;
			}
			Q/=10;
		}
		//二分探索
		//equalは
		ll low=1,high=1;
		for(int i=0;i<d;i++)
			low*=10;
		high=low*10;
		while(high-low>1){
			ll mid=(high+low)/2;
			cout<<"? "<<mid*10<<endl;
			string A;
			cin>>A;
			if(A=="N")
				low=mid;
			else
				high=mid;
		}
		cout<<"! "<<high<<endl;
	}
	return 0;
}

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

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end

template<unsigned mod=1000000007>struct fp {
   int v; static unsigned get_mod(){return mod;}
   int inv() const{
      int tmp,a=v,b=mod,x=1,y=0;
      while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y);
      if(x<0){x+=mod;} return x;
   }
   fp():v(0){}
   fp(ll x):v(x>=0?x%mod:mod+(x%mod)){}
   fp operator-()const{return fp(-v);}
   fp pow(ll t){fp res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;} return res;}
   fp& operator+=(const fp& x){if((v+=x.v)>=(int)mod)v-=mod; return *this;}
   fp& operator-=(const fp& x){if((v+=mod-x.v)>=(int)mod)v-=mod; return *this;}
   fp& operator*=(const fp& x){v=ll(v)*x.v%mod; return *this;}
   fp& operator/=(const fp& x){v=ll(v)*x.inv()%mod; return *this;}
   fp operator+(const fp& x)const{return fp(*this)+=x;}
   fp operator-(const fp& x)const{return fp(*this)-=x;}
   fp operator*(const fp& x)const{return fp(*this)*=x;}
   fp operator/(const fp& x)const{return fp(*this)/=x;}
   bool operator==(const fp& x)const{return v==x.v;}
   bool operator!=(const fp& x)const{return v!=x.v;}
}; using Fp=fp<>;

int main(){
   int n,k; cin>>n>>k;
   vector<int> a(n);
   rep(i,0,n)cin>>a[i];
   if(n==k){
      Fp res=1;
      rep(i,0,n)res*=a[i];
      cout<<res.v<<endl; return 0;
   }
   sort(ALL(a));
   if(a.back()<0 and k%2==1){
      Fp res=1;
      rep(i,n-k,n)res*=a[i];
      cout<<res.v<<endl; return 0;
   }
   vector<int> pos,neg;
   rep(i,0,n){
      if(a[i]>=0)pos.push_back(a[i]);
      else neg.push_back(-a[i]);
   }
   sort(ALL(pos),greater<int>());
   sort(ALL(neg),greater<int>());
   Fp res=1;
   int pi=0,ni=0;
   while(k){
      if(k==1){
         res*=pos[pi]; k--;
         continue;
      }
      if(neg.size()-ni<=1){
         
         res*=1LL*pos[pi]*pos[pi+1];
         pi+=2; k-=2;
      }
      else if(pos.size()-pi==0){
         res*=1LL*neg[ni]*neg[ni+1];
         ni+=2; k-=2;
      }
      else{
         ll P=1LL*pos[pi]*pos[pi+1];
         ll Q=1LL*neg[ni]*neg[ni+1];
         if(P<Q){
            res*=Q; ni+=2; k-=2;
         }
         else{
            res*=pos[pi]; pi++; k--;
         }
      }
   }
   cout<<res.v<<endl;
   return 0;
}

Measured memory_bytes: 5024
#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	int t; 
	cin>>a>>b>>c;
	if(a>b)
	{
		
		t=a;
		a=b;
		b=t;	
	}
	if(a>c)
	{
		
		t=a;
		a=c;
		c=t;	
	}
	if(b>c)
	{
		
		t=b;
		b=c;
		c=t;	
	}
    cout<<a<<" "<<b<<" "<<c<<endl;
	return 0;
}


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

#define MAX 128
int a[2][MAX];


int main(void)
{
	int n;
	int i;
	int sum, max;
	char *p;
	char buffer[4096];

	// input
	scanf("%d\n",&n);
	fgets(buffer,sizeof buffer-2,stdin);
	p=buffer;
	for (i=0;i<n;++i)
	{
		a[0][i]=strtol(p,&p,10);
	}

	fgets(buffer,sizeof buffer-2,stdin);
	p=buffer;
	for (i=0;i<n;++i)
	{
		a[1][i]=strtol(p,&p,10);
		//printf("%d\n",a[1][i]);
	}

	// search maximum path
	sum=0;
	for (i=0;i<n;++i)
	{
		sum+=a[0][i];
	}

	max=0;
	for (i=n-1;i>=0;--i)
	{
		sum+=a[1][i];
		//printf("\ti: %d, sum: %d\n",i,sum);
		if (sum>max)
		{
			max=sum;
		}
		sum-=a[0][i];
	}

	printf("%d\n",max);
	return 0;
}




Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1000000000;

int main() { 
    int N;
    int M;
    cin >> N;
    vector<string>blues(N);
 
    map<string, int>counter;

    for (int i=0; i<N; i++){
        cin >> blues[i];
        counter[blues[i]]++;
    }
    cin >> M;
    vector<string>reds(M);
    for (int i=0; i<M; i++){
        cin >> reds[i];
        counter[reds[i]]--;
    }
    int nax = -1;

    for (int i=0; i<N; i++)chmax(nax, counter[blues[i]]);
    
    for (int i=0; i<M; i++)chmax(nax, counter[reds[i]]);

    cout << max(nax, 0) << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

// 0-indexed bottom up Segment Tree
// UNIT is the identity element of operation func
template <typename T = int>
struct SegmentTree {
    using F = function<T(T, T)>;
    int n;
    vector<T> dat;
    F func;
    T UNIT;

    SegmentTree(int n_, F func_, T UNIT_) : func(func_), UNIT(UNIT_) {
        n = 1;
        // full binary tree: num of leaves = n = 2^k >= n_
        while (n < n_)
            n *= 2;
        dat.assign(2 * n - 1, UNIT);
    }
    SegmentTree(vector<T> v_, F func_, T UNIT_) : func(func_), UNIT(UNIT_) {
        n      = 1;
        int nv = v_.size();
        while (n < nv)
            n *= 2;
        dat.assign(2 * n - 1, UNIT);
        for (int i = 0; i < nv; ++i) {
            dat[n - 1 + i] = v_[i];
        }
        for (int i = n - 2; i >= 0; --i) {
            dat[i] = func(dat[2 * i + 1], dat[2 * i + 2]);
        }
    }
    void update(int k, T a) {
        // leaves are at index n-1 to 2*n-2
        k += n - 1;
        dat[k] = a;
        while (k > 0) {
            // k -> parent node
            k = (k - 1) / 2;
            // func(child nodes)
            dat[k] = func(dat[2 * k + 1], dat[2 * k + 2]);
        }
    }
    // get result of func() in [l, r)
    T query(int l, int r) {
        l += n - 1;
        r += n - 1;
        T retl = UNIT, retr = UNIT;
        while (l < r) {
            if ((l & 1) == 0)
                retl = func(retl, dat[l]);
            if ((r & 1) == 0)
                retr = func(dat[r - 1], retr);
            l = l / 2;
            r = (r - 1) / 2;
        }
        return func(retl, retr);
    }
};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int q;
    cin >> q;
    vector<vector<int>> v(n, vector<int>(26, 0));
    for (int i = 0; i < (int)s.size(); ++i) {
        v[i][s[i] - 'a']++;
    }
    auto f = [](vector<int> l, vector<int> r) {
        for (int i = 0; i < 26; ++i) {
            l[i] += r[i];
        }
        return l;
    };
    vector<int> unit(26, 0);
    SegmentTree<vector<int>> seg(v, f, unit);
    for (int i = 0; i < q; ++i) {
        int k;
        cin >> k;
        if (k == 1) {
            int j;
            char c;
            cin >> j >> c;
            j--;
            vector<int> x(26, 0);
            x[c - 'a'] = 1;
            seg.update(j, x);
        } else if (k == 2) {
            int l, r;
            cin >> l >> r;
            l--;
            auto tot = seg.query(l, r);
            int cnt  = 0;
            for (int i = 0; i < 26; ++i) {
                if (tot[i] != 0)
                    cnt++;
            }
            cout << cnt << "\n";
        }
    }
    return 0;
}

Measured memory_bytes: 272796
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
"""
x = I()
if x < 1200:
    print("ABC")
else:
    print("ARC")
"""
#B
s = input()
n = len(s)
for i in range(n):
    if s[i] == "A":
        break
for j in range(n)[::-1]:
    if s[j] == "Z":
        break
print(j-i+1)
#C
"""
x = I()
ans = 2*(x//11)+1
x %= 11
if x == 0:
    ans -= 1
if x > 6:
    ans += 1
print(ans)
"""

#D
"""
n = I()
a = LI()
d = defaultdict(int)
for i in a:
    d[i] += 1
l = list(d.values())
k = len(l)+sum(l)
for i in d.keys():
    d[i] = 1
ans = sum(list(d.values()))
ans -= 1 if k%2 else 0
print(ans)
"""
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 41584